1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
/* This file is part of the KDE project
Copyright (C) 2004-2007 Jaroslaw Staniek <[email protected]>
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 TDEAction;
//! @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
public:
//! Creates a new find dialog. Replace mode is off by default.
KexiFindDialog(TQWidget* parent);
virtual ~KexiFindDialog();
//! Sets actions that receive button clicks and shortcuts within the dialog. Should be called once.
void setActions( TDEAction *findnext, TDEAction *findprev,
TDEAction *replace, TDEAction *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 replace' 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 find/replace/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
|