|
|
|
/* This file is part of the KDE project
|
|
|
|
Copyright (C) 2004-2007 Jaroslaw Staniek <js@iidea.pl>
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public License
|
|
|
|
along with this library; see the file COPYING.LIB. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEXIFINDDIALOG_H
|
|
|
|
#define KEXIFINDDIALOG_H
|
|
|
|
|
|
|
|
#include "kexifinddialogbase.h"
|
|
|
|
#include <core/kexisearchandreplaceiface.h>
|
|
|
|
|
|
|
|
class KAction;
|
|
|
|
|
|
|
|
//! @short A Kexi-specific "Find text" dialog.
|
|
|
|
/*! Also used for as replace dialog.
|
|
|
|
|
|
|
|
@todo replace m_textToFind and m_textToReplace KComboBoxes with Kexi's db-aware comboboxes,
|
|
|
|
so we ca adapt to datatype being searched, e.g. date, time and numbers
|
|
|
|
*/
|
|
|
|
class KexiFindDialog : public KexiFindDialogBase
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
|
|
//! Creates a new find dialog. Replace mode is off by default.
|
|
|
|
KexiFindDialog(TQWidget* tqparent);
|
|
|
|
virtual ~KexiFindDialog();
|
|
|
|
|
|
|
|
//! Sets actions that receive button clicks and shortcuts within the dialog. Should be called once.
|
|
|
|
void setActions( KAction *findnext, KAction *findprev,
|
|
|
|
KAction *tqreplace, KAction *replaceall );
|
|
|
|
|
|
|
|
//! Shows the dialog as a modal dialog.
|
|
|
|
virtual void show();
|
|
|
|
|
|
|
|
//! \return current find and replace options set within the dialog
|
|
|
|
//! @todo should we have setOptions() too?
|
|
|
|
KexiSearchAndReplaceViewInterface::Options options() const;
|
|
|
|
|
|
|
|
/*! \return a list of column names for 'look in column' combo box.
|
|
|
|
Neither "(All fields)" nor "(Current field)" items are prepended. */
|
|
|
|
TQStringList lookInColumnNames() const;
|
|
|
|
|
|
|
|
/*! \return a list of column captions (i.e. visible values) for 'look in column' combo box.
|
|
|
|
Neither "(All fields)" nor "(Current field)" items are prepended. */
|
|
|
|
TQStringList lookInColumnCaptions() const;
|
|
|
|
|
|
|
|
/*! \return column name selected in "look in column" combo box.
|
|
|
|
If "(All fields)" item is selected, empty string is returned.
|
|
|
|
If "(Current field)" item is selected, "(field)" string is returned. */
|
|
|
|
TQString currentLookInColumnName() const;
|
|
|
|
|
|
|
|
//! \return value that to be used for searching
|
|
|
|
TQVariant valueToFind() const;
|
|
|
|
|
|
|
|
//! \return value that to be used as a replacement
|
|
|
|
TQVariant valueToReplaceWith() const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
/*! Sets \a columnNames list and \a columnCaptions for 'look in column' combo box.
|
|
|
|
\a columnCaptions are visible values, while \a columnNames are used for returning
|
|
|
|
in currentLookInColumn().
|
|
|
|
"(All fields)" and "(Current field)" items are also prepended. */
|
|
|
|
void setLookInColumnList(const TQStringList& columnNames,
|
|
|
|
const TQStringList& columnCaptions);
|
|
|
|
|
|
|
|
/*! Selects \a columnName to be selected 'look in column'.
|
|
|
|
By default "(All fields)" item is selected. To select this item,
|
|
|
|
pass empty string as \a columnName.
|
|
|
|
To select "(Current field)" item, "(field)" string should be passed
|
|
|
|
as \a columnName. */
|
|
|
|
void setCurrentLookInColumnName(const TQString& columnName);
|
|
|
|
|
|
|
|
/*! Sets or clears replace mode.
|
|
|
|
For replace mode 'prompt or tqreplace' option is visible. */
|
|
|
|
void setReplaceMode(bool set);
|
|
|
|
|
|
|
|
/*! Sets object name for caption, so for example it will be set
|
|
|
|
to i18n("Find \"Persons\"")). */
|
|
|
|
void setObjectNameForCaption(const TQString& name);
|
|
|
|
|
|
|
|
/*! Enables of disables the tqfind/tqreplace/replace all buttons.
|
|
|
|
This is used if for the current context the dialog could not be used.
|
|
|
|
If \a enable is false, object name for caption is cleared
|
|
|
|
using setObjectNameForCaption() too. */
|
|
|
|
void setButtonsEnabled(bool enable);
|
|
|
|
|
|
|
|
/*! Sets message at the bottom to \a message. */
|
|
|
|
void setMessage(const TQString& message);
|
|
|
|
|
|
|
|
/*! Updates message at the bottom; "The search item was not found" is set if \a found is true,
|
|
|
|
else the message is cleared. */
|
|
|
|
//! @todo add "Search again" hyperlink
|
|
|
|
void updateMessage( bool found = true );
|
|
|
|
|
|
|
|
signals:
|
|
|
|
//! Emitted after clicking "Find next" button or pressing appropriate shortcut set by setActions()
|
|
|
|
void findNext();
|
|
|
|
|
|
|
|
//! Emitted after pressing appropriate shortcut set by setActions()
|
|
|
|
void findPrevious();
|
|
|
|
|
|
|
|
//! Emitted after clicking "Replace" button or pressing appropriate shortcut set by setActions()
|
|
|
|
void replaceNext();
|
|
|
|
|
|
|
|
//! Emitted after clicking "Replace All" button or pressing appropriate shortcut set by setActions()
|
|
|
|
void replaceAll();
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void slotCloseClicked();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
class Private;
|
|
|
|
Private * const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|