• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

kfinddialog.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
00003     Copyright (C) 2002, David Faure <david@mandrakesoft.com>
00004     This file is part of the KDE project
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2, as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "kfinddialog.h"
00022 #include "kfinddialog_p.h"
00023 
00024 #include <QtGui/QCheckBox>
00025 #include <QtGui/QCursor>
00026 #include <QtGui/QGroupBox>
00027 #include <QtGui/QLabel>
00028 #include <QtGui/QLayout>
00029 #include <QtGui/QLineEdit>
00030 #include <QtGui/QMenu>
00031 #include <QtGui/QPushButton>
00032 #include <QtCore/QRegExp>
00033 #include <kcombobox.h>
00034 #include <khistorycombobox.h>
00035 #include <kdebug.h>
00036 #include <klocale.h>
00037 #include <kmessagebox.h>
00038 #include <assert.h>
00039 #include <kfind.h>
00040 #include <kregexpeditorinterface.h>
00041 #include <kservicetypetrader.h>
00042 
00043 KFindDialog::KFindDialog(QWidget *parent, long options, const QStringList &findStrings, bool hasSelection, bool replaceDialog)
00044     : KDialog(parent),
00045       d(new KFindDialogPrivate(this))
00046 {
00047     setCaption( i18n("Find Text") );
00048     setButtons( Ok | Cancel );
00049     setDefaultButton( Ok );
00050 
00051     d->init(replaceDialog, findStrings, hasSelection);
00052     setOptions(options);
00053     setButtonGuiItem( KDialog::Cancel, KStandardGuiItem::close() );
00054 }
00055 
00056 KFindDialog::~KFindDialog()
00057 {
00058     delete d;
00059 }
00060 
00061 QWidget *KFindDialog::findExtension() const
00062 {
00063     if (!d->findExtension)
00064     {
00065       d->findExtension = new QWidget(d->findGrp);
00066       d->findLayout->addWidget(d->findExtension, 3, 0, 1, 2);
00067     }
00068 
00069     return d->findExtension;
00070 }
00071 
00072 QStringList KFindDialog::findHistory() const
00073 {
00074     return d->find->historyItems();
00075 }
00076 
00077 void KFindDialog::KFindDialogPrivate::init(bool forReplace, const QStringList &_findStrings, bool hasSelection)
00078 {
00079     QVBoxLayout *topLayout;
00080     QGridLayout *optionsLayout;
00081 
00082     // Create common parts of dialog.
00083     QWidget *page = new QWidget(q);
00084     q->setMainWidget(page);
00085 
00086     topLayout = new QVBoxLayout(page);
00087     topLayout->setMargin( 0 );
00088 
00089     findGrp = new QGroupBox(i18nc("@title:group", "Find"), page);
00090     findLayout = new QGridLayout(findGrp);
00091 
00092     QLabel *findLabel = new QLabel(i18n("&Text to find:"), findGrp);
00093     find = new KHistoryComboBox(findGrp);
00094     find->setMaxCount(10);
00095     find->setDuplicatesEnabled(false);
00096     regExp = new QCheckBox(i18n("Regular e&xpression"), findGrp);
00097     regExpItem = new QPushButton(i18n("&Edit..."), findGrp);
00098     regExpItem->setEnabled(false);
00099 
00100     findLayout->addWidget(findLabel, 0, 0);
00101     findLayout->addWidget(find, 1, 0, 1, 2);
00102     findLayout->addWidget(regExp, 2, 0);
00103     findLayout->addWidget(regExpItem, 2, 1);
00104     topLayout->addWidget(findGrp);
00105 
00106     replaceGrp = new QGroupBox( i18n("Replace With"), page);
00107     replaceLayout = new QGridLayout(replaceGrp);
00108 
00109     QLabel *replaceLabel = new QLabel(i18n("Replace&ment text:"), replaceGrp);
00110     replace = new KHistoryComboBox(replaceGrp);
00111     replace->setMaxCount(10);
00112     replace->setDuplicatesEnabled(false);
00113     backRef = new QCheckBox(i18n("Use p&laceholders"), replaceGrp);
00114     backRefItem = new QPushButton(i18n("Insert Place&holder"), replaceGrp);
00115     backRefItem->setEnabled(false);
00116 
00117     replaceLayout->addWidget(replaceLabel, 0, 0);
00118     replaceLayout->addWidget(replace, 1, 0, 1, 2);
00119     replaceLayout->addWidget(backRef, 2, 0);
00120     replaceLayout->addWidget(backRefItem, 2, 1);
00121     topLayout->addWidget(replaceGrp);
00122 
00123     QGroupBox *optionGrp = new QGroupBox(i18n("Options"), page);
00124     optionsLayout = new QGridLayout(optionGrp);
00125 
00126     caseSensitive = new QCheckBox(i18n("C&ase sensitive"), optionGrp);
00127     wholeWordsOnly = new QCheckBox(i18n("&Whole words only"), optionGrp);
00128     fromCursor = new QCheckBox(i18n("From c&ursor"), optionGrp);
00129     findBackwards = new QCheckBox(i18n("Find &backwards"), optionGrp);
00130     selectedText = new QCheckBox(i18n("&Selected text"), optionGrp);
00131     q->setHasSelection( hasSelection );
00132     // If we have a selection, we make 'find in selection' default
00133     // and if we don't, then the option has to be unchecked, obviously.
00134     selectedText->setChecked( hasSelection );
00135     _k_slotSelectedTextToggled( hasSelection );
00136 
00137     promptOnReplace = new QCheckBox(i18n("&Prompt on replace"), optionGrp);
00138     promptOnReplace->setChecked( true );
00139 
00140     optionsLayout->addWidget(caseSensitive, 0, 0);
00141     optionsLayout->addWidget(wholeWordsOnly, 1, 0);
00142     optionsLayout->addWidget(fromCursor, 2, 0);
00143     optionsLayout->addWidget(findBackwards, 0, 1);
00144     optionsLayout->addWidget(selectedText, 1, 1);
00145     optionsLayout->addWidget(promptOnReplace, 2, 1);
00146     topLayout->addWidget(optionGrp);
00147 
00148     // We delay creation of these until needed.
00149     patterns = 0;
00150     placeholders = 0;
00151 
00152     // signals and slots connections
00153     q->connect(selectedText, SIGNAL(toggled(bool)), q, SLOT(_k_slotSelectedTextToggled(bool)));
00154     q->connect(regExp, SIGNAL(toggled(bool)), regExpItem, SLOT(setEnabled(bool)));
00155     q->connect(backRef, SIGNAL(toggled(bool)), backRefItem, SLOT(setEnabled(bool)));
00156     q->connect(regExpItem, SIGNAL(clicked()), q, SLOT(_k_showPatterns()));
00157     q->connect(backRefItem, SIGNAL(clicked()), q, SLOT(_k_showPlaceholders()));
00158 
00159     q->connect(find, SIGNAL(editTextChanged(const QString &)), q, SLOT(_k_textSearchChanged(const QString &)));
00160 
00161     q->connect(regExp, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00162     q->connect(backRef, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00163     q->connect(caseSensitive, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00164     q->connect(wholeWordsOnly, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00165     q->connect(fromCursor, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00166     q->connect(findBackwards, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00167     q->connect(selectedText, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00168     q->connect(promptOnReplace, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
00169 
00170     // tab order
00171     q->setTabOrder(find, regExp);
00172     q->setTabOrder(regExp, regExpItem);
00173     q->setTabOrder(regExpItem, replace); //findExtension widgets are inserted in showEvent()
00174     q->setTabOrder(replace, backRef);
00175     q->setTabOrder(backRef, backRefItem);
00176     q->setTabOrder(backRefItem, caseSensitive);
00177     q->setTabOrder(caseSensitive, wholeWordsOnly);
00178     q->setTabOrder(wholeWordsOnly, fromCursor);
00179     q->setTabOrder(fromCursor, findBackwards);
00180     q->setTabOrder(findBackwards, selectedText);
00181     q->setTabOrder(selectedText, promptOnReplace);
00182 
00183     // buddies
00184     findLabel->setBuddy(find);
00185     replaceLabel->setBuddy(replace);
00186 
00187     if (!forReplace)
00188     {
00189         promptOnReplace->hide();
00190         replaceGrp->hide();
00191     }
00192 
00193     findStrings = _findStrings;
00194     find->setFocus();
00195     q->enableButtonOk( !q->pattern().isEmpty() );
00196     if (forReplace)
00197     {
00198       q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n("&Replace"), QString(),
00199                     i18n("Start replace"),
00200                     i18n("<qt>If you press the <b>Replace</b> button, the text you entered "
00201                          "above is searched for within the document and any occurrence is "
00202                          "replaced with the replacement text.</qt>")));
00203     }
00204     else
00205     {
00206       q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n("&Find"), "edit-find",
00207                     i18n("Start searching"),
00208                     i18n("<qt>If you press the <b>Find</b> button, the text you entered "
00209                          "above is searched for within the document.</qt>")));
00210     }
00211 
00212     // QWhatsthis texts
00213     find->setWhatsThis(i18n(
00214             "Enter a pattern to search for, or select a previous pattern from "
00215             "the list.") );
00216     regExp->setWhatsThis(i18n(
00217             "If enabled, search for a regular expression.") );
00218     regExpItem->setWhatsThis(i18n(
00219             "Click here to edit your regular expression using a graphical editor.") );
00220     replace->setWhatsThis(i18n(
00221             "Enter a replacement string, or select a previous one from the list.") );
00222     backRef->setWhatsThis(i18n(
00223             "<qt>If enabled, any occurrence of <code><b>\\N</b></code>, where "
00224             "<code><b>N</b></code> is an integer number, will be replaced with "
00225             "the corresponding capture (\"parenthesized substring\") from the "
00226             "pattern.<p>To include (a literal <code><b>\\N</b></code> in your "
00227             "replacement, put an extra backslash in front of it, like "
00228             "<code><b>\\\\N</b></code>.</p></qt>") );
00229     backRefItem->setWhatsThis(i18n(
00230             "Click for a menu of available captures.") );
00231     wholeWordsOnly->setWhatsThis(i18n(
00232             "Require word boundaries in both ends of a match to succeed.") );
00233     fromCursor->setWhatsThis(i18n(
00234             "Start searching at the current cursor location rather than at the top.") );
00235     selectedText->setWhatsThis(i18n(
00236             "Only search within the current selection.") );
00237     caseSensitive->setWhatsThis(i18n(
00238             "Perform a case sensitive search: entering the pattern "
00239             "'Joe' will not match 'joe' or 'JOE', only 'Joe'.") );
00240     findBackwards->setWhatsThis(i18n(
00241             "Search backwards.") );
00242     promptOnReplace->setWhatsThis(i18n(
00243             "Ask before replacing each match found.") );
00244 
00245     q->connect(q, SIGNAL(okClicked()), q, SLOT(_k_slotOk()));
00246     _k_textSearchChanged(find->lineEdit()->text());
00247 }
00248 
00249 void KFindDialog::KFindDialogPrivate::_k_textSearchChanged( const QString & text)
00250 {
00251     q->enableButtonOk( !text.isEmpty() );
00252 }
00253 
00254 void KFindDialog::showEvent( QShowEvent *e )
00255 {
00256     if ( !d->initialShowDone )
00257     {
00258         d->initialShowDone = true; // only once
00259         kDebug() << "showEvent\n";
00260         if (!d->findStrings.isEmpty())
00261             setFindHistory(d->findStrings);
00262         d->findStrings = QStringList();
00263         if (!d->pattern.isEmpty()) {
00264             d->find->lineEdit()->setText( d->pattern );
00265             d->find->lineEdit()->selectAll();
00266             d->pattern.clear();
00267         }
00268         //maintain a user-friendly tab order
00269         if (d->findExtension) {
00270             QWidget* prev=d->regExpItem;
00271             foreach(QWidget* child, d->findExtension->findChildren<QWidget*>()) {
00272                 setTabOrder(prev, child);
00273                 prev=child;
00274             }
00275             setTabOrder(prev, d->replace);
00276         }
00277     }
00278     KDialog::showEvent(e);
00279 }
00280 
00281 long KFindDialog::options() const
00282 {
00283     long options = 0;
00284 
00285     if (d->caseSensitive->isChecked())
00286         options |= KFind::CaseSensitive;
00287     if (d->wholeWordsOnly->isChecked())
00288         options |= KFind::WholeWordsOnly;
00289     if (d->fromCursor->isChecked())
00290         options |= KFind::FromCursor;
00291     if (d->findBackwards->isChecked())
00292         options |= KFind::FindBackwards;
00293     if (d->selectedText->isChecked())
00294         options |= KFind::SelectedText;
00295     if (d->regExp->isChecked())
00296         options |= KFind::RegularExpression;
00297     return options;
00298 }
00299 
00300 QString KFindDialog::pattern() const
00301 {
00302     return d->find->currentText();
00303 }
00304 
00305 void KFindDialog::setPattern (const QString &pattern)
00306 {
00307     d->find->lineEdit()->setText( pattern );
00308     d->find->lineEdit()->selectAll();
00309     d->pattern = pattern;
00310     kDebug() << "setPattern " << pattern;
00311 }
00312 
00313 void KFindDialog::setFindHistory(const QStringList &strings)
00314 {
00315     if (strings.count() > 0)
00316     {
00317         d->find->setHistoryItems(strings, true);
00318         d->find->lineEdit()->setText( strings.first() );
00319         d->find->lineEdit()->selectAll();
00320     }
00321     else
00322         d->find->clearHistory();
00323 }
00324 
00325 void KFindDialog::setHasSelection(bool hasSelection)
00326 {
00327     if (hasSelection) d->enabled |= KFind::SelectedText;
00328     else d->enabled &= ~KFind::SelectedText;
00329     d->selectedText->setEnabled( hasSelection );
00330     if ( !hasSelection )
00331     {
00332         d->selectedText->setChecked( false );
00333         d->_k_slotSelectedTextToggled( hasSelection );
00334     }
00335 }
00336 
00337 void KFindDialog::KFindDialogPrivate::_k_slotSelectedTextToggled(bool selec)
00338 {
00339     // From cursor doesn't make sense if we have a selection
00340     fromCursor->setEnabled( !selec && (enabled & KFind::FromCursor) );
00341     if ( selec ) // uncheck if disabled
00342         fromCursor->setChecked( false );
00343 }
00344 
00345 void KFindDialog::setHasCursor(bool hasCursor)
00346 {
00347     if (hasCursor) d->enabled |= KFind::FromCursor;
00348     else d->enabled &= ~KFind::FromCursor;
00349     d->fromCursor->setEnabled( hasCursor );
00350     d->fromCursor->setChecked( hasCursor && (options() & KFind::FromCursor) );
00351 }
00352 
00353 void KFindDialog::setSupportsBackwardsFind( bool supports )
00354 {
00355     // ########## Shouldn't this hide the checkbox instead?
00356     if (supports) d->enabled |= KFind::FindBackwards;
00357     else d->enabled &= ~KFind::FindBackwards;
00358     d->findBackwards->setEnabled( supports );
00359     d->findBackwards->setChecked( supports && (options() & KFind::FindBackwards) );
00360 }
00361 
00362 void KFindDialog::setSupportsCaseSensitiveFind( bool supports )
00363 {
00364     // ########## This should hide the checkbox instead
00365     if (supports) d->enabled |= KFind::CaseSensitive;
00366     else d->enabled &= ~KFind::CaseSensitive;
00367     d->caseSensitive->setEnabled( supports );
00368     d->caseSensitive->setChecked( supports && (options() & KFind::CaseSensitive) );
00369 }
00370 
00371 void KFindDialog::setSupportsWholeWordsFind( bool supports )
00372 {
00373     // ########## This should hide the checkbox instead
00374     if (supports) d->enabled |= KFind::WholeWordsOnly;
00375     else d->enabled &= ~KFind::WholeWordsOnly;
00376     d->wholeWordsOnly->setEnabled( supports );
00377     d->wholeWordsOnly->setChecked( supports && (options() & KFind::WholeWordsOnly) );
00378 }
00379 
00380 void KFindDialog::setSupportsRegularExpressionFind( bool supports )
00381 {
00382     if (supports) d->enabled |= KFind::RegularExpression;
00383     else d->enabled &= ~KFind::RegularExpression;
00384     d->regExp->setEnabled( supports );
00385     d->regExp->setChecked( supports && (options() & KFind::RegularExpression) );
00386     if( !supports)
00387     {
00388        d->regExpItem->hide();
00389        d->regExp->hide();
00390     }
00391     else
00392     {
00393        d->regExpItem->show();
00394        d->regExp->show();
00395     }
00396 }
00397 
00398 void KFindDialog::setOptions(long options)
00399 {
00400     d->caseSensitive->setChecked((d->enabled & KFind::CaseSensitive) && (options & KFind::CaseSensitive));
00401     d->wholeWordsOnly->setChecked((d->enabled & KFind::WholeWordsOnly) && (options & KFind::WholeWordsOnly));
00402     d->fromCursor->setChecked((d->enabled & KFind::FromCursor) && (options & KFind::FromCursor));
00403     d->findBackwards->setChecked((d->enabled & KFind::FindBackwards) && (options & KFind::FindBackwards));
00404     d->selectedText->setChecked((d->enabled & KFind::SelectedText) && (options & KFind::SelectedText));
00405     d->regExp->setChecked((d->enabled & KFind::RegularExpression) && (options & KFind::RegularExpression));
00406 }
00407 
00408 // Create a popup menu with a list of regular expression terms, to help the user
00409 // compose a regular expression search pattern.
00410 void KFindDialog::KFindDialogPrivate::_k_showPatterns()
00411 {
00412     if ( !regexpDialogQueryDone )
00413     {
00414         regexpDialog = KServiceTypeTrader::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor", QString(), q );
00415         regexpDialogQueryDone = true;
00416     }
00417 
00418     if ( regexpDialog )
00419     {
00420         KRegExpEditorInterface *iface = qobject_cast<KRegExpEditorInterface*>( regexpDialog );
00421         assert( iface );
00422 
00423         iface->setRegExp( q->pattern() );
00424         if ( regexpDialog->exec() == QDialog::Accepted )
00425             q->setPattern( iface->regExp() );
00426     }
00427     else // No complete regexp-editor available, bring up the old popupmenu
00428     {
00429         typedef struct
00430         {
00431             const char *description;
00432             const char *regExp;
00433             int cursorAdjustment;
00434         } term;
00435         static const term items[] =
00436             {
00437                 { I18N_NOOP("Any Character"),                 ".",        0 },
00438                 { I18N_NOOP("Start of Line"),                 "^",        0 },
00439                 { I18N_NOOP("End of Line"),                   "$",        0 },
00440                 { I18N_NOOP("Set of Characters"),             "[]",       -1 },
00441                 { I18N_NOOP("Repeats, Zero or More Times"),   "*",        0 },
00442                 { I18N_NOOP("Repeats, One or More Times"),    "+",        0 },
00443                 { I18N_NOOP("Optional"),                      "?",        0 },
00444                 { I18N_NOOP("Escape"),                        "\\",       0 },
00445                 { I18N_NOOP("TAB"),                           "\\t",      0 },
00446                 { I18N_NOOP("Newline"),                       "\\n",      0 },
00447                 { I18N_NOOP("Carriage Return"),               "\\r",      0 },
00448                 { I18N_NOOP("White Space"),                   "\\s",      0 },
00449                 { I18N_NOOP("Digit"),                         "\\d",      0 },
00450             };
00451 
00452 
00453         class RegExpAction : public QAction
00454         {
00455           public:
00456             RegExpAction( QObject *parent, const QString &text, const QString &regExp, int cursor )
00457               : QAction( text, parent ), mText( text ), mRegExp( regExp ), mCursor( cursor )
00458             {
00459             }
00460 
00461             QString text() const { return mText; }
00462             QString regExp() const { return mRegExp; }
00463             int cursor() const { return mCursor; }
00464 
00465           private:
00466             QString mText;
00467             QString mRegExp;
00468             int mCursor;
00469         };
00470 
00471         int i;
00472 
00473         // Populate the popup menu.
00474         if (!patterns)
00475         {
00476             patterns = new QMenu(q);
00477             for (i = 0; (unsigned)i < sizeof(items) / sizeof(items[0]); i++)
00478             {
00479                 patterns->addAction(new RegExpAction(patterns, i18n(items[i].description),
00480                                                      items[i].regExp,
00481                                                      items[i].cursorAdjustment));
00482             }
00483         }
00484 
00485         // Insert the selection into the edit control.
00486         QAction *action = patterns->exec(regExpItem->mapToGlobal(regExpItem->rect().bottomLeft()));
00487         if (action)
00488         {
00489             RegExpAction *regExpAction = static_cast<RegExpAction*>( action );
00490             if ( regExpAction ) {
00491               QLineEdit *editor = find->lineEdit();
00492 
00493               editor->insert(regExpAction->regExp());
00494               editor->setCursorPosition(editor->cursorPosition() + regExpAction->cursor());
00495             }
00496         }
00497     }
00498 }
00499 
00500 class PlaceHolderAction : public QAction
00501 {
00502   public:
00503     PlaceHolderAction( QObject *parent, const QString &text, int id )
00504       : QAction( text, parent ), mText( text ), mId( id )
00505     {
00506     }
00507 
00508     QString text() const { return mText; }
00509     int id() const { return mId; }
00510 
00511   private:
00512     QString mText;
00513     int mId;
00514 };
00515 
00516 // Create a popup menu with a list of backreference terms, to help the user
00517 // compose a regular expression replacement pattern.
00518 void KFindDialog::KFindDialogPrivate::_k_showPlaceholders()
00519 {
00520     // Populate the popup menu.
00521     if (!placeholders)
00522     {
00523         placeholders = new QMenu(q);
00524         q->connect( placeholders, SIGNAL(aboutToShow()), q, SLOT(_k_slotPlaceholdersAboutToShow()) );
00525     }
00526 
00527     // Insert the selection into the edit control.
00528     QAction *action = placeholders->exec(backRefItem->mapToGlobal(backRefItem->rect().bottomLeft()));
00529     if (action)
00530     {
00531         PlaceHolderAction *placeHolderAction = static_cast<PlaceHolderAction*>(action);
00532         if (placeHolderAction) {
00533           QLineEdit *editor = replace->lineEdit();
00534           editor->insert( QString("\\%1").arg( placeHolderAction->id() ) );
00535         }
00536     }
00537 }
00538 
00539 void KFindDialog::KFindDialogPrivate::_k_slotPlaceholdersAboutToShow()
00540 {
00541     placeholders->clear();
00542     placeholders->addAction( new PlaceHolderAction(placeholders, i18n("Complete Match"), 0));
00543 
00544     QRegExp r( q->pattern() );
00545     uint n = r.numCaptures();
00546     for ( uint i=0; i < n; i++ )
00547         placeholders->addAction( new PlaceHolderAction(placeholders, i18n("Captured Text (%1)",  i+1 ), i+1 ) );
00548 }
00549 
00550 void KFindDialog::KFindDialogPrivate::_k_slotOk()
00551 {
00552     // Nothing to find?
00553     if (q->pattern().isEmpty())
00554     {
00555         KMessageBox::error(q, i18n("You must enter some text to search for."));
00556         return;
00557     }
00558 
00559     if (regExp->isChecked())
00560     {
00561         // Check for a valid regular expression.
00562         QRegExp _regExp(q->pattern());
00563 
00564         if (!_regExp.isValid())
00565         {
00566             KMessageBox::error(q, i18n("Invalid regular expression."));
00567             return;
00568         }
00569     }
00570     find->addToHistory(q->pattern());
00571     if ( q->windowModality() != Qt::NonModal )
00572         q->accept();
00573 }
00574 // kate: space-indent on; indent-width 4; replace-tabs on;
00575 #include "kfinddialog.moc"

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal