00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "kspell2ui.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 KSpell2UI::KSpell2UI( QWidget* parent, const char* name, WFlags fl )
00030 : QWidget( parent, name, fl )
00031 {
00032 if ( !name )
00033 setName( "KSpell2UI" );
00034 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
00035 setMinimumSize( QSize( 430, 300 ) );
00036 KSpell2UILayout = new QGridLayout( this, 1, 1, 11, 6, "KSpell2UILayout");
00037
00038 textLabel2 = new QLabel( this, "textLabel2" );
00039
00040 KSpell2UILayout->addMultiCellWidget( textLabel2, 1, 1, 0, 1 );
00041
00042 m_unknownWord = new QLabel( this, "m_unknownWord" );
00043
00044 KSpell2UILayout->addWidget( m_unknownWord, 1, 2 );
00045
00046 textLabel5 = new QLabel( this, "textLabel5" );
00047
00048 KSpell2UILayout->addWidget( textLabel5, 4, 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 KSpell2UILayout->addMultiCellWidget( m_contextLabel, 0, 0, 0, 5 );
00055
00056 m_addBtn = new QPushButton( this, "m_addBtn" );
00057
00058 KSpell2UILayout->addMultiCellWidget( m_addBtn, 1, 1, 4, 5 );
00059 spacer2 = new QSpacerItem( 74, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00060 KSpell2UILayout->addItem( spacer2, 1, 3 );
00061
00062 m_suggestions = new QListView( this, "m_suggestions" );
00063 m_suggestions->addColumn( tr2i18n( "Suggested Words" ) );
00064 m_suggestions->setResizeMode( QListView::AllColumns );
00065
00066 KSpell2UILayout->addMultiCellWidget( m_suggestions, 3, 3, 0, 4 );
00067
00068 textLabel4 = new QLabel( this, "textLabel4" );
00069
00070 KSpell2UILayout->addMultiCellWidget( textLabel4, 2, 2, 0, 1 );
00071
00072 m_replacement = new QLineEdit( this, "m_replacement" );
00073
00074 KSpell2UILayout->addMultiCellWidget( m_replacement, 2, 2, 2, 4 );
00075
00076 m_language = new QComboBox( FALSE, this, "m_language" );
00077
00078 KSpell2UILayout->addMultiCellWidget( m_language, 4, 4, 1, 4 );
00079
00080 layout1 = new QVBoxLayout( 0, 0, 6, "layout1");
00081
00082 m_suggestBtn = new QPushButton( this, "m_suggestBtn" );
00083 layout1->addWidget( m_suggestBtn );
00084
00085 m_replaceBtn = new QPushButton( this, "m_replaceBtn" );
00086 layout1->addWidget( m_replaceBtn );
00087
00088 m_replaceAllBtn = new QPushButton( this, "m_replaceAllBtn" );
00089 layout1->addWidget( m_replaceAllBtn );
00090
00091 m_skipBtn = new QPushButton( this, "m_skipBtn" );
00092 layout1->addWidget( m_skipBtn );
00093
00094 m_skipAllBtn = new QPushButton( this, "m_skipAllBtn" );
00095 layout1->addWidget( m_skipAllBtn );
00096
00097 m_autoCorrect = new QPushButton( this, "m_autoCorrect" );
00098 layout1->addWidget( m_autoCorrect );
00099 spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00100 layout1->addItem( spacer1 );
00101
00102 KSpell2UILayout->addMultiCellLayout( layout1, 2, 4, 5, 5 );
00103 languageChange();
00104 resize( QSize(481, 311).expandedTo(minimumSizeHint()) );
00105 clearWState( WState_Polished );
00106
00107
00108 setTabOrder( m_addBtn, m_replacement );
00109 setTabOrder( m_replacement, m_suggestBtn );
00110 setTabOrder( m_suggestBtn, m_replaceBtn );
00111 setTabOrder( m_replaceBtn, m_replaceAllBtn );
00112 setTabOrder( m_replaceAllBtn, m_skipBtn );
00113 setTabOrder( m_skipBtn, m_skipAllBtn );
00114 setTabOrder( m_skipAllBtn, m_suggestions );
00115 setTabOrder( m_suggestions, m_language );
00116
00117
00118 textLabel5->setBuddy( m_language );
00119 textLabel4->setBuddy( m_replacement );
00120 }
00121
00122
00123
00124
00125 KSpell2UI::~KSpell2UI()
00126 {
00127
00128 }
00129
00130
00131
00132
00133
00134 void KSpell2UI::languageChange()
00135 {
00136 textLabel2->setText( tr2i18n( "Unknown word:" ) );
00137 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"
00138 "<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"
00139 "<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"
00140 "</qt>" ) );
00141 m_unknownWord->setText( tr2i18n( "<b>misspelled</b>" ) );
00142 QToolTip::add( m_unknownWord, tr2i18n( "Unknown word" ) );
00143 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"
00144 "<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"
00145 "<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"
00146 "</qt>" ) );
00147 textLabel5->setText( tr2i18n( "&Language:" ) );
00148 QWhatsThis::add( textLabel5, tr2i18n( "<qt>\n"
00149 "<p>Select the language of the document you are proofing here.</p>\n"
00150 "</qt>" ) );
00151 m_contextLabel->setText( tr2i18n( "... the <b>misspelled</b> word shown in context ..." ) );
00152 QToolTip::add( m_contextLabel, tr2i18n( "Text excerpt showing the unknown word in its context." ) );
00153 QWhatsThis::add( m_contextLabel, tr2i18n( "<qt>\n"
00154 "<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"
00155 "</qt>" ) );
00156 m_addBtn->setText( tr2i18n( "<< Add to Dictionary" ) );
00157 QWhatsThis::add( m_addBtn, tr2i18n( "<qt>\n"
00158 "<p>The unknown word was detected and considered unknown because it is not included in the dictionary.<br>\n"
00159 "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"
00160 "</qt>" ) );
00161 m_suggestions->header()->setLabel( 0, tr2i18n( "Suggested Words" ) );
00162 QToolTip::add( m_suggestions, tr2i18n( "Suggestion List" ) );
00163 QWhatsThis::add( m_suggestions, tr2i18n( "<qt>\n"
00164 "<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"
00165 "<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"
00166 "</qt>" ) );
00167 textLabel4->setText( tr2i18n( "Replace &with:" ) );
00168 QWhatsThis::add( textLabel4, tr2i18n( "<qt>\n"
00169 "<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"
00170 "<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"
00171 "</qt>" ) );
00172 QWhatsThis::add( m_replacement, tr2i18n( "<qt>\n"
00173 "<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"
00174 "<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"
00175 "</qt>" ) );
00176 m_language->clear();
00177 m_language->insertItem( tr2i18n( "English" ) );
00178 QToolTip::add( m_language, tr2i18n( "Language Selection" ) );
00179 QWhatsThis::add( m_language, tr2i18n( "<qt>\n"
00180 "<p>Select the language of the document you are proofing here.</p>\n"
00181 "</qt>" ) );
00182 m_suggestBtn->setText( tr2i18n( "S&uggest" ) );
00183 m_replaceBtn->setText( tr2i18n( "&Replace" ) );
00184 QWhatsThis::add( m_replaceBtn, tr2i18n( "<qt>\n"
00185 "<p>Click here to replace this occurrence of the unknown text with the text in the edit box above (to the left).</p>\n"
00186 "</qt>" ) );
00187 m_replaceAllBtn->setText( tr2i18n( "R&eplace All" ) );
00188 QWhatsThis::add( m_replaceAllBtn, tr2i18n( "<qt>\n"
00189 "<p>Click here to replace all occurrences of the unknown text with the text in the edit box above (to the left).</p>\n"
00190 "</qt>" ) );
00191 m_skipBtn->setText( tr2i18n( "&Ignore" ) );
00192 QWhatsThis::add( m_skipBtn, tr2i18n( "<qt>\n"
00193 "<p>Click here to let this occurrence of the unknown word remain as is.</p>\n"
00194 "<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"
00195 "</qt>" ) );
00196 m_skipAllBtn->setText( tr2i18n( "I&gnore All" ) );
00197 QWhatsThis::add( m_skipAllBtn, tr2i18n( "<qt>\n"
00198 "<p>Click here to let all occurrences of the unknown word remain as they are.</p>\n"
00199 "<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"
00200 "</qt>" ) );
00201 m_autoCorrect->setText( tr2i18n( "Autocorrect" ) );
00202 QWhatsThis::add( m_autoCorrect, tr2i18n( "<qt>\n"
00203 "<p>Click here to let all occurrences of the unknown word remain as they are.</p>\n"
00204 "<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"
00205 "</qt>" ) );
00206 }
00207
00208 #include "kspell2ui.moc"