-rw-r--r-- | korganizer/searchdialog.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 3a95978..3fd9740 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -1,397 +1,401 @@ | |||
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 | 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("Summary/Loc."),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 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
189 | i18n("No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.")); | ||
190 | #ifndef DESKTOP_VERSION | ||
191 | setCaption(i18n("Click OK to search ->")); | ||
192 | #else | ||
193 | setCaption(i18n("KO/Pi Find ")); | ||
194 | #endif | ||
195 | } else { | 189 | } else { |
196 | QString mess; | 190 | QString mess; |
197 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 191 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
198 | setCaption( i18n("KO/Pi Find: ") + mess); | 192 | setCaption( i18n("KO/Pi Find: ") + mess); |
199 | 193 | ||
200 | } | 194 | } |
195 | searchEdit->setFocus(); | ||
201 | } | 196 | } |
202 | void SearchDialog::updateConfig() | 197 | void SearchDialog::updateConfig() |
203 | { | 198 | { |
204 | listView->updateConfig(); | 199 | listView->updateConfig(); |
205 | } | 200 | } |
206 | void SearchDialog::updateView() | 201 | void SearchDialog::updateView() |
207 | { | 202 | { |
208 | 203 | ||
209 | QRegExp re; | 204 | QRegExp re; |
210 | re.setWildcard(true); // most people understand these better. | 205 | re.setWildcard(true); // most people understand these better. |
211 | re.setCaseSensitive(false); | 206 | re.setCaseSensitive(false); |
212 | re.setPattern(searchEdit->text()); | 207 | re.setPattern(searchEdit->text()); |
213 | if (re.isValid()) { | 208 | if (re.isValid()) { |
214 | search(re); | 209 | search(re); |
215 | } else { | 210 | } else { |
216 | mMatchedEvents.clear(); | 211 | mMatchedEvents.clear(); |
217 | mMatchedTodos.clear(); | 212 | mMatchedTodos.clear(); |
218 | mMatchedJournals.clear(); | 213 | mMatchedJournals.clear(); |
219 | } | 214 | } |
220 | listView->setStartDate( mStartDate->date() ); | 215 | listView->setStartDate( mStartDate->date() ); |
221 | listView->showEvents(mMatchedEvents); | 216 | listView->showEvents(mMatchedEvents); |
222 | listView->addTodos(mMatchedTodos); | 217 | listView->addTodos(mMatchedTodos); |
223 | listView->addJournals(mMatchedJournals); | 218 | listView->addJournals(mMatchedJournals); |
224 | } | 219 | } |
225 | 220 | ||
226 | void SearchDialog::search(const QRegExp &re) | 221 | void SearchDialog::search(const QRegExp &re) |
227 | { | 222 | { |
228 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 223 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
229 | mEndDate->date(), | 224 | mEndDate->date(), |
230 | false /*mInclusiveCheck->isChecked()*/ ); | 225 | false /*mInclusiveCheck->isChecked()*/ ); |
231 | 226 | ||
232 | mMatchedEvents.clear(); | 227 | mMatchedEvents.clear(); |
233 | if ( mSearchEvent->isChecked() ) { | 228 | if ( mSearchEvent->isChecked() ) { |
234 | Event *ev; | 229 | Event *ev; |
235 | for(ev=events.first();ev;ev=events.next()) { | 230 | for(ev=events.first();ev;ev=events.next()) { |
236 | if (mSummaryCheck->isChecked()) { | 231 | if (mSummaryCheck->isChecked()) { |
237 | #if QT_VERSION >= 0x030000 | 232 | #if QT_VERSION >= 0x030000 |
238 | if (re.search(ev->summary()) != -1) | 233 | if (re.search(ev->summary()) != -1) |
239 | #else | 234 | #else |
240 | if (re.match(ev->summary()) != -1) | 235 | if (re.match(ev->summary()) != -1) |
241 | #endif | 236 | #endif |
242 | { | 237 | { |
243 | mMatchedEvents.append(ev); | 238 | mMatchedEvents.append(ev); |
244 | continue; | 239 | continue; |
245 | } | 240 | } |
241 | #if QT_VERSION >= 0x030000 | ||
242 | if (re.search(ev->location()) != -1) | ||
243 | #else | ||
244 | if (re.match(ev->location()) != -1) | ||
245 | #endif | ||
246 | { | ||
247 | mMatchedEvents.append(ev); | ||
248 | continue; | ||
249 | } | ||
246 | } | 250 | } |
247 | if (mDescriptionCheck->isChecked()) { | 251 | if (mDescriptionCheck->isChecked()) { |
248 | #if QT_VERSION >= 0x030000 | 252 | #if QT_VERSION >= 0x030000 |
249 | if (re.search(ev->description()) != -1) | 253 | if (re.search(ev->description()) != -1) |
250 | #else | 254 | #else |
251 | if (re.match(ev->description()) != -1) | 255 | if (re.match(ev->description()) != -1) |
252 | #endif | 256 | #endif |
253 | { | 257 | { |
254 | mMatchedEvents.append(ev); | 258 | mMatchedEvents.append(ev); |
255 | continue; | 259 | continue; |
256 | } | 260 | } |
257 | } | 261 | } |
258 | if (mCategoryCheck->isChecked()) { | 262 | if (mCategoryCheck->isChecked()) { |
259 | #if QT_VERSION >= 0x030000 | 263 | #if QT_VERSION >= 0x030000 |
260 | if (re.search(ev->categoriesStr()) != -1) | 264 | if (re.search(ev->categoriesStr()) != -1) |
261 | #else | 265 | #else |
262 | if (re.match(ev->categoriesStr()) != -1) | 266 | if (re.match(ev->categoriesStr()) != -1) |
263 | #endif | 267 | #endif |
264 | { | 268 | { |
265 | mMatchedEvents.append(ev); | 269 | mMatchedEvents.append(ev); |
266 | continue; | 270 | continue; |
267 | } | 271 | } |
268 | } | 272 | } |
269 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 273 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
270 | QPtrList<Attendee> tmpAList = ev->attendees(); | 274 | QPtrList<Attendee> tmpAList = ev->attendees(); |
271 | Attendee *a; | 275 | Attendee *a; |
272 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 276 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
273 | if (mSearchAName->isChecked()) { | 277 | if (mSearchAName->isChecked()) { |
274 | #if QT_VERSION >= 0x030000 | 278 | #if QT_VERSION >= 0x030000 |
275 | if (re.search(a->name()) != -1) | 279 | if (re.search(a->name()) != -1) |
276 | #else | 280 | #else |
277 | if (re.match(a->name()) != -1) | 281 | if (re.match(a->name()) != -1) |
278 | #endif | 282 | #endif |
279 | { | 283 | { |
280 | mMatchedEvents.append(ev); | 284 | mMatchedEvents.append(ev); |
281 | break; | 285 | break; |
282 | } | 286 | } |
283 | } | 287 | } |
284 | if (mSearchAEmail->isChecked()) { | 288 | if (mSearchAEmail->isChecked()) { |
285 | #if QT_VERSION >= 0x030000 | 289 | #if QT_VERSION >= 0x030000 |
286 | if (re.search(a->email()) != -1) | 290 | if (re.search(a->email()) != -1) |
287 | #else | 291 | #else |
288 | if (re.match(a->email()) != -1) | 292 | if (re.match(a->email()) != -1) |
289 | #endif | 293 | #endif |
290 | { | 294 | { |
291 | mMatchedEvents.append(ev); | 295 | mMatchedEvents.append(ev); |
292 | break; | 296 | break; |
293 | } | 297 | } |
294 | } | 298 | } |
295 | } | 299 | } |
296 | } | 300 | } |
297 | } | 301 | } |
298 | } | 302 | } |
299 | QPtrList<Todo> todos = mCalendar->todos( ); | 303 | QPtrList<Todo> todos = mCalendar->todos( ); |
300 | mMatchedTodos.clear(); | 304 | mMatchedTodos.clear(); |
301 | if ( mSearchTodo->isChecked() ) { | 305 | if ( mSearchTodo->isChecked() ) { |
302 | Todo *tod; | 306 | Todo *tod; |
303 | for(tod=todos.first();tod;tod=todos.next()) { | 307 | for(tod=todos.first();tod;tod=todos.next()) { |
304 | if (mSummaryCheck->isChecked()) { | 308 | if (mSummaryCheck->isChecked()) { |
305 | #if QT_VERSION >= 0x030000 | 309 | #if QT_VERSION >= 0x030000 |
306 | if (re.search(tod->summary()) != -1) | 310 | if (re.search(tod->summary()) != -1) |
307 | #else | 311 | #else |
308 | if (re.match(tod->summary()) != -1) | 312 | if (re.match(tod->summary()) != -1) |
309 | #endif | 313 | #endif |
310 | { | 314 | { |
311 | mMatchedTodos.append(tod); | 315 | mMatchedTodos.append(tod); |
312 | continue; | 316 | continue; |
313 | } | 317 | } |
314 | } | 318 | } |
315 | if (mDescriptionCheck->isChecked()) { | 319 | if (mDescriptionCheck->isChecked()) { |
316 | #if QT_VERSION >= 0x030000 | 320 | #if QT_VERSION >= 0x030000 |
317 | if (re.search(tod->description()) != -1) | 321 | if (re.search(tod->description()) != -1) |
318 | #else | 322 | #else |
319 | if (re.match(tod->description()) != -1) | 323 | if (re.match(tod->description()) != -1) |
320 | #endif | 324 | #endif |
321 | { | 325 | { |
322 | mMatchedTodos.append(tod); | 326 | mMatchedTodos.append(tod); |
323 | continue; | 327 | continue; |
324 | } | 328 | } |
325 | } | 329 | } |
326 | if (mCategoryCheck->isChecked()) { | 330 | if (mCategoryCheck->isChecked()) { |
327 | #if QT_VERSION >= 0x030000 | 331 | #if QT_VERSION >= 0x030000 |
328 | if (re.search(tod->categoriesStr()) != -1) | 332 | if (re.search(tod->categoriesStr()) != -1) |
329 | #else | 333 | #else |
330 | if (re.match(tod->categoriesStr()) != -1) | 334 | if (re.match(tod->categoriesStr()) != -1) |
331 | #endif | 335 | #endif |
332 | { | 336 | { |
333 | mMatchedTodos.append(tod); | 337 | mMatchedTodos.append(tod); |
334 | continue; | 338 | continue; |
335 | } | 339 | } |
336 | } | 340 | } |
337 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 341 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
338 | QPtrList<Attendee> tmpAList = tod->attendees(); | 342 | QPtrList<Attendee> tmpAList = tod->attendees(); |
339 | Attendee *a; | 343 | Attendee *a; |
340 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 344 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
341 | if (mSearchAName->isChecked()) { | 345 | if (mSearchAName->isChecked()) { |
342 | #if QT_VERSION >= 0x030000 | 346 | #if QT_VERSION >= 0x030000 |
343 | if (re.search(a->name()) != -1) | 347 | if (re.search(a->name()) != -1) |
344 | #else | 348 | #else |
345 | if (re.match(a->name()) != -1) | 349 | if (re.match(a->name()) != -1) |
346 | #endif | 350 | #endif |
347 | { | 351 | { |
348 | mMatchedTodos.append(tod); | 352 | mMatchedTodos.append(tod); |
349 | break; | 353 | break; |
350 | } | 354 | } |
351 | } | 355 | } |
352 | if (mSearchAEmail->isChecked()) { | 356 | if (mSearchAEmail->isChecked()) { |
353 | #if QT_VERSION >= 0x030000 | 357 | #if QT_VERSION >= 0x030000 |
354 | if (re.search(a->email()) != -1) | 358 | if (re.search(a->email()) != -1) |
355 | #else | 359 | #else |
356 | if (re.match(a->email()) != -1) | 360 | if (re.match(a->email()) != -1) |
357 | #endif | 361 | #endif |
358 | { | 362 | { |
359 | mMatchedTodos.append(tod); | 363 | mMatchedTodos.append(tod); |
360 | break; | 364 | break; |
361 | } | 365 | } |
362 | } | 366 | } |
363 | } | 367 | } |
364 | } | 368 | } |
365 | } | 369 | } |
366 | } | 370 | } |
367 | mMatchedJournals.clear(); | 371 | mMatchedJournals.clear(); |
368 | if (mSearchJournal->isChecked() ) { | 372 | if (mSearchJournal->isChecked() ) { |
369 | QPtrList<Journal> journals = mCalendar->journals( ); | 373 | QPtrList<Journal> journals = mCalendar->journals( ); |
370 | Journal* journ; | 374 | Journal* journ; |
371 | 375 | ||
372 | for(journ=journals.first();journ;journ=journals.next()) { | 376 | for(journ=journals.first();journ;journ=journals.next()) { |
373 | if ( journ->dtStart().date() <= mEndDate->date() | 377 | if ( journ->dtStart().date() <= mEndDate->date() |
374 | &&journ->dtStart().date() >= mStartDate->date()) { | 378 | &&journ->dtStart().date() >= mStartDate->date()) { |
375 | #if QT_VERSION >= 0x030000 | 379 | #if QT_VERSION >= 0x030000 |
376 | if (re.search(journ->description()) != -1) | 380 | if (re.search(journ->description()) != -1) |
377 | #else | 381 | #else |
378 | if (re.match(journ->description()) != -1) | 382 | if (re.match(journ->description()) != -1) |
379 | #endif | 383 | #endif |
380 | { | 384 | { |
381 | mMatchedJournals.append(journ); | 385 | mMatchedJournals.append(journ); |
382 | continue; | 386 | continue; |
383 | } | 387 | } |
384 | } | 388 | } |
385 | } | 389 | } |
386 | } | 390 | } |
387 | 391 | ||
388 | } | 392 | } |
389 | /* | 393 | /* |
390 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 394 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
391 | { | 395 | { |
392 | 396 | ||
393 | e->ignore(); | 397 | e->ignore(); |
394 | 398 | ||
395 | } | 399 | } |
396 | */ | 400 | */ |
397 | //mMatchedJournals; | 401 | //mMatchedJournals; |