kutils Library API Documentation

KFindDialog Class Reference

A generic "find" dialog. More...

#include <kfinddialog.h>

Inheritance diagram for KFindDialog:

Inheritance graph
[legend]
Collaboration diagram for KFindDialog:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Options {
  WholeWordsOnly = 1, FromCursor = 2, SelectedText = 4, CaseSensitive = 8,
  FindBackwards = 16, RegularExpression = 32, MinimumUserOption = 65536
}

Public Member Functions

 KFindDialog (QWidget *parent=0, const char *name=0, long options=0, const QStringList &findStrings=QStringList(), bool hasSelection=false)
 KFindDialog (bool modal, QWidget *parent=0, const char *name=0, long options=0, const QStringList &findStrings=QStringList(), bool hasSelection=false)
virtual ~KFindDialog ()
void setFindHistory (const QStringList &history)
QStringList findHistory () const
void setHasSelection (bool hasSelection)
void setHasCursor (bool hasCursor)
void setOptions (long options)
long options () const
QString pattern () const
void setPattern (const QString &pattern)
QWidgetfindExtension ()

Protected Slots

void slotOk ()
void slotSelectedTextToggled (bool)
void showPatterns ()
void showPlaceholders ()
void textSearchChanged (const QString &)

Protected Member Functions

virtual void showEvent (QShowEvent *)

Friends

class KReplaceDialog

Detailed Description

A generic "find" dialog.

Author:
S.R.Haque <srhaque@iee.org>
Detail:

This widget inherits from KDialogBase and implements the following additional functionalities: a find string object and an area for a user-defined widget to extend the dialog.

Example:

To use the basic modal find dialog, and then run the search:

  KFindDialog dlg(....)
  if ( dlg.exec() != QDialog::Accepted )
      return;

  // proceed with KFind from here

To create a non-modal find dialog:

   if ( m_findDia )
     KWin::setActiveWindow( m_findDia->winId() );
   else
   {
     m_findDia = new KFindDialog(false,...);
     connect( m_findDia, SIGNAL(okClicked()), this, SLOT(findTextNext()) );
   }
Don't forget to delete and reset m_findDia when closed. (But do NOT delete your KFind object at that point, it's needed for "Find Next")

To use your own extensions: see findExtension().

Definition at line 72 of file kfinddialog.h.


Constructor & Destructor Documentation

KFindDialog::KFindDialog QWidget parent = 0,
const char *  name = 0,
long  options = 0,
const QStringList findStrings = QStringList(),
bool  hasSelection = false
 

Construct a modal find dialog.

Parameters:
parent The parent object of this widget.
name The name of this widget.
options A bitfield of the Options to be enabled.
findStrings The find history, see findHistory()
hasSelection Whether a selection exists

Definition at line 54 of file kfinddialog.cpp.

References KStdAccel::name(), and setOptions().

KFindDialog::KFindDialog bool  modal,
QWidget parent = 0,
const char *  name = 0,
long  options = 0,
const QStringList findStrings = QStringList(),
bool  hasSelection = false
 

Construct a non-modal find dialog.

Parameters:
modal set to false to get a non-modal dialog
parent The parent object of this widget.
name The name of this widget.
options A bitfield of the Options to be enabled.
findStrings The find history, see findHistory()
hasSelection Whether a selection exists

Definition at line 64 of file kfinddialog.cpp.

References KStdAccel::name(), and setOptions().

KFindDialog::~KFindDialog  )  [virtual]
 

Destructor.

Definition at line 82 of file kfinddialog.cpp.


Member Function Documentation

void KFindDialog::setFindHistory const QStringList history  ) 
 

Provide the list of strings to be displayed as the history of find strings.

strings might get truncated if it is too long.

Parameters:
history The find history.
See also:
findHistory

Definition at line 298 of file kfinddialog.cpp.

References KHistoryCombo::clearHistory(), QComboBox::lineEdit(), and KHistoryCombo::setHistoryItems().

QStringList KFindDialog::findHistory  )  const
 

Returns the list of history items.

See also:
setFindHistory

Definition at line 98 of file kfinddialog.cpp.

References KHistoryCombo::historyItems().

void KFindDialog::setHasSelection bool  hasSelection  ) 
 

Enable/disable the 'search in selection' option, depending on whether there actually is a selection.

Parameters:
hasSelection true if a selection exists

Definition at line 310 of file kfinddialog.cpp.

References QCheckBox::setChecked().

void KFindDialog::setHasCursor bool  hasCursor  ) 
 

Hide/show the 'from cursor' option, depending on whether the application implements a cursor.

Parameters:
hasCursor true if the application features a cursor This is assumed to be the case by default.

Definition at line 329 of file kfinddialog.cpp.

References options(), and QCheckBox::setChecked().

void KFindDialog::setOptions long  options  ) 
 

Set the options which are enabled.

Parameters:
options The setting of the Options.

Reimplemented in KReplaceDialog.

Definition at line 336 of file kfinddialog.cpp.

References QCheckBox::setChecked().

Referenced by KFindDialog(), and KReplaceDialog::setOptions().

long KFindDialog::options  )  const
 

Returns the state of the options.

Disabled options may be returned in an indeterminate state.

See also:
setOptions

Reimplemented in KReplaceDialog.

Definition at line 266 of file kfinddialog.cpp.

References QCheckBox::isChecked(), and options().

Referenced by KReplaceDialog::options(), options(), and setHasCursor().

QString KFindDialog::pattern  )  const
 

Returns the pattern to find.

Definition at line 285 of file kfinddialog.cpp.

References QComboBox::currentText().

void KFindDialog::setPattern const QString pattern  ) 
 

Sets the pattern to find.

Definition at line 290 of file kfinddialog.cpp.

References endl(), kdDebug(), and QComboBox::lineEdit().

QWidget * KFindDialog::findExtension  ) 
 

Returns an empty widget which the user may fill with additional UI elements as required.

The widget occupies the width of the dialog, and is positioned immediately below the regular expression support widgets for the pattern string.

Definition at line 87 of file kfinddialog.cpp.

References QGridLayout::addMultiCellWidget().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kutils Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 30 05:20:14 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003