-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 | |||
@@ -71,25 +71,25 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | |||
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); |
@@ -176,37 +176,32 @@ void SearchDialog::doSearch() | |||
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()); |
@@ -234,24 +229,33 @@ void SearchDialog::search(const QRegExp &re) | |||
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 | } |