-rw-r--r-- | korganizer/searchdialog.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 2e32ac2..9cfdc35 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -209,96 +209,100 @@ void SearchDialog::raiseAndSelect() | |||
209 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 209 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
210 | newState = VIEW_J_VIEW; | 210 | newState = VIEW_J_VIEW; |
211 | } | 211 | } |
212 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 212 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
213 | newState = VIEW_T_VIEW; | 213 | newState = VIEW_T_VIEW; |
214 | } | 214 | } |
215 | else { | 215 | else { |
216 | newState = VIEW_A_VIEW; | 216 | newState = VIEW_A_VIEW; |
217 | } | 217 | } |
218 | if ( newState != currentState ) { | 218 | if ( newState != currentState ) { |
219 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 219 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
220 | if ( ! mSearchJournal->isChecked() ) { | 220 | if ( ! mSearchJournal->isChecked() ) { |
221 | mSearchJournal->setChecked( true ); | 221 | mSearchJournal->setChecked( true ); |
222 | mSearchTodo->setChecked( false ); | 222 | mSearchTodo->setChecked( false ); |
223 | mSearchEvent->setChecked( false ); | 223 | mSearchEvent->setChecked( false ); |
224 | mSummaryCheck->setChecked( true ); | 224 | mSummaryCheck->setChecked( true ); |
225 | mDescriptionCheck->setChecked( true ); | 225 | mDescriptionCheck->setChecked( true ); |
226 | 226 | ||
227 | } | 227 | } |
228 | } | 228 | } |
229 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 229 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
230 | if ( ! mSearchTodo->isChecked() ) { | 230 | if ( ! mSearchTodo->isChecked() ) { |
231 | mSearchTodo->setChecked( true ); | 231 | mSearchTodo->setChecked( true ); |
232 | mSearchJournal->setChecked( false ); | 232 | mSearchJournal->setChecked( false ); |
233 | mSearchEvent->setChecked( false ); | 233 | mSearchEvent->setChecked( false ); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | else { | 236 | else { |
237 | if ( ! mSearchEvent->isChecked() ) { | 237 | if ( ! mSearchEvent->isChecked() ) { |
238 | mSearchEvent->setChecked( true ); | 238 | mSearchEvent->setChecked( true ); |
239 | mSearchJournal->setChecked( false ); | 239 | mSearchJournal->setChecked( false ); |
240 | mSearchTodo->setChecked( false ); | 240 | mSearchTodo->setChecked( false ); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | currentState = newState; | 244 | currentState = newState; |
245 | raise(); | 245 | raise(); |
246 | } | 246 | } |
247 | void SearchDialog::setFocusToList() | 247 | void SearchDialog::setFocusToList() |
248 | { | 248 | { |
249 | listView->resetFocus(); | 249 | listView->resetFocus(); |
250 | } | 250 | } |
251 | void SearchDialog::accept() | 251 | void SearchDialog::accept() |
252 | { | 252 | { |
253 | doSearch(); | 253 | doSearch(); |
254 | } | 254 | } |
255 | void SearchDialog::updateList() | 255 | void SearchDialog::updateList() |
256 | { | 256 | { |
257 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | ||
258 | listView->clear(); | ||
259 | return; | ||
260 | } | ||
257 | //listView->updateList(); | 261 | //listView->updateList(); |
258 | if ( isVisible() ) { | 262 | if ( isVisible() ) { |
259 | updateView(); | 263 | updateView(); |
260 | //qDebug("SearchDialog::updated "); | 264 | //qDebug("SearchDialog::updated "); |
261 | } | 265 | } |
262 | else { | 266 | else { |
263 | listView->clear(); | 267 | listView->clear(); |
264 | //qDebug("SearchDialog::cleared "); | 268 | //qDebug("SearchDialog::cleared "); |
265 | 269 | ||
266 | } | 270 | } |
267 | } | 271 | } |
268 | void SearchDialog::searchTextChanged( const QString &_text ) | 272 | void SearchDialog::searchTextChanged( const QString &_text ) |
269 | { | 273 | { |
270 | #if 0 | 274 | #if 0 |
271 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 275 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
272 | #endif | 276 | #endif |
273 | } | 277 | } |
274 | 278 | ||
275 | void SearchDialog::doSearch() | 279 | void SearchDialog::doSearch() |
276 | { | 280 | { |
277 | QRegExp re; | 281 | QRegExp re; |
278 | re.setWildcard(true); // most people understand these better. | 282 | re.setWildcard(true); // most people understand these better. |
279 | re.setCaseSensitive(false); | 283 | re.setCaseSensitive(false); |
280 | QString st = searchEdit->text(); | 284 | QString st = searchEdit->text(); |
281 | if ( st.right(1) != "*") | 285 | if ( st.right(1) != "*") |
282 | st += "*"; | 286 | st += "*"; |
283 | re.setPattern(st); | 287 | re.setPattern(st); |
284 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | 288 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { |
285 | KMessageBox::sorry(this, | 289 | KMessageBox::sorry(this, |
286 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | 290 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); |
287 | return; | 291 | return; |
288 | } | 292 | } |
289 | if (!re.isValid() ) { | 293 | if (!re.isValid() ) { |
290 | KMessageBox::sorry(this, | 294 | KMessageBox::sorry(this, |
291 | i18n("Invalid search expression,\ncannot perform " | 295 | i18n("Invalid search expression,\ncannot perform " |
292 | "the search.\nPlease enter a search expression\n" | 296 | "the search.\nPlease enter a search expression\n" |
293 | "using the wildcard characters\n '*' and '?'" | 297 | "using the wildcard characters\n '*' and '?'" |
294 | "where needed.")); | 298 | "where needed.")); |
295 | return; | 299 | return; |
296 | } | 300 | } |
297 | search(re); | 301 | search(re); |
298 | listView->setStartDate( mStartDate->date() ); | 302 | listView->setStartDate( mStartDate->date() ); |
299 | listView->showEvents(mMatchedEvents); | 303 | listView->showEvents(mMatchedEvents); |
300 | listView->addTodos(mMatchedTodos); | 304 | listView->addTodos(mMatchedTodos); |
301 | listView->addJournals(mMatchedJournals); | 305 | listView->addJournals(mMatchedJournals); |
302 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 306 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
303 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 307 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
304 | } else { | 308 | } else { |