-rw-r--r-- | korganizer/kolistview.cpp | 108 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 |
2 files changed, 51 insertions, 58 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 5797d1b..1f3b4c6 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -391,2 +391,3 @@ void KOListView::setCat() | |||
391 | } | 391 | } |
392 | |||
392 | void KOListView::setAlarm() | 393 | void KOListView::setAlarm() |
@@ -516,13 +517,4 @@ void KOListView::beamSelected() | |||
516 | { | 517 | { |
517 | int icount = 0; | 518 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
518 | QPtrList<Incidence> delSel ; | 519 | int icount = delSel.count(); |
519 | QListViewItem *item = mListView->firstChild (); | ||
520 | while ( item ) { | ||
521 | if ( item->isSelected() ) { | ||
522 | delSel.append(((KOListViewItem *)item)->data()); | ||
523 | ++icount; | ||
524 | } | ||
525 | |||
526 | item = item->nextSibling(); | ||
527 | } | ||
528 | if ( icount ) { | 520 | if ( icount ) { |
@@ -577,13 +569,4 @@ void KOListView::saveDescriptionToFile() | |||
577 | } | 569 | } |
578 | int icount = 0; | 570 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
579 | QPtrList<Incidence> delSel ; | 571 | int icount = delSel.count(); |
580 | QListViewItem *item = mListView->firstChild (); | ||
581 | while ( item ) { | ||
582 | if ( item->isSelected() ) { | ||
583 | delSel.append(((KOListViewItem *)item)->data()); | ||
584 | ++icount; | ||
585 | } | ||
586 | |||
587 | item = item->nextSibling(); | ||
588 | } | ||
589 | if ( icount ) { | 572 | if ( icount ) { |
@@ -661,22 +644,23 @@ void KOListView::saveToFile() | |||
661 | } | 644 | } |
662 | void KOListView::writeToFile( bool iCal ) | 645 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) |
663 | { | 646 | { |
664 | |||
665 | int icount = 0; | ||
666 | QPtrList<Incidence> delSel ; | 647 | QPtrList<Incidence> delSel ; |
667 | QListViewItem *item = mListView->firstChild (); | ||
668 | bool journal = iCal; // warn only for vCal | ||
669 | bool addSubTodos = false; | 648 | bool addSubTodos = false; |
670 | bool askSubTodos = true; | 649 | bool askSubTodos = true; |
650 | QListViewItem *item = mListView->firstChild (); | ||
671 | while ( item ) { | 651 | while ( item ) { |
672 | if ( item->isSelected() ) { | 652 | if ( item->isSelected() ) { |
673 | if ( !journal ) | ||
674 | if ( ((KOListViewItem *)item)->data()->typeID() == journalID ) | ||
675 | journal = true; | ||
676 | Incidence* inc = ((KOListViewItem *)item)->data(); | 653 | Incidence* inc = ((KOListViewItem *)item)->data(); |
677 | if ( addSubTodos ) { | 654 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { |
678 | if ( delSel.findRef( inc ) == -1 ) | 655 | if ( (inc->typeID() == todoID && includeTodos) || |
679 | delSel.append( inc ); | 656 | (inc->typeID() == eventID && includeEvents) || |
680 | } else | 657 | (inc->typeID() == journalID && includeJournals) ) { |
681 | delSel.append(inc); | 658 | if ( inc->typeID() == todoID && onlyDueTodos ) { |
659 | if ( ((Todo*)inc)->hasDueDate() ) | ||
660 | delSel.append( inc ); | ||
661 | } else | ||
662 | delSel.append( inc ); | ||
663 | |||
664 | } | ||
665 | } | ||
682 | if ( inc->typeID() == todoID ) { | 666 | if ( inc->typeID() == todoID ) { |
@@ -686,3 +670,3 @@ void KOListView::writeToFile( bool iCal ) | |||
686 | int result = KMessageBox::warningYesNoCancel(this, | 670 | int result = KMessageBox::warningYesNoCancel(this, |
687 | i18n("A selected todo has subtodos!\nDo you want to export\nall subtodos of all\nselected todos as well?"), | 671 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), |
688 | i18n("Todo has subtodos"), | 672 | i18n("Todo has subtodos"), |
@@ -690,4 +674,5 @@ void KOListView::writeToFile( bool iCal ) | |||
690 | i18n("No")); | 674 | i18n("No")); |
691 | if ( result == KMessageBox::Cancel ) { | 675 | if ( result == KMessageBox::Cancel ) { |
692 | return; | 676 | delSel.clear(); |
677 | return delSel; | ||
693 | } | 678 | } |
@@ -702,3 +687,2 @@ void KOListView::writeToFile( bool iCal ) | |||
702 | } | 687 | } |
703 | ++icount; | ||
704 | } | 688 | } |
@@ -706,10 +690,27 @@ void KOListView::writeToFile( bool iCal ) | |||
706 | } | 690 | } |
707 | if ( !iCal && journal ) { | 691 | return delSel; |
708 | int result = KMessageBox::warningContinueCancel(this, | 692 | } |
709 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 693 | |
710 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 694 | void KOListView::writeToFile( bool iCal ) |
711 | true); | 695 | { |
712 | if (result != KMessageBox::Continue) return; | 696 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
697 | if ( !iCal ) { | ||
698 | bool journal = false; | ||
699 | Incidence *incidence = delSel.first(); | ||
700 | while ( incidence ) { | ||
701 | if ( incidence->typeID() == journalID ) { | ||
702 | journal = true; | ||
703 | break; | ||
704 | } | ||
705 | incidence = delSel.next(); | ||
706 | } | ||
707 | if ( journal ) { | ||
708 | int result = KMessageBox::warningContinueCancel(this, | ||
709 | i18n("The journal entries can not be\nexported to a vCalendar file."), | ||
710 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | ||
711 | true); | ||
712 | if (result != KMessageBox::Continue) return; | ||
713 | } | ||
713 | } | 714 | } |
714 | if ( icount ) { | 715 | if ( delSel.count() ) { |
715 | QString fn = KOPrefs::instance()->mLastSaveFile; | 716 | QString fn = KOPrefs::instance()->mLastSaveFile; |
@@ -788,14 +789,5 @@ void KOListView::deleteAll() | |||
788 | { | 789 | { |
789 | int icount = 0; | 790 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; |
790 | QPtrList<Incidence> delSel ; | 791 | if ( delSel.count() ) { |
791 | QListViewItem *item = mListView->firstChild (); | 792 | int icount = delSel.count(); |
792 | while ( item ) { | ||
793 | if ( item->isSelected() ) { | ||
794 | delSel.append(((KOListViewItem *)item)->data()); | ||
795 | ++icount; | ||
796 | } | ||
797 | |||
798 | item = item->nextSibling(); | ||
799 | } | ||
800 | if ( icount ) { | ||
801 | Incidence *incidence = delSel.first(); | 793 | Incidence *incidence = delSel.first(); |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index c25592d..9da5497 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -264,2 +264,3 @@ class KOListView : public KOEventView | |||
264 | QString getWhatsThisText(QPoint p); | 264 | QString getWhatsThisText(QPoint p); |
265 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false ); | ||
265 | signals: | 266 | signals: |