00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "kspellui.h"
00013
00014 #include <qvariant.h>
00015 #include <qlabel.h>
00016 #include <qpushbutton.h>
00017 #include <qheader.h>
00018 #include <qlistview.h>
00019 #include <qlineedit.h>
00020 #include <qcombobox.h>
00021 #include <qlayout.h>
00022 #include <qtooltip.h>
00023 #include <qwhatsthis.h>
00024
00025
00026
00027
00028
00029 KSpellUI::KSpellUI( QWidget* parent, const char* name, WFlags fl )
00030 : QWidget( parent, name, fl )
00031 {
00032 if ( !name )
00033 setName( "KSpellUI" );
00034 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
00035 KSpellUILayout = new QGridLayout( this, 1, 1, 0, 6, "KSpellUILayout");
00036 KSpellUILayout->setResizeMode( QLayout::Minimum );
00037
00038 textLabel2 = new QLabel( this, "textLabel2" );
00039
00040 KSpellUILayout->addMultiCellWidget( textLabel2, 1, 1, 0, 1 );
00041
00042 m_unknownWord = new QLabel( this, "m_unknownWord" );
00043
00044 KSpellUILayout->addWidget( m_unknownWord, 1, 2 );
00045
00046 textLabel5 = new QLabel( this, "textLabel5" );
00047
00048 KSpellUILayout->addWidget( textLabel5, 8, 0 );
00049
00050 m_contextLabel = new QLabel( this, "m_contextLabel" );
00051 m_contextLabel->setFrameShape( QLabel::Box );
00052 m_contextLabel->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
00053
00054 KSpellUILayout->addMultiCellWidget( m_contextLabel, 0, 0, 0, 5 );
00055
00056 m_addBtn = new QPushButton( this, "m_addBtn" );
00057
00058 KSpellUILayout->addMultiCellWidget( m_addBtn, 1, 1, 4, 5 );
00059 spacer2 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00060 KSpellUILayout->addItem( spacer2, 1, 3 );
00061
00062 m_replaceAllBtn = new QPushButton( this, "m_replaceAllBtn" );
00063
00064 KSpellUILayout->addWidget( m_replaceAllBtn, 4, 5 );
00065
00066 m_suggestions = new QListView( this, "m_suggestions" );
00067 m_suggestions->addColumn( tr2i18n( "Suggested Words" ) );
00068 m_suggestions->setResizeMode( QListView::AllColumns );
00069
00070 KSpellUILayout->addMultiCellWidget( m_suggestions, 3, 7, 0, 4 );
00071
00072 m_replaceBtn = new QPushButton( this, "m_replaceBtn" );
00073
00074 KSpellUILayout->addWidget( m_replaceBtn, 3, 5 );
00075
00076 textLabel4 = new QLabel( this, "textLabel4" );
00077
00078 KSpellUILayout->addMultiCellWidget( textLabel4, 2, 2, 0, 1 );
00079
00080 m_skipBtn = new QPushButton( this, "m_skipBtn" );
00081
00082 KSpellUILayout->addWidget( m_skipBtn, 5, 5 );
00083
00084 m_skipAllBtn = new QPushButton( this, "m_skipAllBtn" );
00085
00086 KSpellUILayout->addWidget( m_skipAllBtn, 6, 5 );
00087
00088 m_replacement = new QLineEdit( this, "m_replacement" );
00089
00090 KSpellUILayout->addMultiCellWidget( m_replacement, 2, 2, 2, 4 );
00091
00092 m_suggestBtn = new QPushButton( this, "m_suggestBtn" );
00093
00094 KSpellUILayout->addWidget( m_suggestBtn, 2, 5 );
00095
00096 m_language = new QComboBox( FALSE, this, "m_language" );
00097
00098 KSpellUILayout->addMultiCellWidget( m_language, 8, 8, 1, 4 );
00099 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
00100 KSpellUILayout->addMultiCell( spacer1, 7, 8, 5, 5 );
00101 languageChange();
00102 resize( QSize(422, 282).expandedTo(minimumSizeHint()) );
00103 clearWState( WState_Polished );
00104
00105
00106 setTabOrder( m_addBtn, m_replacement );
00107 setTabOrder( m_replacement, m_suggestBtn );
00108 setTabOrder( m_suggestBtn, m_replaceBtn );
00109 setTabOrder( m_replaceBtn, m_replaceAllBtn );
00110 setTabOrder( m_replaceAllBtn, m_skipBtn );
00111 setTabOrder( m_skipBtn, m_skipAllBtn );
00112 setTabOrder( m_skipAllBtn, m_suggestions );
00113 setTabOrder( m_suggestions, m_language );
00114
00115
00116 textLabel5->setBuddy( m_language );
00117 textLabel4->setBuddy( m_replacement );
00118 }
00119
00120
00121
00122
00123 KSpellUI::~KSpellUI()
00124 {
00125
00126 }
00127
00128
00129
00130
00131
00132 void KSpellUI::languageChange()
00133 {
00134 textLabel2->setText( tr2i18n( "Unknown word:" ) );
00135 QWhatsThis::add( textLabel2, tr2i18n( "<qt><p>This word was considered to be an \"unknown word\" because it does not match any entry in the dictionary currently in use. It may also be a word in a foreign language.</p>\n"
00136 "<p>If the word is not misspelled, you may add it to the dictionary by clicking <b>Add to Dictionary</b>. If you don't want to add the unknown word to the dictionary, but you want to leave it unchanged, click <b>Ignore</b> or <b>Ignore All</b>.</p>\n"
00137 "<p>However, if the word is misspelled, you can try to find the correct replacement in the list below. If you cannot find a replacement there, you may type it in the text box below, and click <b>Replace</b> or <b>Replace All</b>.</p>\n"
00138 "</qt>" ) );
00139 m_unknownWord->setText( tr2i18n( "<b>misspelled</b>" ) );
00140 QToolTip::add( m_unknownWord, tr2i18n( "Unknown word" ) );
00141 QWhatsThis::add( m_unknownWord, tr2i18n( "<qt><p>This word was considered to be an \"unknown word\" because it does not match any entry in the dictionary currently in use. It may also be a word in a foreign language.</p>\n"
00142 "<p>If the word is not misspelled, you may add it to the dictionary by clicking <b>Add to Dictionary</b>. If you don't want to add the unknown word to the dictionary, but you want to leave it unchanged, click <b>Ignore</b> or <b>Ignore All</b>.</p>\n"
00143 "<p>However, if the word is misspelled, you can try to find the correct replacement in the list below. If you cannot find a replacement there, you may type it in the text box below, and click <b>Replace</b> or <b>Replace All</b>.</p>\n"
00144 "</qt>" ) );
00145 textLabel5->setText( tr2i18n( "&Language:" ) );
00146 QWhatsThis::add( textLabel5, tr2i18n( "<qt>\n"
00147 "<p>Select the language of the document you are proofing here.</p>\n"
00148 "</qt>" ) );
00149 m_contextLabel->setText( tr2i18n( "... the <b>misspelled</b> word shown in context ..." ) );
00150 QToolTip::add( m_contextLabel, tr2i18n( "Text excerpt showing the unknown word in its context." ) );
00151 QWhatsThis::add( m_contextLabel, tr2i18n( "<qt>\n"
00152 "<p>Here you can see a text excerpt showing the unknown word in its context. If this information is not sufficient to choose the best replacement for the unknown word, you can click on the document you are proofing, read a larger part of the text and then return here to continue proofing.</p>\n"
00153 "</qt>" ) );
00154 m_addBtn->setText( tr2i18n( "<< Add to Dictionary" ) );
00155 QWhatsThis::add( m_addBtn, tr2i18n( "<qt>\n"
00156 "<p>The unknown word was detected and considered unknown because it is not included in the dictionary.<br>\n"
00157 "Click here if you consider that the unknown word is not misspelled and you want to avoid wrongly detecting it again in the future. If you want to let it remain as is, but not add it to the dictionary, then click <b>Ignore</b> or <b>Ignore All</b> instead.</p>\n"
00158 "</qt>" ) );
00159 m_replaceAllBtn->setText( tr2i18n( "R&eplace All" ) );
00160 QWhatsThis::add( m_replaceAllBtn, tr2i18n( "<qt>\n"
00161 "<p>Click here to replace all occurrences of the unknown text with the text in the edit box above (to the left).</p>\n"
00162 "</qt>" ) );
00163 m_suggestions->header()->setLabel( 0, tr2i18n( "Suggested Words" ) );
00164 QToolTip::add( m_suggestions, tr2i18n( "Suggestion List" ) );
00165 QWhatsThis::add( m_suggestions, tr2i18n( "<qt>\n"
00166 "<p>If the unknown word is misspelled, you should check if the correction for it is available and if it is, click on it. If none of the words in this list is a good replacement you may type the correct word in the edit box above.</p>\n"
00167 "<p>To correct this word click <b>Replace</b> if you want to correct only this occurrence or <b>Replace All</b> if you want to correct all occurrences.</p>\n"
00168 "</qt>" ) );
00169 m_replaceBtn->setText( tr2i18n( "&Replace" ) );
00170 QWhatsThis::add( m_replaceBtn, tr2i18n( "<qt>\n"
00171 "<p>Click here to replace this occurrence of the unknown text with the text in the edit box above (to the left).</p>\n"
00172 "</qt>" ) );
00173 textLabel4->setText( tr2i18n( "Replace &with:" ) );
00174 QWhatsThis::add( textLabel4, tr2i18n( "<qt>\n"
00175 "<p>If the unknown word is misspelled, you should type the correction for your misspelled word here or select it from the list below.</p>\n"
00176 "<p>You can then click <b>Replace</b> if you want to correct only this occurrence of the word or <b>Replace All</b> if you want to correct all occurrences.</p>\n"
00177 "</qt>" ) );
00178 m_skipBtn->setText( tr2i18n( "&Ignore" ) );
00179 QWhatsThis::add( m_skipBtn, tr2i18n( "<qt>\n"
00180 "<p>Click here to let this occurrence of the unknown word remain as is.</p>\n"
00181 "<p>This action is useful when the word is a name, an acronym, a foreign word or any other unknown word that you want to use but not add to the dictionary.</p>\n"
00182 "</qt>" ) );
00183 m_skipAllBtn->setText( tr2i18n( "I&gnore All" ) );
00184 QWhatsThis::add( m_skipAllBtn, tr2i18n( "<qt>\n"
00185 "<p>Click here to let all occurrences of the unknown word remain as they are.</p>\n"
00186 "<p>This action is useful when the word is a name, an acronym, a foreign word or any other unknown word that you want to use but not add to the dictionary.</p>\n"
00187 "</qt>" ) );
00188 QWhatsThis::add( m_replacement, tr2i18n( "<qt>\n"
00189 "<p>If the unknown word is misspelled, you should type the correction for your misspelled word here or select it from the list below.</p>\n"
00190 "<p>You can then click <b>Replace</b> if you want to correct only this occurrence of the word or <b>Replace All</b> if you want to correct all occurrences.</p>\n"
00191 "</qt>" ) );
00192 m_suggestBtn->setText( tr2i18n( "S&uggest" ) );
00193 m_language->clear();
00194 m_language->insertItem( tr2i18n( "English" ) );
00195 QToolTip::add( m_language, tr2i18n( "Language Selection" ) );
00196 QWhatsThis::add( m_language, tr2i18n( "<qt>\n"
00197 "<p>Select the language of the document you are proofing here.</p>\n"
00198 "</qt>" ) );
00199 }
00200
00201 #include "kspellui.moc"