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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • findreplace
kfinddialog.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
3  Copyright (C) 2002, David Faure <david@mandrakesoft.com>
4  This file is part of the KDE project
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2, as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "kfinddialog.h"
22 #include "kfinddialog_p.h"
23 
24 #include <QtGui/QCheckBox>
25 #include <QtGui/QCursor>
26 #include <QtGui/QGroupBox>
27 #include <QtGui/QLabel>
28 #include <QtGui/QLayout>
29 #include <QtGui/QLineEdit>
30 #include <QtGui/QMenu>
31 #include <QtGui/QPushButton>
32 #include <QtCore/QRegExp>
33 #include <kcombobox.h>
34 #include <khistorycombobox.h>
35 #include <kdebug.h>
36 #include <klocale.h>
37 #include <kmessagebox.h>
38 #include <assert.h>
39 #include <kfind.h>
40 #include <kregexpeditorinterface.h>
41 #include <kservicetypetrader.h>
42 
43 KFindDialog::KFindDialog(QWidget *parent, long options, const QStringList &findStrings, bool hasSelection, bool replaceDialog)
44  : KDialog(parent),
45  d(new KFindDialogPrivate(this))
46 {
47  setCaption( i18n("Find Text") );
48  setButtons( Ok | Cancel );
49  setDefaultButton( Ok );
50 
51  d->init(replaceDialog, findStrings, hasSelection);
52  setOptions(options);
53  setButtonGuiItem( KDialog::Cancel, KStandardGuiItem::close() );
54 }
55 
56 KFindDialog::~KFindDialog()
57 {
58  delete d;
59 }
60 
61 QWidget *KFindDialog::findExtension() const
62 {
63  if (!d->findExtension)
64  {
65  d->findExtension = new QWidget(d->findGrp);
66  d->findLayout->addWidget(d->findExtension, 3, 0, 1, 2);
67  }
68 
69  return d->findExtension;
70 }
71 
72 QStringList KFindDialog::findHistory() const
73 {
74  return d->find->historyItems();
75 }
76 
77 void KFindDialog::KFindDialogPrivate::init(bool forReplace, const QStringList &_findStrings, bool hasSelection)
78 {
79  QVBoxLayout *topLayout;
80  QGridLayout *optionsLayout;
81 
82  // Create common parts of dialog.
83  QWidget *page = new QWidget(q);
84  q->setMainWidget(page);
85 
86  topLayout = new QVBoxLayout(page);
87  topLayout->setMargin( 0 );
88 
89  findGrp = new QGroupBox(i18nc("@title:group", "Find"), page);
90  findLayout = new QGridLayout(findGrp);
91 
92  QLabel *findLabel = new QLabel(i18n("&Text to find:"), findGrp);
93  find = new KHistoryComboBox(findGrp);
94  find->setMaxCount(10);
95  find->setDuplicatesEnabled(false);
96  regExp = new QCheckBox(i18n("Regular e&xpression"), findGrp);
97  regExpItem = new QPushButton(i18n("&Edit..."), findGrp);
98  regExpItem->setEnabled(false);
99 
100  findLayout->addWidget(findLabel, 0, 0);
101  findLayout->addWidget(find, 1, 0, 1, 2);
102  findLayout->addWidget(regExp, 2, 0);
103  findLayout->addWidget(regExpItem, 2, 1);
104  topLayout->addWidget(findGrp);
105 
106  replaceGrp = new QGroupBox( i18n("Replace With"), page);
107  replaceLayout = new QGridLayout(replaceGrp);
108 
109  QLabel *replaceLabel = new QLabel(i18n("Replace&ment text:"), replaceGrp);
110  replace = new KHistoryComboBox(replaceGrp);
111  replace->setMaxCount(10);
112  replace->setDuplicatesEnabled(false);
113  backRef = new QCheckBox(i18n("Use p&laceholders"), replaceGrp);
114  backRefItem = new QPushButton(i18n("Insert Place&holder"), replaceGrp);
115  backRefItem->setEnabled(false);
116 
117  replaceLayout->addWidget(replaceLabel, 0, 0);
118  replaceLayout->addWidget(replace, 1, 0, 1, 2);
119  replaceLayout->addWidget(backRef, 2, 0);
120  replaceLayout->addWidget(backRefItem, 2, 1);
121  topLayout->addWidget(replaceGrp);
122 
123  QGroupBox *optionGrp = new QGroupBox(i18n("Options"), page);
124  optionsLayout = new QGridLayout(optionGrp);
125 
126  caseSensitive = new QCheckBox(i18n("C&ase sensitive"), optionGrp);
127  wholeWordsOnly = new QCheckBox(i18n("&Whole words only"), optionGrp);
128  fromCursor = new QCheckBox(i18n("From c&ursor"), optionGrp);
129  findBackwards = new QCheckBox(i18n("Find &backwards"), optionGrp);
130  selectedText = new QCheckBox(i18n("&Selected text"), optionGrp);
131  q->setHasSelection( hasSelection );
132  // If we have a selection, we make 'find in selection' default
133  // and if we don't, then the option has to be unchecked, obviously.
134  selectedText->setChecked( hasSelection );
135  _k_slotSelectedTextToggled( hasSelection );
136 
137  promptOnReplace = new QCheckBox(i18n("&Prompt on replace"), optionGrp);
138  promptOnReplace->setChecked( true );
139 
140  optionsLayout->addWidget(caseSensitive, 0, 0);
141  optionsLayout->addWidget(wholeWordsOnly, 1, 0);
142  optionsLayout->addWidget(fromCursor, 2, 0);
143  optionsLayout->addWidget(findBackwards, 0, 1);
144  optionsLayout->addWidget(selectedText, 1, 1);
145  optionsLayout->addWidget(promptOnReplace, 2, 1);
146  topLayout->addWidget(optionGrp);
147 
148  // We delay creation of these until needed.
149  patterns = 0;
150  placeholders = 0;
151 
152  // signals and slots connections
153  q->connect(selectedText, SIGNAL(toggled(bool)), q, SLOT(_k_slotSelectedTextToggled(bool)));
154  q->connect(regExp, SIGNAL(toggled(bool)), regExpItem, SLOT(setEnabled(bool)));
155  q->connect(backRef, SIGNAL(toggled(bool)), backRefItem, SLOT(setEnabled(bool)));
156  q->connect(regExpItem, SIGNAL(clicked()), q, SLOT(_k_showPatterns()));
157  q->connect(backRefItem, SIGNAL(clicked()), q, SLOT(_k_showPlaceholders()));
158 
159  q->connect(find, SIGNAL(editTextChanged(QString)), q, SLOT(_k_textSearchChanged(QString)));
160 
161  q->connect(regExp, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
162  q->connect(backRef, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
163  q->connect(caseSensitive, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
164  q->connect(wholeWordsOnly, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
165  q->connect(fromCursor, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
166  q->connect(findBackwards, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
167  q->connect(selectedText, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
168  q->connect(promptOnReplace, SIGNAL(toggled(bool)), q, SIGNAL(optionsChanged()));
169 
170  // tab order
171  q->setTabOrder(find, regExp);
172  q->setTabOrder(regExp, regExpItem);
173  q->setTabOrder(regExpItem, replace); //findExtension widgets are inserted in showEvent()
174  q->setTabOrder(replace, backRef);
175  q->setTabOrder(backRef, backRefItem);
176  q->setTabOrder(backRefItem, caseSensitive);
177  q->setTabOrder(caseSensitive, wholeWordsOnly);
178  q->setTabOrder(wholeWordsOnly, fromCursor);
179  q->setTabOrder(fromCursor, findBackwards);
180  q->setTabOrder(findBackwards, selectedText);
181  q->setTabOrder(selectedText, promptOnReplace);
182 
183  // buddies
184  findLabel->setBuddy(find);
185  replaceLabel->setBuddy(replace);
186 
187  if (!forReplace)
188  {
189  promptOnReplace->hide();
190  replaceGrp->hide();
191  }
192 
193  findStrings = _findStrings;
194  find->setFocus();
195  q->enableButtonOk( !q->pattern().isEmpty() );
196  if (forReplace)
197  {
198  q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n("&Replace"), QString(),
199  i18n("Start replace"),
200  i18n("<qt>If you press the <b>Replace</b> button, the text you entered "
201  "above is searched for within the document and any occurrence is "
202  "replaced with the replacement text.</qt>")));
203  }
204  else
205  {
206  q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n("&Find"), "edit-find",
207  i18n("Start searching"),
208  i18n("<qt>If you press the <b>Find</b> button, the text you entered "
209  "above is searched for within the document.</qt>")));
210  }
211 
212  // QWhatsthis texts
213  find->setWhatsThis(i18n(
214  "Enter a pattern to search for, or select a previous pattern from "
215  "the list.") );
216  regExp->setWhatsThis(i18n(
217  "If enabled, search for a regular expression.") );
218  regExpItem->setWhatsThis(i18n(
219  "Click here to edit your regular expression using a graphical editor.") );
220  replace->setWhatsThis(i18n(
221  "Enter a replacement string, or select a previous one from the list.") );
222  backRef->setWhatsThis(i18n(
223  "<qt>If enabled, any occurrence of <code><b>\\N</b></code>, where "
224  "<code><b>N</b></code> is an integer number, will be replaced with "
225  "the corresponding capture (\"parenthesized substring\") from the "
226  "pattern.<p>To include (a literal <code><b>\\N</b></code> in your "
227  "replacement, put an extra backslash in front of it, like "
228  "<code><b>\\\\N</b></code>.</p></qt>") );
229  backRefItem->setWhatsThis(i18n(
230  "Click for a menu of available captures.") );
231  wholeWordsOnly->setWhatsThis(i18n(
232  "Require word boundaries in both ends of a match to succeed.") );
233  fromCursor->setWhatsThis(i18n(
234  "Start searching at the current cursor location rather than at the top.") );
235  selectedText->setWhatsThis(i18n(
236  "Only search within the current selection.") );
237  caseSensitive->setWhatsThis(i18n(
238  "Perform a case sensitive search: entering the pattern "
239  "'Joe' will not match 'joe' or 'JOE', only 'Joe'.") );
240  findBackwards->setWhatsThis(i18n(
241  "Search backwards.") );
242  promptOnReplace->setWhatsThis(i18n(
243  "Ask before replacing each match found.") );
244 
245  q->connect(q, SIGNAL(okClicked()), q, SLOT(_k_slotOk()));
246  _k_textSearchChanged(find->lineEdit()->text());
247 }
248 
249 void KFindDialog::KFindDialogPrivate::_k_textSearchChanged( const QString & text)
250 {
251  q->enableButtonOk( !text.isEmpty() );
252 }
253 
254 void KFindDialog::showEvent( QShowEvent *e )
255 {
256  if ( !d->initialShowDone )
257  {
258  d->initialShowDone = true; // only once
259  kDebug() << "showEvent\n";
260  if (!d->findStrings.isEmpty())
261  setFindHistory(d->findStrings);
262  d->findStrings = QStringList();
263  if (!d->pattern.isEmpty()) {
264  d->find->lineEdit()->setText( d->pattern );
265  d->find->lineEdit()->selectAll();
266  d->pattern.clear();
267  }
268  //maintain a user-friendly tab order
269  if (d->findExtension) {
270  QWidget* prev=d->regExpItem;
271  foreach(QWidget* child, d->findExtension->findChildren<QWidget*>()) {
272  setTabOrder(prev, child);
273  prev=child;
274  }
275  setTabOrder(prev, d->replace);
276  }
277  }
278  KDialog::showEvent(e);
279 }
280 
281 long KFindDialog::options() const
282 {
283  long options = 0;
284 
285  if (d->caseSensitive->isChecked())
286  options |= KFind::CaseSensitive;
287  if (d->wholeWordsOnly->isChecked())
288  options |= KFind::WholeWordsOnly;
289  if (d->fromCursor->isChecked())
290  options |= KFind::FromCursor;
291  if (d->findBackwards->isChecked())
292  options |= KFind::FindBackwards;
293  if (d->selectedText->isChecked())
294  options |= KFind::SelectedText;
295  if (d->regExp->isChecked())
296  options |= KFind::RegularExpression;
297  return options;
298 }
299 
300 QString KFindDialog::pattern() const
301 {
302  return d->find->currentText();
303 }
304 
305 void KFindDialog::setPattern (const QString &pattern)
306 {
307  d->find->lineEdit()->setText( pattern );
308  d->find->lineEdit()->selectAll();
309  d->pattern = pattern;
310  kDebug() << "setPattern " << pattern;
311 }
312 
313 void KFindDialog::setFindHistory(const QStringList &strings)
314 {
315  if (strings.count() > 0)
316  {
317  d->find->setHistoryItems(strings, true);
318  d->find->lineEdit()->setText( strings.first() );
319  d->find->lineEdit()->selectAll();
320  }
321  else
322  d->find->clearHistory();
323 }
324 
325 void KFindDialog::setHasSelection(bool hasSelection)
326 {
327  if (hasSelection) d->enabled |= KFind::SelectedText;
328  else d->enabled &= ~KFind::SelectedText;
329  d->selectedText->setEnabled( hasSelection );
330  if ( !hasSelection )
331  {
332  d->selectedText->setChecked( false );
333  d->_k_slotSelectedTextToggled( hasSelection );
334  }
335 }
336 
337 void KFindDialog::KFindDialogPrivate::_k_slotSelectedTextToggled(bool selec)
338 {
339  // From cursor doesn't make sense if we have a selection
340  fromCursor->setEnabled( !selec && (enabled & KFind::FromCursor) );
341  if ( selec ) // uncheck if disabled
342  fromCursor->setChecked( false );
343 }
344 
345 void KFindDialog::setHasCursor(bool hasCursor)
346 {
347  if (hasCursor) d->enabled |= KFind::FromCursor;
348  else d->enabled &= ~KFind::FromCursor;
349  d->fromCursor->setEnabled( hasCursor );
350  d->fromCursor->setChecked( hasCursor && (options() & KFind::FromCursor) );
351 }
352 
353 void KFindDialog::setSupportsBackwardsFind( bool supports )
354 {
355  // ########## Shouldn't this hide the checkbox instead?
356  if (supports) d->enabled |= KFind::FindBackwards;
357  else d->enabled &= ~KFind::FindBackwards;
358  d->findBackwards->setEnabled( supports );
359  d->findBackwards->setChecked( supports && (options() & KFind::FindBackwards) );
360 }
361 
362 void KFindDialog::setSupportsCaseSensitiveFind( bool supports )
363 {
364  // ########## This should hide the checkbox instead
365  if (supports) d->enabled |= KFind::CaseSensitive;
366  else d->enabled &= ~KFind::CaseSensitive;
367  d->caseSensitive->setEnabled( supports );
368  d->caseSensitive->setChecked( supports && (options() & KFind::CaseSensitive) );
369 }
370 
371 void KFindDialog::setSupportsWholeWordsFind( bool supports )
372 {
373  // ########## This should hide the checkbox instead
374  if (supports) d->enabled |= KFind::WholeWordsOnly;
375  else d->enabled &= ~KFind::WholeWordsOnly;
376  d->wholeWordsOnly->setEnabled( supports );
377  d->wholeWordsOnly->setChecked( supports && (options() & KFind::WholeWordsOnly) );
378 }
379 
380 void KFindDialog::setSupportsRegularExpressionFind( bool supports )
381 {
382  if (supports) d->enabled |= KFind::RegularExpression;
383  else d->enabled &= ~KFind::RegularExpression;
384  d->regExp->setEnabled( supports );
385  d->regExp->setChecked( supports && (options() & KFind::RegularExpression) );
386  if( !supports)
387  {
388  d->regExpItem->hide();
389  d->regExp->hide();
390  }
391  else
392  {
393  d->regExpItem->show();
394  d->regExp->show();
395  }
396 }
397 
398 void KFindDialog::setOptions(long options)
399 {
400  d->caseSensitive->setChecked((d->enabled & KFind::CaseSensitive) && (options & KFind::CaseSensitive));
401  d->wholeWordsOnly->setChecked((d->enabled & KFind::WholeWordsOnly) && (options & KFind::WholeWordsOnly));
402  d->fromCursor->setChecked((d->enabled & KFind::FromCursor) && (options & KFind::FromCursor));
403  d->findBackwards->setChecked((d->enabled & KFind::FindBackwards) && (options & KFind::FindBackwards));
404  d->selectedText->setChecked((d->enabled & KFind::SelectedText) && (options & KFind::SelectedText));
405  d->regExp->setChecked((d->enabled & KFind::RegularExpression) && (options & KFind::RegularExpression));
406 }
407 
408 // Create a popup menu with a list of regular expression terms, to help the user
409 // compose a regular expression search pattern.
410 void KFindDialog::KFindDialogPrivate::_k_showPatterns()
411 {
412  if ( !regexpDialogQueryDone )
413  {
414  regexpDialog = KServiceTypeTrader::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor", QString(), q );
415  regexpDialogQueryDone = true;
416  }
417 
418  if ( regexpDialog )
419  {
420  KRegExpEditorInterface *iface = qobject_cast<KRegExpEditorInterface*>( regexpDialog );
421  assert( iface );
422 
423  iface->setRegExp( q->pattern() );
424  if ( regexpDialog->exec() == QDialog::Accepted )
425  q->setPattern( iface->regExp() );
426  }
427  else // No complete regexp-editor available, bring up the old popupmenu
428  {
429  typedef struct
430  {
431  const char *description;
432  const char *regExp;
433  int cursorAdjustment;
434  } term;
435  static const term items[] =
436  {
437  { I18N_NOOP("Any Character"), ".", 0 },
438  { I18N_NOOP("Start of Line"), "^", 0 },
439  { I18N_NOOP("End of Line"), "$", 0 },
440  { I18N_NOOP("Set of Characters"), "[]", -1 },
441  { I18N_NOOP("Repeats, Zero or More Times"), "*", 0 },
442  { I18N_NOOP("Repeats, One or More Times"), "+", 0 },
443  { I18N_NOOP("Optional"), "?", 0 },
444  { I18N_NOOP("Escape"), "\\", 0 },
445  { I18N_NOOP("TAB"), "\\t", 0 },
446  { I18N_NOOP("Newline"), "\\n", 0 },
447  { I18N_NOOP("Carriage Return"), "\\r", 0 },
448  { I18N_NOOP("White Space"), "\\s", 0 },
449  { I18N_NOOP("Digit"), "\\d", 0 },
450  };
451 
452 
453  class RegExpAction : public QAction
454  {
455  public:
456  RegExpAction( QObject *parent, const QString &text, const QString &regExp, int cursor )
457  : QAction( text, parent ), mText( text ), mRegExp( regExp ), mCursor( cursor )
458  {
459  }
460 
461  QString text() const { return mText; }
462  QString regExp() const { return mRegExp; }
463  int cursor() const { return mCursor; }
464 
465  private:
466  QString mText;
467  QString mRegExp;
468  int mCursor;
469  };
470 
471  int i;
472 
473  // Populate the popup menu.
474  if (!patterns)
475  {
476  patterns = new QMenu(q);
477  for (i = 0; (unsigned)i < sizeof(items) / sizeof(items[0]); i++)
478  {
479  patterns->addAction(new RegExpAction(patterns, i18n(items[i].description),
480  items[i].regExp,
481  items[i].cursorAdjustment));
482  }
483  }
484 
485  // Insert the selection into the edit control.
486  QAction *action = patterns->exec(regExpItem->mapToGlobal(regExpItem->rect().bottomLeft()));
487  if (action)
488  {
489  RegExpAction *regExpAction = static_cast<RegExpAction*>( action );
490  if ( regExpAction ) {
491  QLineEdit *editor = find->lineEdit();
492 
493  editor->insert(regExpAction->regExp());
494  editor->setCursorPosition(editor->cursorPosition() + regExpAction->cursor());
495  }
496  }
497  }
498 }
499 
500 class PlaceHolderAction : public QAction
501 {
502  public:
503  PlaceHolderAction( QObject *parent, const QString &text, int id )
504  : QAction( text, parent ), mText( text ), mId( id )
505  {
506  }
507 
508  QString text() const { return mText; }
509  int id() const { return mId; }
510 
511  private:
512  QString mText;
513  int mId;
514 };
515 
516 // Create a popup menu with a list of backreference terms, to help the user
517 // compose a regular expression replacement pattern.
518 void KFindDialog::KFindDialogPrivate::_k_showPlaceholders()
519 {
520  // Populate the popup menu.
521  if (!placeholders)
522  {
523  placeholders = new QMenu(q);
524  q->connect( placeholders, SIGNAL(aboutToShow()), q, SLOT(_k_slotPlaceholdersAboutToShow()) );
525  }
526 
527  // Insert the selection into the edit control.
528  QAction *action = placeholders->exec(backRefItem->mapToGlobal(backRefItem->rect().bottomLeft()));
529  if (action)
530  {
531  PlaceHolderAction *placeHolderAction = static_cast<PlaceHolderAction*>(action);
532  if (placeHolderAction) {
533  QLineEdit *editor = replace->lineEdit();
534  editor->insert( QString("\\%1").arg( placeHolderAction->id() ) );
535  }
536  }
537 }
538 
539 void KFindDialog::KFindDialogPrivate::_k_slotPlaceholdersAboutToShow()
540 {
541  placeholders->clear();
542  placeholders->addAction( new PlaceHolderAction(placeholders, i18n("Complete Match"), 0));
543 
544  QRegExp r( q->pattern() );
545  uint n = r.numCaptures();
546  for ( uint i=0; i < n; i++ )
547  placeholders->addAction( new PlaceHolderAction(placeholders, i18n("Captured Text (%1)", i+1 ), i+1 ) );
548 }
549 
550 void KFindDialog::KFindDialogPrivate::_k_slotOk()
551 {
552  // Nothing to find?
553  if (q->pattern().isEmpty())
554  {
555  KMessageBox::error(q, i18n("You must enter some text to search for."));
556  return;
557  }
558 
559  if (regExp->isChecked())
560  {
561  // Check for a valid regular expression.
562  QRegExp _regExp(q->pattern());
563 
564  if (!_regExp.isValid())
565  {
566  KMessageBox::error(q, i18n("Invalid regular expression."));
567  return;
568  }
569  }
570  find->addToHistory(q->pattern());
571  if ( q->windowModality() != Qt::NonModal )
572  q->accept();
573 }
574 // kate: space-indent on; indent-width 4; replace-tabs on;
575 #include "kfinddialog.moc"
i18n
QString i18n(const char *text)
KFindDialog::setPattern
void setPattern(const QString &pattern)
Sets the pattern to find.
Definition: kfinddialog.cpp:305
KDialog::setButtonGuiItem
void setButtonGuiItem(ButtonCode id, const KGuiItem &item)
Sets the KGuiItem directly for the button instead of using 3 methods to set the text, tooltip and whatsthis strings.
Definition: kdialog.cpp:699
kcombobox.h
KFindDialog::setHasCursor
void setHasCursor(bool hasCursor)
Hide/show the 'from cursor' option, depending on whether the application implements a cursor...
Definition: kfinddialog.cpp:345
kdebug.h
KDialog::Cancel
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected) ...
Definition: kdialog.h:144
KFindDialog::setSupportsRegularExpressionFind
void setSupportsRegularExpressionFind(bool supports)
Enable/disable the 'Regular expression' option, depending on whether the application supports it...
Definition: kfinddialog.cpp:380
QWidget
QPushButton
KFind::WholeWordsOnly
Match whole words only.
Definition: kfind.h:111
KStandardAction::find
KAction * find(const QObject *recvr, const char *slot, QObject *parent)
Initiate a 'find' request in the current document.
Definition: kstandardaction.cpp:329
KFindDialog::KFindDialog
KFindDialog(QWidget *parent=0, long options=0, const QStringList &findStrings=QStringList(), bool hasSelection=false, bool replaceDialog=false)
Construct a modal find dialog.
Definition: kfinddialog.cpp:43
KDialog
A dialog base class with standard buttons and predefined layouts.
Definition: kdialog.h:128
QString
KFindDialog::setSupportsWholeWordsFind
void setSupportsWholeWordsFind(bool supports)
Enable/disable the 'Whole words only' option, depending on whether the application supports it...
Definition: kfinddialog.cpp:371
I18N_NOOP
#define I18N_NOOP(x)
QObject
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
klocale.h
kfind.h
KDialog::setCaption
virtual void setCaption(const QString &caption)
Make a KDE compliant caption.
Definition: kdialog.cpp:469
KFindDialog::options
long options() const
Returns the state of the options.
Definition: kfinddialog.cpp:281
KFind::RegularExpression
Interpret the pattern as a regular expression.
Definition: kfind.h:116
i18nc
QString i18nc(const char *ctxt, const char *text)
KFindDialog::pattern
QString pattern() const
Returns the pattern to find.
Definition: kfinddialog.cpp:300
KHistoryComboBox
A combobox for offering a history and completion.
Definition: khistorycombobox.h:48
kservicetypetrader.h
KFind::FromCursor
Start from current cursor position.
Definition: kfind.h:112
KFindDialog::setFindHistory
void setFindHistory(const QStringList &history)
Provide the list of strings to be displayed as the history of find strings.
Definition: kfinddialog.cpp:313
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:36
QStringList
QGroupBox
khistorycombobox.h
KDialog::setButtons
void setButtons(ButtonCodes buttonMask)
Creates (or recreates) the button box and all the buttons in it.
Definition: kdialog.cpp:206
KFindDialog::showEvent
virtual void showEvent(QShowEvent *)
Definition: kfinddialog.cpp:254
KFindDialog::findExtension
QWidget * findExtension() const
Returns an empty widget which the user may fill with additional UI elements as required.
Definition: kfinddialog.cpp:61
KDialog::Ok
Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted) ...
Definition: kdialog.h:141
KFind
A generic implementation of the "find" function.
Definition: kfind.h:101
KDialog::setDefaultButton
void setDefaultButton(ButtonCode id)
Sets the button that will be activated when the Enter key is pressed.
Definition: kdialog.cpp:287
KFindDialog::~KFindDialog
virtual ~KFindDialog()
Destructor.
Definition: kfinddialog.cpp:56
KFindDialog::setSupportsBackwardsFind
void setSupportsBackwardsFind(bool supports)
Enable/disable the 'Find backwards' option, depending on whether the application supports it...
Definition: kfinddialog.cpp:353
KStandardGuiItem::close
KGuiItem close()
Returns the 'Close' gui item.
Definition: kstandardguiitem.cpp:182
KFind::SelectedText
Only search selected area.
Definition: kfind.h:113
QMenu
KStandardAction::replace
KAction * replace(const QObject *recvr, const char *slot, QObject *parent)
Find and replace matches.
Definition: kstandardaction.cpp:344
KFindDialog::setOptions
void setOptions(long options)
Set the options which are checked.
Definition: kfinddialog.cpp:398
KFind::FindBackwards
Go backwards.
Definition: kfind.h:115
QLabel
KFindDialog::setHasSelection
void setHasSelection(bool hasSelection)
Enable/disable the 'search in selection' option, depending on whether there actually is a selection...
Definition: kfinddialog.cpp:325
QLineEdit
KFind::CaseSensitive
Consider case when matching.
Definition: kfind.h:114
KFindDialog::setSupportsCaseSensitiveFind
void setSupportsCaseSensitiveFind(bool supports)
Enable/disable the 'Case sensitive' option, depending on whether the application supports it...
Definition: kfinddialog.cpp:362
KFindDialog::findHistory
QStringList findHistory() const
Returns the list of history items.
Definition: kfinddialog.cpp:72
kfinddialog.h
kmessagebox.h
QAction
KMessageBox::error
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
Display an "Error" dialog.
Definition: kmessagebox.cpp:818
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal