00001 #include <klocale.h>
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "kspellui.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 KSpellUI::KSpellUI( QWidget* parent, const char* name, WFlags fl )
00029 : QWidget( parent, name, fl )
00030 {
00031 if ( !name )
00032 setName( "KSpellUI" );
00033 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
00034 KSpellUILayout = new QGridLayout( this, 1, 1, 11, 6, "KSpellUILayout");
00035 KSpellUILayout->setResizeMode( QLayout::Minimum );
00036
00037 textLabel2 = new QLabel( this, "textLabel2" );
00038
00039 KSpellUILayout->addMultiCellWidget( textLabel2, 1, 1, 0, 1 );
00040
00041 m_unknownWord = new QLabel( this, "m_unknownWord" );
00042
00043 KSpellUILayout->addWidget( m_unknownWord, 1, 2 );
00044
00045 textLabel5 = new QLabel( this, "textLabel5" );
00046
00047 KSpellUILayout->addWidget( textLabel5, 8, 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 KSpellUILayout->addMultiCellWidget( m_contextLabel, 0, 0, 0, 5 );
00054
00055 m_addBtn = new QPushButton( this, "m_addBtn" );
00056
00057 KSpellUILayout->addMultiCellWidget( m_addBtn, 1, 1, 4, 5 );
00058 QSpacerItem* spacer = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00059 KSpellUILayout->addItem( spacer, 1, 3 );
00060
00061 m_replaceAllBtn = new QPushButton( this, "m_replaceAllBtn" );
00062
00063 KSpellUILayout->addWidget( m_replaceAllBtn, 4, 5 );
00064
00065 m_suggestions = new QListView( this, "m_suggestions" );
00066 m_suggestions->addColumn( tr2i18n( "Suggested Words" ) );
00067 m_suggestions->setResizeMode( QListView::AllColumns );
00068
00069 KSpellUILayout->addMultiCellWidget( m_suggestions, 3, 7, 0, 4 );
00070
00071 m_replaceBtn = new QPushButton( this, "m_replaceBtn" );
00072
00073 KSpellUILayout->addWidget( m_replaceBtn, 3, 5 );
00074
00075 textLabel4 = new QLabel( this, "textLabel4" );
00076
00077 KSpellUILayout->addMultiCellWidget( textLabel4, 2, 2, 0, 1 );
00078
00079 m_skipBtn = new QPushButton( this, "m_skipBtn" );
00080
00081 KSpellUILayout->addWidget( m_skipBtn, 5, 5 );
00082
00083 m_skipAllBtn = new QPushButton( this, "m_skipAllBtn" );
00084
00085 KSpellUILayout->addWidget( m_skipAllBtn, 6, 5 );
00086
00087 m_replacement = new QLineEdit( this, "m_replacement" );
00088
00089 KSpellUILayout->addMultiCellWidget( m_replacement, 2, 2, 2, 4 );
00090
00091 m_suggestBtn = new QPushButton( this, "m_suggestBtn" );
00092
00093 KSpellUILayout->addWidget( m_suggestBtn, 2, 5 );
00094
00095 m_language = new QComboBox( FALSE, this, "m_language" );
00096
00097 KSpellUILayout->addMultiCellWidget( m_language, 8, 8, 1, 4 );
00098 QSpacerItem* spacer_2 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
00099 KSpellUILayout->addMultiCell( spacer_2, 7, 8, 5, 5 );
00100 languageChange();
00101 resize( QSize(438, 308).expandedTo(minimumSizeHint()) );
00102 clearWState( WState_Polished );
00103
00104
00105 setTabOrder( m_addBtn, m_replacement );
00106 setTabOrder( m_replacement, m_suggestBtn );
00107 setTabOrder( m_suggestBtn, m_replaceBtn );
00108 setTabOrder( m_replaceBtn, m_replaceAllBtn );
00109 setTabOrder( m_replaceAllBtn, m_skipBtn );
00110 setTabOrder( m_skipBtn, m_skipAllBtn );
00111 setTabOrder( m_skipAllBtn, m_suggestions );
00112 setTabOrder( m_suggestions, m_language );
00113
00114
00115 textLabel5->setBuddy( m_language );
00116 textLabel4->setBuddy( m_replacement );
00117 }
00118
00119
00120
00121
00122 KSpellUI::~KSpellUI()
00123 {
00124
00125 }
00126
00127
00128
00129
00130
00131 void KSpellUI::languageChange()
00132 {
00133 setCaption( tr2i18n( "KSpellUI" ) );
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"