kspellui.cpp

00001 #include <kdialog.h>
00002 #include <klocale.h>
00003 /****************************************************************************
00004 ** Form implementation generated from reading ui file './kspellui.ui'
00005 **
00006 ** Created by: The User Interface Compiler ($Id: qt/main.cpp   3.3.6   edited Aug 31 2005 $)
00007 **
00008 ** WARNING! All changes made in this file will be lost!
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  *  Constructs a KSpellUI as a child of 'parent', with the
00026  *  name 'name' and widget flags set to 'f'.
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, 0, 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     spacer2 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00059     KSpellUILayout->addItem( spacer2, 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     spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
00099     KSpellUILayout->addMultiCell( spacer1, 7, 8, 5, 5 );
00100     languageChange();
00101     resize( QSize(422, 282).expandedTo(minimumSizeHint()) );
00102     clearWState( WState_Polished );
00103 
00104     // tab order
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     // buddies
00115     textLabel5->setBuddy( m_language );
00116     textLabel4->setBuddy( m_replacement );
00117 }
00118 
00119 /*
00120  *  Destroys the object and frees any allocated resources
00121  */
00122 KSpellUI::~KSpellUI()
00123 {
00124     // no need to delete child widgets, Qt does it all for us
00125 }
00126 
00127 /*
00128  *  Sets the strings of the subwidgets using the current
00129  *  language.
00130  */
00131 void KSpellUI::languageChange()
00132 {
00133     textLabel2->setText( tr2i18n( "Unknown word:" ) );
00134     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"
00135 "<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"
00136 "<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"
00137 "</qt>" ) );
00138     m_unknownWord->setText( tr2i18n( "<b>misspelled</b>" ) );
00139     QToolTip::add( m_unknownWord, tr2i18n( "Unknown word" ) );
00140     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"
00141 "<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"
00142 "<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"
00143 "</qt>" ) );
00144     textLabel5->setText( tr2i18n( "&Language:" ) );
00145     QWhatsThis::add( textLabel5, tr2i18n( "<qt>\n"
00146 "<p>Select the language of the document you are proofing here.</p>\n"
00147 "</qt>" ) );
00148     m_contextLabel->setText( tr2i18n( "... the <b>misspelled</b> word shown in context ..." ) );
00149     QToolTip::add( m_contextLabel, tr2i18n( "Text excerpt showing the unknown word in its context." ) );
00150     QWhatsThis::add( m_contextLabel, tr2i18n( "<qt>\n"
00151 "<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"
00152 "</qt>" ) );
00153     m_addBtn->setText( tr2i18n( "<< Add to Dictionary" ) );
00154     QWhatsThis::add( m_addBtn, tr2i18n( "<qt>\n"
00155 "<p>The unknown word was detected and considered unknown because it is not included in the dictionary.<br>\n"
00156 "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"
00157 "</qt>" ) );
00158     m_replaceAllBtn->setText( tr2i18n( "R&eplace All" ) );
00159     QWhatsThis::add( m_replaceAllBtn, tr2i18n( "<qt>\n"
00160 "<p>Click here to replace all occurrences of the unknown text with the text in the edit box above (to the left).</p>\n"
00161 "</qt>" ) );
00162     m_suggestions->header()->setLabel( 0, tr2i18n( "Suggested Words" ) );
00163     QToolTip::add( m_suggestions, tr2i18n( "Suggestion List" ) );
00164     QWhatsThis::add( m_suggestions, tr2i18n( "<qt>\n"
00165 "<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"
00166 "<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"
00167 "</qt>" ) );
00168     m_replaceBtn->setText( tr2i18n( "&Replace" ) );
00169     QWhatsThis::add( m_replaceBtn, tr2i18n( "<qt>\n"
00170 "<p>Click here to replace this occurrence of the unknown text with the text in the edit box above (to the left).</p>\n"
00171 "</qt>" ) );
00172     textLabel4->setText( tr2i18n( "Replace &with:" ) );
00173     QWhatsThis::add( textLabel4, tr2i18n( "<qt>\n"
00174 "<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"
00175 "<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"
00176 "</qt>" ) );
00177     m_skipBtn->setText( tr2i18n( "&Ignore" ) );
00178     QWhatsThis::add( m_skipBtn, tr2i18n( "<qt>\n"
00179 "<p>Click here to let this occurrence of the unknown word remain as is.</p>\n"
00180 "<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"
00181 "</qt>" ) );
00182     m_skipAllBtn->setText( tr2i18n( "I&gnore All" ) );
00183     QWhatsThis::add( m_skipAllBtn, tr2i18n( "<qt>\n"
00184 "<p>Click here to let all occurrences of the unknown word remain as they are.</p>\n"
00185 "<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"
00186 "</qt>" ) );
00187     QWhatsThis::add( m_replacement, tr2i18n( "<qt>\n"
00188 "<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"
00189 "<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"
00190 "</qt>" ) );
00191     m_suggestBtn->setText( tr2i18n( "S&uggest" ) );
00192     m_language->clear();
00193     m_language->insertItem( tr2i18n( "English" ) );
00194     QToolTip::add( m_language, tr2i18n( "Language Selection" ) );
00195     QWhatsThis::add( m_language, tr2i18n( "<qt>\n"
00196 "<p>Select the language of the document you are proofing here.</p>\n"
00197 "</qt>" ) );
00198 }
00199 
00200 #include "kspellui.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys