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