author | zautrix <zautrix> | 2005-01-21 16:05:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-21 16:05:23 (UTC) |
commit | 5cbac3131e5cecde6042db12ca73d5cd72fbed77 (patch) (unidiff) | |
tree | 66af1682531c9e144dd6c346cd96851ad5112fb9 | |
parent | 4afdcfcac216b428ada79f4750cf7447e3175333 (diff) | |
download | kdepimpi-5cbac3131e5cecde6042db12ca73d5cd72fbed77.zip kdepimpi-5cbac3131e5cecde6042db12ca73d5cd72fbed77.tar.gz kdepimpi-5cbac3131e5cecde6042db12ca73d5cd72fbed77.tar.bz2 |
remove keyevent from seardialog
-rw-r--r-- | korganizer/searchdialog.cpp | 2 | ||||
-rw-r--r-- | korganizer/searchdialog.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 5bd7c6f..72ee1d2 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -5,391 +5,393 @@ | |||
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qgroupbox.h> | 27 | #include <qgroupbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | 31 | ||
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | #include <kmessagebox.h> | 33 | #include <kmessagebox.h> |
34 | 34 | ||
35 | #include <libkdepim/kdateedit.h> | 35 | #include <libkdepim/kdateedit.h> |
36 | 36 | ||
37 | #include "koglobals.h" | 37 | #include "koglobals.h" |
38 | #include "koprefs.h" | 38 | #include "koprefs.h" |
39 | 39 | ||
40 | #include "calendarview.h" | 40 | #include "calendarview.h" |
41 | #include "koviewmanager.h" | 41 | #include "koviewmanager.h" |
42 | #include "searchdialog.h" | 42 | #include "searchdialog.h" |
43 | 43 | ||
44 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | 44 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) |
45 | : KDialogBase(Plain,i18n("KO/Pi Find "),User1|Close,User1,parent,0,false,false, | 45 | : KDialogBase(Plain,i18n("KO/Pi Find "),User1|Close,User1,parent,0,false,false, |
46 | i18n("&Find")) | 46 | i18n("&Find")) |
47 | { | 47 | { |
48 | mCalendar = calendar; | 48 | mCalendar = calendar; |
49 | QFrame *topFrame = plainPage(); | 49 | QFrame *topFrame = plainPage(); |
50 | QVBoxLayout *layout = new QVBoxLayout(topFrame,0,spacingHint()); | 50 | QVBoxLayout *layout = new QVBoxLayout(topFrame,0,spacingHint()); |
51 | 51 | ||
52 | // Search expression | 52 | // Search expression |
53 | QHBoxLayout *subLayout = new QHBoxLayout(); | 53 | QHBoxLayout *subLayout = new QHBoxLayout(); |
54 | layout->addLayout(subLayout); | 54 | layout->addLayout(subLayout); |
55 | 55 | ||
56 | searchLabel = new QLabel(topFrame); | 56 | searchLabel = new QLabel(topFrame); |
57 | searchLabel->setText(i18n("Search for:")); | 57 | searchLabel->setText(i18n("Search for:")); |
58 | subLayout->addWidget(searchLabel); | 58 | subLayout->addWidget(searchLabel); |
59 | 59 | ||
60 | searchEdit = new QLineEdit(topFrame); | 60 | searchEdit = new QLineEdit(topFrame); |
61 | subLayout->addWidget(searchEdit); | 61 | subLayout->addWidget(searchEdit); |
62 | searchEdit->setText("*"); // Find all events by default | 62 | searchEdit->setText("*"); // Find all events by default |
63 | searchEdit->setFocus(); | 63 | searchEdit->setFocus(); |
64 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 64 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
65 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 65 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
66 | // Subjects to search | 66 | // Subjects to search |
67 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 67 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
68 | // topFrame); | 68 | // topFrame); |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | QHBox *incidenceGroup = new QHBox( topFrame ); | 72 | QHBox *incidenceGroup = new QHBox( topFrame ); |
73 | layout->addWidget(incidenceGroup); | 73 | layout->addWidget(incidenceGroup); |
74 | 74 | ||
75 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 75 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
76 | mSearchEvent->setChecked(true); | 76 | mSearchEvent->setChecked(true); |
77 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 77 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
78 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 78 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
79 | 79 | ||
80 | QHBox *subjectGroup = new QHBox( topFrame ); | 80 | QHBox *subjectGroup = new QHBox( topFrame ); |
81 | layout->addWidget(subjectGroup); | 81 | layout->addWidget(subjectGroup); |
82 | 82 | ||
83 | mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup); | 83 | mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup); |
84 | mSummaryCheck->setChecked(true); | 84 | mSummaryCheck->setChecked(true); |
85 | mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); | 85 | mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); |
86 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 86 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
87 | 87 | ||
88 | QHBox *attendeeGroup = new QHBox( topFrame ); | 88 | QHBox *attendeeGroup = new QHBox( topFrame ); |
89 | layout->addWidget(attendeeGroup ); | 89 | layout->addWidget(attendeeGroup ); |
90 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 90 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
91 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 91 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
92 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 92 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
93 | // Date range | 93 | // Date range |
94 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 94 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
95 | // topFrame); | 95 | // topFrame); |
96 | // layout->addWidget(rangeGroup); | 96 | // layout->addWidget(rangeGroup); |
97 | 97 | ||
98 | QWidget *rangeWidget = new QWidget(topFrame); | 98 | QWidget *rangeWidget = new QWidget(topFrame); |
99 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint()); | 99 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint()); |
100 | 100 | ||
101 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 101 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
102 | mStartDate = new KDateEdit(rangeWidget); | 102 | mStartDate = new KDateEdit(rangeWidget); |
103 | rangeLayout->addWidget(mStartDate); | 103 | rangeLayout->addWidget(mStartDate); |
104 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 104 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
105 | mEndDate = new KDateEdit(rangeWidget); | 105 | mEndDate = new KDateEdit(rangeWidget); |
106 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 106 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
107 | rangeLayout->addWidget(mEndDate); | 107 | rangeLayout->addWidget(mEndDate); |
108 | 108 | ||
109 | // mInclusiveCheck = new QCheckBox(i18n("Events have to be completely included"), topFrame); | 109 | // mInclusiveCheck = new QCheckBox(i18n("Events have to be completely included"), topFrame); |
110 | //mInclusiveCheck->setChecked(false); | 110 | //mInclusiveCheck->setChecked(false); |
111 | layout->addWidget(rangeWidget); | 111 | layout->addWidget(rangeWidget); |
112 | //layout->addWidget(mInclusiveCheck); | 112 | //layout->addWidget(mInclusiveCheck); |
113 | // Subjects to search | 113 | // Subjects to search |
114 | 114 | ||
115 | 115 | ||
116 | // Results list view | 116 | // Results list view |
117 | listView = new KOListView(mCalendar,topFrame); | 117 | listView = new KOListView(mCalendar,topFrame); |
118 | //listView->showDates(); | 118 | //listView->showDates(); |
119 | 119 | ||
120 | 120 | ||
121 | layout->addWidget(listView); | 121 | layout->addWidget(listView); |
122 | 122 | ||
123 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 123 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
124 | // KOGlobals::fitDialogToScreen( this, true ); | 124 | // KOGlobals::fitDialogToScreen( this, true ); |
125 | // } | 125 | // } |
126 | 126 | ||
127 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 127 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
128 | connect(this,SIGNAL(user1Clicked()),SLOT(doSearch())); | 128 | connect(this,SIGNAL(user1Clicked()),SLOT(doSearch())); |
129 | QPushButton *CloseButton = findButton( Close ); | 129 | QPushButton *CloseButton = findButton( Close ); |
130 | //connect(CloseButton,SIGNAL(clicked()),listView, SLOT(clear())); | 130 | //connect(CloseButton,SIGNAL(clicked()),listView, SLOT(clear())); |
131 | 131 | ||
132 | #ifndef DESKTOP_VERSION | 132 | #ifndef DESKTOP_VERSION |
133 | setCaption(i18n("Click OK to search ->")); | 133 | setCaption(i18n("Click OK to search ->")); |
134 | hideButtons(); | 134 | hideButtons(); |
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | 137 | ||
138 | SearchDialog::~SearchDialog() | 138 | SearchDialog::~SearchDialog() |
139 | { | 139 | { |
140 | 140 | ||
141 | } | 141 | } |
142 | void SearchDialog::accept() | 142 | void SearchDialog::accept() |
143 | { | 143 | { |
144 | doSearch(); | 144 | doSearch(); |
145 | } | 145 | } |
146 | void SearchDialog::updateList() | 146 | void SearchDialog::updateList() |
147 | { | 147 | { |
148 | //listView->updateList(); | 148 | //listView->updateList(); |
149 | if ( isVisible() ) { | 149 | if ( isVisible() ) { |
150 | updateView(); | 150 | updateView(); |
151 | //qDebug("SearchDialog::updated "); | 151 | //qDebug("SearchDialog::updated "); |
152 | } | 152 | } |
153 | else { | 153 | else { |
154 | listView->clear(); | 154 | listView->clear(); |
155 | //qDebug("SearchDialog::cleared "); | 155 | //qDebug("SearchDialog::cleared "); |
156 | 156 | ||
157 | } | 157 | } |
158 | } | 158 | } |
159 | void SearchDialog::searchTextChanged( const QString &_text ) | 159 | void SearchDialog::searchTextChanged( const QString &_text ) |
160 | { | 160 | { |
161 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 161 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
162 | } | 162 | } |
163 | 163 | ||
164 | void SearchDialog::doSearch() | 164 | void SearchDialog::doSearch() |
165 | { | 165 | { |
166 | QRegExp re; | 166 | QRegExp re; |
167 | 167 | ||
168 | re.setWildcard(true); // most people understand these better. | 168 | re.setWildcard(true); // most people understand these better. |
169 | re.setCaseSensitive(false); | 169 | re.setCaseSensitive(false); |
170 | re.setPattern(searchEdit->text()); | 170 | re.setPattern(searchEdit->text()); |
171 | if (!re.isValid() ) { | 171 | if (!re.isValid() ) { |
172 | KMessageBox::sorry(this, | 172 | KMessageBox::sorry(this, |
173 | i18n("Invalid search expression,\ncannot perform " | 173 | i18n("Invalid search expression,\ncannot perform " |
174 | "the search.\nPlease enter a search expression\n" | 174 | "the search.\nPlease enter a search expression\n" |
175 | "using the wildcard characters\n '*' and '?'" | 175 | "using the wildcard characters\n '*' and '?'" |
176 | "where needed.")); | 176 | "where needed.")); |
177 | return; | 177 | return; |
178 | } | 178 | } |
179 | 179 | ||
180 | search(re); | 180 | search(re); |
181 | 181 | ||
182 | listView->setStartDate( mStartDate->date() ); | 182 | listView->setStartDate( mStartDate->date() ); |
183 | listView->showEvents(mMatchedEvents); | 183 | listView->showEvents(mMatchedEvents); |
184 | listView->addTodos(mMatchedTodos); | 184 | listView->addTodos(mMatchedTodos); |
185 | listView->addJournals(mMatchedJournals); | 185 | listView->addJournals(mMatchedJournals); |
186 | 186 | ||
187 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 187 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
188 | KMessageBox::information(this, | 188 | KMessageBox::information(this, |
189 | i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed.")); | 189 | i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed.")); |
190 | #ifndef DESKTOP_VERSION | 190 | #ifndef DESKTOP_VERSION |
191 | setCaption(i18n("Click OK to search ->")); | 191 | setCaption(i18n("Click OK to search ->")); |
192 | #else | 192 | #else |
193 | setCaption(i18n("KO/Pi Find ")); | 193 | setCaption(i18n("KO/Pi Find ")); |
194 | #endif | 194 | #endif |
195 | } else { | 195 | } else { |
196 | QString mess; | 196 | QString mess; |
197 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 197 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
198 | setCaption( i18n("KO/Pi Find: ") + mess); | 198 | setCaption( i18n("KO/Pi Find: ") + mess); |
199 | 199 | ||
200 | } | 200 | } |
201 | } | 201 | } |
202 | void SearchDialog::updateConfig() | 202 | void SearchDialog::updateConfig() |
203 | { | 203 | { |
204 | listView->updateConfig(); | 204 | listView->updateConfig(); |
205 | } | 205 | } |
206 | void SearchDialog::updateView() | 206 | void SearchDialog::updateView() |
207 | { | 207 | { |
208 | 208 | ||
209 | QRegExp re; | 209 | QRegExp re; |
210 | re.setWildcard(true); // most people understand these better. | 210 | re.setWildcard(true); // most people understand these better. |
211 | re.setCaseSensitive(false); | 211 | re.setCaseSensitive(false); |
212 | re.setPattern(searchEdit->text()); | 212 | re.setPattern(searchEdit->text()); |
213 | if (re.isValid()) { | 213 | if (re.isValid()) { |
214 | search(re); | 214 | search(re); |
215 | } else { | 215 | } else { |
216 | mMatchedEvents.clear(); | 216 | mMatchedEvents.clear(); |
217 | mMatchedTodos.clear(); | 217 | mMatchedTodos.clear(); |
218 | mMatchedJournals.clear(); | 218 | mMatchedJournals.clear(); |
219 | } | 219 | } |
220 | listView->setStartDate( mStartDate->date() ); | 220 | listView->setStartDate( mStartDate->date() ); |
221 | listView->showEvents(mMatchedEvents); | 221 | listView->showEvents(mMatchedEvents); |
222 | listView->addTodos(mMatchedTodos); | 222 | listView->addTodos(mMatchedTodos); |
223 | listView->addJournals(mMatchedJournals); | 223 | listView->addJournals(mMatchedJournals); |
224 | } | 224 | } |
225 | 225 | ||
226 | void SearchDialog::search(const QRegExp &re) | 226 | void SearchDialog::search(const QRegExp &re) |
227 | { | 227 | { |
228 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 228 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
229 | mEndDate->date(), | 229 | mEndDate->date(), |
230 | false /*mInclusiveCheck->isChecked()*/ ); | 230 | false /*mInclusiveCheck->isChecked()*/ ); |
231 | 231 | ||
232 | mMatchedEvents.clear(); | 232 | mMatchedEvents.clear(); |
233 | if ( mSearchEvent->isChecked() ) { | 233 | if ( mSearchEvent->isChecked() ) { |
234 | Event *ev; | 234 | Event *ev; |
235 | for(ev=events.first();ev;ev=events.next()) { | 235 | for(ev=events.first();ev;ev=events.next()) { |
236 | if (mSummaryCheck->isChecked()) { | 236 | if (mSummaryCheck->isChecked()) { |
237 | #if QT_VERSION >= 300 | 237 | #if QT_VERSION >= 300 |
238 | if (re.search(ev->summary()) != -1) | 238 | if (re.search(ev->summary()) != -1) |
239 | #else | 239 | #else |
240 | if (re.match(ev->summary()) != -1) | 240 | if (re.match(ev->summary()) != -1) |
241 | #endif | 241 | #endif |
242 | { | 242 | { |
243 | mMatchedEvents.append(ev); | 243 | mMatchedEvents.append(ev); |
244 | continue; | 244 | continue; |
245 | } | 245 | } |
246 | } | 246 | } |
247 | if (mDescriptionCheck->isChecked()) { | 247 | if (mDescriptionCheck->isChecked()) { |
248 | #if QT_VERSION >= 300 | 248 | #if QT_VERSION >= 300 |
249 | if (re.search(ev->description()) != -1) | 249 | if (re.search(ev->description()) != -1) |
250 | #else | 250 | #else |
251 | if (re.match(ev->description()) != -1) | 251 | if (re.match(ev->description()) != -1) |
252 | #endif | 252 | #endif |
253 | { | 253 | { |
254 | mMatchedEvents.append(ev); | 254 | mMatchedEvents.append(ev); |
255 | continue; | 255 | continue; |
256 | } | 256 | } |
257 | } | 257 | } |
258 | if (mCategoryCheck->isChecked()) { | 258 | if (mCategoryCheck->isChecked()) { |
259 | #if QT_VERSION >= 300 | 259 | #if QT_VERSION >= 300 |
260 | if (re.search(ev->categoriesStr()) != -1) | 260 | if (re.search(ev->categoriesStr()) != -1) |
261 | #else | 261 | #else |
262 | if (re.match(ev->categoriesStr()) != -1) | 262 | if (re.match(ev->categoriesStr()) != -1) |
263 | #endif | 263 | #endif |
264 | { | 264 | { |
265 | mMatchedEvents.append(ev); | 265 | mMatchedEvents.append(ev); |
266 | continue; | 266 | continue; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 269 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
270 | QPtrList<Attendee> tmpAList = ev->attendees(); | 270 | QPtrList<Attendee> tmpAList = ev->attendees(); |
271 | Attendee *a; | 271 | Attendee *a; |
272 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 272 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
273 | if (mSearchAName->isChecked()) { | 273 | if (mSearchAName->isChecked()) { |
274 | #if QT_VERSION >= 300 | 274 | #if QT_VERSION >= 300 |
275 | if (re.search(a->name()) != -1) | 275 | if (re.search(a->name()) != -1) |
276 | #else | 276 | #else |
277 | if (re.match(a->name()) != -1) | 277 | if (re.match(a->name()) != -1) |
278 | #endif | 278 | #endif |
279 | { | 279 | { |
280 | mMatchedEvents.append(ev); | 280 | mMatchedEvents.append(ev); |
281 | break; | 281 | break; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | if (mSearchAEmail->isChecked()) { | 284 | if (mSearchAEmail->isChecked()) { |
285 | #if QT_VERSION >= 300 | 285 | #if QT_VERSION >= 300 |
286 | if (re.search(a->email()) != -1) | 286 | if (re.search(a->email()) != -1) |
287 | #else | 287 | #else |
288 | if (re.match(a->email()) != -1) | 288 | if (re.match(a->email()) != -1) |
289 | #endif | 289 | #endif |
290 | { | 290 | { |
291 | mMatchedEvents.append(ev); | 291 | mMatchedEvents.append(ev); |
292 | break; | 292 | break; |
293 | } | 293 | } |
294 | } | 294 | } |
295 | } | 295 | } |
296 | } | 296 | } |
297 | } | 297 | } |
298 | } | 298 | } |
299 | QPtrList<Todo> todos = mCalendar->todos( ); | 299 | QPtrList<Todo> todos = mCalendar->todos( ); |
300 | mMatchedTodos.clear(); | 300 | mMatchedTodos.clear(); |
301 | if ( mSearchTodo->isChecked() ) { | 301 | if ( mSearchTodo->isChecked() ) { |
302 | Todo *tod; | 302 | Todo *tod; |
303 | for(tod=todos.first();tod;tod=todos.next()) { | 303 | for(tod=todos.first();tod;tod=todos.next()) { |
304 | if (mSummaryCheck->isChecked()) { | 304 | if (mSummaryCheck->isChecked()) { |
305 | #if QT_VERSION >= 300 | 305 | #if QT_VERSION >= 300 |
306 | if (re.search(tod->summary()) != -1) | 306 | if (re.search(tod->summary()) != -1) |
307 | #else | 307 | #else |
308 | if (re.match(tod->summary()) != -1) | 308 | if (re.match(tod->summary()) != -1) |
309 | #endif | 309 | #endif |
310 | { | 310 | { |
311 | mMatchedTodos.append(tod); | 311 | mMatchedTodos.append(tod); |
312 | continue; | 312 | continue; |
313 | } | 313 | } |
314 | } | 314 | } |
315 | if (mDescriptionCheck->isChecked()) { | 315 | if (mDescriptionCheck->isChecked()) { |
316 | #if QT_VERSION >= 300 | 316 | #if QT_VERSION >= 300 |
317 | if (re.search(tod->description()) != -1) | 317 | if (re.search(tod->description()) != -1) |
318 | #else | 318 | #else |
319 | if (re.match(tod->description()) != -1) | 319 | if (re.match(tod->description()) != -1) |
320 | #endif | 320 | #endif |
321 | { | 321 | { |
322 | mMatchedTodos.append(tod); | 322 | mMatchedTodos.append(tod); |
323 | continue; | 323 | continue; |
324 | } | 324 | } |
325 | } | 325 | } |
326 | if (mCategoryCheck->isChecked()) { | 326 | if (mCategoryCheck->isChecked()) { |
327 | #if QT_VERSION >= 300 | 327 | #if QT_VERSION >= 300 |
328 | if (re.search(tod->categoriesStr()) != -1) | 328 | if (re.search(tod->categoriesStr()) != -1) |
329 | #else | 329 | #else |
330 | if (re.match(tod->categoriesStr()) != -1) | 330 | if (re.match(tod->categoriesStr()) != -1) |
331 | #endif | 331 | #endif |
332 | { | 332 | { |
333 | mMatchedTodos.append(tod); | 333 | mMatchedTodos.append(tod); |
334 | continue; | 334 | continue; |
335 | } | 335 | } |
336 | } | 336 | } |
337 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 337 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
338 | QPtrList<Attendee> tmpAList = tod->attendees(); | 338 | QPtrList<Attendee> tmpAList = tod->attendees(); |
339 | Attendee *a; | 339 | Attendee *a; |
340 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 340 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
341 | if (mSearchAName->isChecked()) { | 341 | if (mSearchAName->isChecked()) { |
342 | #if QT_VERSION >= 300 | 342 | #if QT_VERSION >= 300 |
343 | if (re.search(a->name()) != -1) | 343 | if (re.search(a->name()) != -1) |
344 | #else | 344 | #else |
345 | if (re.match(a->name()) != -1) | 345 | if (re.match(a->name()) != -1) |
346 | #endif | 346 | #endif |
347 | { | 347 | { |
348 | mMatchedTodos.append(tod); | 348 | mMatchedTodos.append(tod); |
349 | break; | 349 | break; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | if (mSearchAEmail->isChecked()) { | 352 | if (mSearchAEmail->isChecked()) { |
353 | #if QT_VERSION >= 300 | 353 | #if QT_VERSION >= 300 |
354 | if (re.search(a->email()) != -1) | 354 | if (re.search(a->email()) != -1) |
355 | #else | 355 | #else |
356 | if (re.match(a->email()) != -1) | 356 | if (re.match(a->email()) != -1) |
357 | #endif | 357 | #endif |
358 | { | 358 | { |
359 | mMatchedTodos.append(tod); | 359 | mMatchedTodos.append(tod); |
360 | break; | 360 | break; |
361 | } | 361 | } |
362 | } | 362 | } |
363 | } | 363 | } |
364 | } | 364 | } |
365 | } | 365 | } |
366 | } | 366 | } |
367 | mMatchedJournals.clear(); | 367 | mMatchedJournals.clear(); |
368 | if (mSearchJournal->isChecked() ) { | 368 | if (mSearchJournal->isChecked() ) { |
369 | QPtrList<Journal> journals = mCalendar->journals( ); | 369 | QPtrList<Journal> journals = mCalendar->journals( ); |
370 | Journal* journ; | 370 | Journal* journ; |
371 | 371 | ||
372 | for(journ=journals.first();journ;journ=journals.next()) { | 372 | for(journ=journals.first();journ;journ=journals.next()) { |
373 | if ( journ->dtStart().date() <= mEndDate->date() | 373 | if ( journ->dtStart().date() <= mEndDate->date() |
374 | &&journ->dtStart().date() >= mStartDate->date()) { | 374 | &&journ->dtStart().date() >= mStartDate->date()) { |
375 | #if QT_VERSION >= 300 | 375 | #if QT_VERSION >= 300 |
376 | if (re.search(journ->description()) != -1) | 376 | if (re.search(journ->description()) != -1) |
377 | #else | 377 | #else |
378 | if (re.match(journ->description()) != -1) | 378 | if (re.match(journ->description()) != -1) |
379 | #endif | 379 | #endif |
380 | { | 380 | { |
381 | mMatchedJournals.append(journ); | 381 | mMatchedJournals.append(journ); |
382 | continue; | 382 | continue; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | } | 388 | } |
389 | /* | ||
389 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 390 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
390 | { | 391 | { |
391 | 392 | ||
392 | e->ignore(); | 393 | e->ignore(); |
393 | 394 | ||
394 | } | 395 | } |
396 | */ | ||
395 | //mMatchedJournals; | 397 | //mMatchedJournals; |
diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h index a03c586..ebcff7a 100644 --- a/korganizer/searchdialog.h +++ b/korganizer/searchdialog.h | |||
@@ -1,93 +1,93 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef SEARCHDIALOG_H | 24 | #ifndef SEARCHDIALOG_H |
25 | #define SEARCHDIALOG_H | 25 | #define SEARCHDIALOG_H |
26 | 26 | ||
27 | #include <qregexp.h> | 27 | #include <qregexp.h> |
28 | 28 | ||
29 | #include <kdialogbase.h> | 29 | #include <kdialogbase.h> |
30 | 30 | ||
31 | #include <libkcal/calendar.h> | 31 | #include <libkcal/calendar.h> |
32 | 32 | ||
33 | #include "kolistview.h" | 33 | #include "kolistview.h" |
34 | 34 | ||
35 | class KDateEdit; | 35 | class KDateEdit; |
36 | class QCheckBox; | 36 | class QCheckBox; |
37 | class QLineEdit; | 37 | class QLineEdit; |
38 | class QLabel; | 38 | class QLabel; |
39 | class CalendarView; | 39 | class CalendarView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | class SearchDialog : public KDialogBase | 43 | class SearchDialog : public KDialogBase |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | SearchDialog(Calendar *calendar,CalendarView *parent=0); | 47 | SearchDialog(Calendar *calendar,CalendarView *parent=0); |
48 | virtual ~SearchDialog(); | 48 | virtual ~SearchDialog(); |
49 | KOListView *listview(){ return listView;} | 49 | KOListView *listview(){ return listView;} |
50 | void updateView(); | 50 | void updateView(); |
51 | 51 | ||
52 | public slots: | 52 | public slots: |
53 | void changeEventDisplay(Event *, int) { updateView(); } | 53 | void changeEventDisplay(Event *, int) { updateView(); } |
54 | void updateConfig(); | 54 | void updateConfig(); |
55 | void updateList(); | 55 | void updateList(); |
56 | protected slots: | 56 | protected slots: |
57 | void accept(); | 57 | void accept(); |
58 | void doSearch(); | 58 | void doSearch(); |
59 | void searchTextChanged( const QString &_text ); | 59 | void searchTextChanged( const QString &_text ); |
60 | 60 | ||
61 | signals: | 61 | signals: |
62 | void showEventSignal(Event *); | 62 | void showEventSignal(Event *); |
63 | void editEventSignal(Event *); | 63 | void editEventSignal(Event *); |
64 | void deleteEventSignal(Event *); | 64 | void deleteEventSignal(Event *); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | void search(const QRegExp &); | 67 | void search(const QRegExp &); |
68 | 68 | ||
69 | Calendar *mCalendar; | 69 | Calendar *mCalendar; |
70 | 70 | ||
71 | QPtrList<Event> mMatchedEvents; | 71 | QPtrList<Event> mMatchedEvents; |
72 | QPtrList<Todo> mMatchedTodos; | 72 | QPtrList<Todo> mMatchedTodos; |
73 | QPtrList<Journal> mMatchedJournals; | 73 | QPtrList<Journal> mMatchedJournals; |
74 | 74 | ||
75 | QLabel *searchLabel; | 75 | QLabel *searchLabel; |
76 | QLineEdit *searchEdit; | 76 | QLineEdit *searchEdit; |
77 | KOListView *listView; | 77 | KOListView *listView; |
78 | 78 | ||
79 | KDateEdit *mStartDate; | 79 | KDateEdit *mStartDate; |
80 | KDateEdit *mEndDate; | 80 | KDateEdit *mEndDate; |
81 | // QCheckBox *mInclusiveCheck; | 81 | // QCheckBox *mInclusiveCheck; |
82 | QCheckBox *mSummaryCheck; | 82 | QCheckBox *mSummaryCheck; |
83 | QCheckBox *mDescriptionCheck; | 83 | QCheckBox *mDescriptionCheck; |
84 | QCheckBox *mCategoryCheck; | 84 | QCheckBox *mCategoryCheck; |
85 | QCheckBox *mSearchEvent; | 85 | QCheckBox *mSearchEvent; |
86 | QCheckBox *mSearchTodo; | 86 | QCheckBox *mSearchTodo; |
87 | QCheckBox *mSearchJournal; | 87 | QCheckBox *mSearchJournal; |
88 | QCheckBox *mSearchAName; | 88 | QCheckBox *mSearchAName; |
89 | QCheckBox *mSearchAEmail; | 89 | QCheckBox *mSearchAEmail; |
90 | void keyPressEvent ( QKeyEvent *e) ; | 90 | //void keyPressEvent ( QKeyEvent *e) ; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #endif | 93 | #endif |