author | zautrix <zautrix> | 2005-06-25 01:34:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-25 01:34:43 (UTC) |
commit | ab93fa0a7cd97beada9475f6099bf6083547f0d6 (patch) (unidiff) | |
tree | c983cb818528cac200a98585b3451c0371389e52 | |
parent | ce9c31a057f12a8d6a126a7312e4ecaf3270da50 (diff) | |
download | kdepimpi-ab93fa0a7cd97beada9475f6099bf6083547f0d6.zip kdepimpi-ab93fa0a7cd97beada9475f6099bf6083547f0d6.tar.gz kdepimpi-ab93fa0a7cd97beada9475f6099bf6083547f0d6.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/searchdialog.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 0713980..2390520 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -312,56 +312,60 @@ void SearchDialog::updateView() | |||
312 | { | 312 | { |
313 | //qDebug("SearchDialog::updateView() %d ", isVisible()); | 313 | //qDebug("SearchDialog::updateView() %d ", isVisible()); |
314 | QRegExp re; | 314 | QRegExp re; |
315 | re.setWildcard(true); // most people understand these better. | 315 | re.setWildcard(true); // most people understand these better. |
316 | re.setCaseSensitive(false); | 316 | re.setCaseSensitive(false); |
317 | QString st = searchEdit->text(); | 317 | QString st = searchEdit->text(); |
318 | if ( st.right(1) != "*") | 318 | if ( st.right(1) != "*") |
319 | st += "*"; | 319 | st += "*"; |
320 | re.setPattern(st); | 320 | re.setPattern(st); |
321 | if (re.isValid()) { | 321 | if (re.isValid()) { |
322 | search(re); | 322 | search(re); |
323 | } else { | 323 | } else { |
324 | mMatchedEvents.clear(); | 324 | mMatchedEvents.clear(); |
325 | mMatchedTodos.clear(); | 325 | mMatchedTodos.clear(); |
326 | mMatchedJournals.clear(); | 326 | mMatchedJournals.clear(); |
327 | } | 327 | } |
328 | listView->setStartDate( mStartDate->date() ); | 328 | listView->setStartDate( mStartDate->date() ); |
329 | listView->showEvents(mMatchedEvents); | 329 | listView->showEvents(mMatchedEvents); |
330 | listView->addTodos(mMatchedTodos); | 330 | listView->addTodos(mMatchedTodos); |
331 | listView->addJournals(mMatchedJournals); | 331 | listView->addJournals(mMatchedJournals); |
332 | } | 332 | } |
333 | 333 | ||
334 | void SearchDialog::search(const QRegExp &re) | 334 | void SearchDialog::search(const QRegExp &re) |
335 | { | 335 | { |
336 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 336 | QPtrList<Event> events; |
337 | mEndDate->date(), | ||
338 | false /*mInclusiveCheck->isChecked()*/ ); | ||
339 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 337 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
340 | if ( mRefineItems->isChecked() ) events = mMatchedEvents; | 338 | if ( mRefineItems->isChecked() ) events = mMatchedEvents; |
341 | mMatchedEvents.clear(); | 339 | mMatchedEvents.clear(); |
342 | } | 340 | } |
343 | if ( mSearchEvent->isChecked() ) { | 341 | if ( mSearchEvent->isChecked() ) { |
342 | if ( !mRefineItems->isChecked() ) | ||
343 | events = mCalendar->events( mStartDate->date(), | ||
344 | mEndDate->date(), | ||
345 | false /*mInclusiveCheck->isChecked()*/ ); | ||
346 | |||
347 | |||
344 | Event *ev; | 348 | Event *ev; |
345 | for(ev=events.first();ev;ev=events.next()) { | 349 | for(ev=events.first();ev;ev=events.next()) { |
346 | if (mSummaryCheck->isChecked()) { | 350 | if (mSummaryCheck->isChecked()) { |
347 | #if QT_VERSION >= 0x030000 | 351 | #if QT_VERSION >= 0x030000 |
348 | if (re.search(ev->summary()) != -1) | 352 | if (re.search(ev->summary()) != -1) |
349 | #else | 353 | #else |
350 | if (re.match(ev->summary()) != -1) | 354 | if (re.match(ev->summary()) != -1) |
351 | #endif | 355 | #endif |
352 | { | 356 | { |
353 | if ( mSubItems->isChecked() ) | 357 | if ( mSubItems->isChecked() ) |
354 | mMatchedEvents.remove(ev); | 358 | mMatchedEvents.remove(ev); |
355 | else { | 359 | else { |
356 | if ( !mMatchedEvents.contains( ev ) ) | 360 | if ( !mMatchedEvents.contains( ev ) ) |
357 | mMatchedEvents.append(ev); | 361 | mMatchedEvents.append(ev); |
358 | } | 362 | } |
359 | continue; | 363 | continue; |
360 | } | 364 | } |
361 | #if QT_VERSION >= 0x030000 | 365 | #if QT_VERSION >= 0x030000 |
362 | if (re.search(ev->location()) != -1) | 366 | if (re.search(ev->location()) != -1) |
363 | #else | 367 | #else |
364 | if (re.match(ev->location()) != -1) | 368 | if (re.match(ev->location()) != -1) |
365 | #endif | 369 | #endif |
366 | { | 370 | { |
367 | if ( mSubItems->isChecked() ) | 371 | if ( mSubItems->isChecked() ) |
@@ -425,56 +429,57 @@ void SearchDialog::search(const QRegExp &re) | |||
425 | } | 429 | } |
426 | break; | 430 | break; |
427 | } | 431 | } |
428 | } | 432 | } |
429 | if (mSearchAEmail->isChecked()) { | 433 | if (mSearchAEmail->isChecked()) { |
430 | #if QT_VERSION >= 0x030000 | 434 | #if QT_VERSION >= 0x030000 |
431 | if (re.search(a->email()) != -1) | 435 | if (re.search(a->email()) != -1) |
432 | #else | 436 | #else |
433 | if (re.match(a->email()) != -1) | 437 | if (re.match(a->email()) != -1) |
434 | #endif | 438 | #endif |
435 | { | 439 | { |
436 | if ( mSubItems->isChecked() ) | 440 | if ( mSubItems->isChecked() ) |
437 | mMatchedEvents.remove(ev); | 441 | mMatchedEvents.remove(ev); |
438 | else{ | 442 | else{ |
439 | if ( !mMatchedEvents.contains( ev ) ) | 443 | if ( !mMatchedEvents.contains( ev ) ) |
440 | mMatchedEvents.append(ev); | 444 | mMatchedEvents.append(ev); |
441 | } | 445 | } |
442 | break; | 446 | break; |
443 | } | 447 | } |
444 | } | 448 | } |
445 | } | 449 | } |
446 | } | 450 | } |
447 | } | 451 | } |
448 | } | 452 | } |
449 | QPtrList<Todo> todos = mCalendar->todos( ); | 453 | QPtrList<Todo> todos; |
450 | 454 | ||
451 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 455 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
452 | if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; | 456 | if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; |
453 | mMatchedTodos.clear(); | 457 | mMatchedTodos.clear(); |
454 | } | 458 | } |
455 | 459 | ||
456 | if ( mSearchTodo->isChecked() ) { | 460 | if ( mSearchTodo->isChecked() ) { |
461 | if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( ); | ||
457 | Todo *tod; | 462 | Todo *tod; |
458 | for(tod=todos.first();tod;tod=todos.next()) { | 463 | for(tod=todos.first();tod;tod=todos.next()) { |
459 | if (mSummaryCheck->isChecked()) { | 464 | if (mSummaryCheck->isChecked()) { |
460 | #if QT_VERSION >= 0x030000 | 465 | #if QT_VERSION >= 0x030000 |
461 | if (re.search(tod->summary()) != -1) | 466 | if (re.search(tod->summary()) != -1) |
462 | #else | 467 | #else |
463 | if (re.match(tod->summary()) != -1) | 468 | if (re.match(tod->summary()) != -1) |
464 | #endif | 469 | #endif |
465 | { | 470 | { |
466 | if ( mSubItems->isChecked() ) | 471 | if ( mSubItems->isChecked() ) |
467 | mMatchedTodos.remove(tod); | 472 | mMatchedTodos.remove(tod); |
468 | else if (!mMatchedTodos.contains( tod )) | 473 | else if (!mMatchedTodos.contains( tod )) |
469 | mMatchedTodos.append(tod); | 474 | mMatchedTodos.append(tod); |
470 | continue; | 475 | continue; |
471 | } | 476 | } |
472 | } | 477 | } |
473 | if (mDescriptionCheck->isChecked()) { | 478 | if (mDescriptionCheck->isChecked()) { |
474 | #if QT_VERSION >= 0x030000 | 479 | #if QT_VERSION >= 0x030000 |
475 | if (re.search(tod->description()) != -1) | 480 | if (re.search(tod->description()) != -1) |
476 | #else | 481 | #else |
477 | if (re.match(tod->description()) != -1) | 482 | if (re.match(tod->description()) != -1) |
478 | #endif | 483 | #endif |
479 | { | 484 | { |
480 | if ( mSubItems->isChecked() ) | 485 | if ( mSubItems->isChecked() ) |
@@ -514,54 +519,55 @@ void SearchDialog::search(const QRegExp &re) | |||
514 | else if (!mMatchedTodos.contains( tod )) | 519 | else if (!mMatchedTodos.contains( tod )) |
515 | mMatchedTodos.append(tod); | 520 | mMatchedTodos.append(tod); |
516 | break; | 521 | break; |
517 | } | 522 | } |
518 | } | 523 | } |
519 | if (mSearchAEmail->isChecked()) { | 524 | if (mSearchAEmail->isChecked()) { |
520 | #if QT_VERSION >= 0x030000 | 525 | #if QT_VERSION >= 0x030000 |
521 | if (re.search(a->email()) != -1) | 526 | if (re.search(a->email()) != -1) |
522 | #else | 527 | #else |
523 | if (re.match(a->email()) != -1) | 528 | if (re.match(a->email()) != -1) |
524 | #endif | 529 | #endif |
525 | { | 530 | { |
526 | if ( mSubItems->isChecked() ) | 531 | if ( mSubItems->isChecked() ) |
527 | mMatchedTodos.remove(tod); | 532 | mMatchedTodos.remove(tod); |
528 | else if (!mMatchedTodos.contains( tod )) | 533 | else if (!mMatchedTodos.contains( tod )) |
529 | mMatchedTodos.append(tod); | 534 | mMatchedTodos.append(tod); |
530 | break; | 535 | break; |
531 | } | 536 | } |
532 | } | 537 | } |
533 | } | 538 | } |
534 | } | 539 | } |
535 | } | 540 | } |
536 | } | 541 | } |
537 | 542 | ||
538 | QPtrList<Journal> journals = mCalendar->journals( ); | 543 | QPtrList<Journal> journals; |
539 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 544 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
540 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; | 545 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; |
541 | mMatchedJournals.clear(); | 546 | mMatchedJournals.clear(); |
542 | } | 547 | } |
543 | if (mSearchJournal->isChecked() ) { | 548 | if (mSearchJournal->isChecked() ) { |
549 | if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals(); | ||
544 | Journal* journ; | 550 | Journal* journ; |
545 | 551 | ||
546 | for(journ=journals.first();journ;journ=journals.next()) { | 552 | for(journ=journals.first();journ;journ=journals.next()) { |
547 | if ( journ->dtStart().date() <= mEndDate->date() | 553 | if ( journ->dtStart().date() <= mEndDate->date() |
548 | &&journ->dtStart().date() >= mStartDate->date()) { | 554 | &&journ->dtStart().date() >= mStartDate->date()) { |
549 | #if QT_VERSION >= 0x030000 | 555 | #if QT_VERSION >= 0x030000 |
550 | if (re.search(journ->description()) != -1) | 556 | if (re.search(journ->description()) != -1) |
551 | #else | 557 | #else |
552 | if (re.match(journ->description()) != -1) | 558 | if (re.match(journ->description()) != -1) |
553 | #endif | 559 | #endif |
554 | { | 560 | { |
555 | if ( mSubItems->isChecked() ) | 561 | if ( mSubItems->isChecked() ) |
556 | mMatchedJournals.remove(journ); | 562 | mMatchedJournals.remove(journ); |
557 | else if (!mMatchedJournals.contains( journ )) | 563 | else if (!mMatchedJournals.contains( journ )) |
558 | mMatchedJournals.append(journ); | 564 | mMatchedJournals.append(journ); |
559 | continue; | 565 | continue; |
560 | } | 566 | } |
561 | } | 567 | } |
562 | } | 568 | } |
563 | } | 569 | } |
564 | if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { | 570 | if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { |
565 | qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); | 571 | qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); |
566 | if ( mRefineItems->isChecked() ) | 572 | if ( mRefineItems->isChecked() ) |
567 | mRefineItems->setChecked( false ); | 573 | mRefineItems->setChecked( false ); |