author | zautrix <zautrix> | 2004-10-06 20:51:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 20:51:01 (UTC) |
commit | 0afcfa29ace7bc5e42a11fae44301e1e8230a376 (patch) (unidiff) | |
tree | b54f85b19ace24219be1b845469444089cacc94f /korganizer | |
parent | ed4675de07d947f55d2672c721599e3a0af1e24b (diff) | |
download | kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.zip kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.gz kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.bz2 |
some prefs cleanups
-rw-r--r-- | korganizer/calendarview.cpp | 14 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 1 |
3 files changed, 0 insertions, 17 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 38b55f7..1de2759 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -624,527 +624,513 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | |||
624 | } | 624 | } |
625 | //qDebug("Alarm timer started with secs: %d ", sec); | 625 | //qDebug("Alarm timer started with secs: %d ", sec); |
626 | mAlarmTimer->start( sec *1000 , true ); | 626 | mAlarmTimer->start( sec *1000 , true ); |
627 | 627 | ||
628 | } | 628 | } |
629 | // called by mRecheckAlarmTimer to get next alarm | 629 | // called by mRecheckAlarmTimer to get next alarm |
630 | // we need this, because a QTimer has only a max range of 25 days | 630 | // we need this, because a QTimer has only a max range of 25 days |
631 | void CalendarView::recheckTimerAlarm() | 631 | void CalendarView::recheckTimerAlarm() |
632 | { | 632 | { |
633 | mAlarmTimer->stop(); | 633 | mAlarmTimer->stop(); |
634 | mRecheckAlarmTimer->stop(); | 634 | mRecheckAlarmTimer->stop(); |
635 | mCalendar->checkAlarmForIncidence( 0, true ); | 635 | mCalendar->checkAlarmForIncidence( 0, true ); |
636 | } | 636 | } |
637 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 637 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
638 | { | 638 | { |
639 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 639 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
640 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 640 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
641 | #ifndef DESKTOP_VERSION | 641 | #ifndef DESKTOP_VERSION |
642 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 642 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
643 | #endif | 643 | #endif |
644 | return; | 644 | return; |
645 | } | 645 | } |
646 | mAlarmTimer->stop(); | 646 | mAlarmTimer->stop(); |
647 | } | 647 | } |
648 | void CalendarView::selectWeekNum ( int num ) | 648 | void CalendarView::selectWeekNum ( int num ) |
649 | { | 649 | { |
650 | dateNavigator()->selectWeek( num ); | 650 | dateNavigator()->selectWeek( num ); |
651 | mViewManager->showWeekView(); | 651 | mViewManager->showWeekView(); |
652 | } | 652 | } |
653 | KOViewManager *CalendarView::viewManager() | 653 | KOViewManager *CalendarView::viewManager() |
654 | { | 654 | { |
655 | return mViewManager; | 655 | return mViewManager; |
656 | } | 656 | } |
657 | 657 | ||
658 | KODialogManager *CalendarView::dialogManager() | 658 | KODialogManager *CalendarView::dialogManager() |
659 | { | 659 | { |
660 | return mDialogManager; | 660 | return mDialogManager; |
661 | } | 661 | } |
662 | 662 | ||
663 | QDate CalendarView::startDate() | 663 | QDate CalendarView::startDate() |
664 | { | 664 | { |
665 | DateList dates = mNavigator->selectedDates(); | 665 | DateList dates = mNavigator->selectedDates(); |
666 | 666 | ||
667 | return dates.first(); | 667 | return dates.first(); |
668 | } | 668 | } |
669 | 669 | ||
670 | QDate CalendarView::endDate() | 670 | QDate CalendarView::endDate() |
671 | { | 671 | { |
672 | DateList dates = mNavigator->selectedDates(); | 672 | DateList dates = mNavigator->selectedDates(); |
673 | 673 | ||
674 | return dates.last(); | 674 | return dates.last(); |
675 | } | 675 | } |
676 | 676 | ||
677 | 677 | ||
678 | void CalendarView::createPrinter() | 678 | void CalendarView::createPrinter() |
679 | { | 679 | { |
680 | #ifndef KORG_NOPRINTER | 680 | #ifndef KORG_NOPRINTER |
681 | if (!mCalPrinter) { | 681 | if (!mCalPrinter) { |
682 | mCalPrinter = new CalPrinter(this, mCalendar); | 682 | mCalPrinter = new CalPrinter(this, mCalendar); |
683 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 683 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
684 | } | 684 | } |
685 | #endif | 685 | #endif |
686 | } | 686 | } |
687 | 687 | ||
688 | void CalendarView::confSync() | 688 | void CalendarView::confSync() |
689 | { | 689 | { |
690 | static KSyncPrefsDialog* sp = 0; | 690 | static KSyncPrefsDialog* sp = 0; |
691 | if ( ! sp ) { | 691 | if ( ! sp ) { |
692 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); | 692 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); |
693 | } | 693 | } |
694 | sp->usrReadConfig(); | 694 | sp->usrReadConfig(); |
695 | #ifndef DESKTOP_VERSION | 695 | #ifndef DESKTOP_VERSION |
696 | sp->showMaximized(); | 696 | sp->showMaximized(); |
697 | #else | 697 | #else |
698 | sp->show(); | 698 | sp->show(); |
699 | #endif | 699 | #endif |
700 | sp->exec(); | 700 | sp->exec(); |
701 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | 701 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); |
702 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | 702 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); |
703 | } | 703 | } |
704 | 704 | ||
705 | 705 | ||
706 | //KOPrefs::instance()->mWriteBackFile | 706 | //KOPrefs::instance()->mWriteBackFile |
707 | //KOPrefs::instance()->mWriteBackExistingOnly | 707 | //KOPrefs::instance()->mWriteBackExistingOnly |
708 | 708 | ||
709 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 709 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
710 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 710 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
711 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 711 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
712 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 712 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
713 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 713 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
714 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 714 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
715 | 715 | ||
716 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 716 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
717 | { | 717 | { |
718 | 718 | ||
719 | //void setZaurusId(int id); | 719 | //void setZaurusId(int id); |
720 | // int zaurusId() const; | 720 | // int zaurusId() const; |
721 | // void setZaurusUid(int id); | 721 | // void setZaurusUid(int id); |
722 | // int zaurusUid() const; | 722 | // int zaurusUid() const; |
723 | // void setZaurusStat(int id); | 723 | // void setZaurusStat(int id); |
724 | // int zaurusStat() const; | 724 | // int zaurusStat() const; |
725 | // 0 equal | 725 | // 0 equal |
726 | // 1 take local | 726 | // 1 take local |
727 | // 2 take remote | 727 | // 2 take remote |
728 | // 3 cancel | 728 | // 3 cancel |
729 | QDateTime lastSync = mLastCalendarSync; | 729 | QDateTime lastSync = mLastCalendarSync; |
730 | QDateTime localMod = local->lastModified(); | 730 | QDateTime localMod = local->lastModified(); |
731 | QDateTime remoteMod = remote->lastModified(); | 731 | QDateTime remoteMod = remote->lastModified(); |
732 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 732 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
733 | bool remCh, locCh; | 733 | bool remCh, locCh; |
734 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 734 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
735 | //if ( remCh ) | 735 | //if ( remCh ) |
736 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 736 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
737 | locCh = ( localMod > mLastCalendarSync ); | 737 | locCh = ( localMod > mLastCalendarSync ); |
738 | if ( !remCh && ! locCh ) { | 738 | if ( !remCh && ! locCh ) { |
739 | //qDebug("both not changed "); | 739 | //qDebug("both not changed "); |
740 | lastSync = localMod.addDays(1); | 740 | lastSync = localMod.addDays(1); |
741 | if ( mode <= SYNC_PREF_ASK ) | 741 | if ( mode <= SYNC_PREF_ASK ) |
742 | return 0; | 742 | return 0; |
743 | } else { | 743 | } else { |
744 | if ( locCh ) { | 744 | if ( locCh ) { |
745 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 745 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
746 | lastSync = localMod.addDays( -1 ); | 746 | lastSync = localMod.addDays( -1 ); |
747 | if ( !remCh ) | 747 | if ( !remCh ) |
748 | remoteMod = ( lastSync.addDays( -1 ) ); | 748 | remoteMod = ( lastSync.addDays( -1 ) ); |
749 | } else { | 749 | } else { |
750 | //qDebug(" not loc changed "); | 750 | //qDebug(" not loc changed "); |
751 | lastSync = localMod.addDays( 1 ); | 751 | lastSync = localMod.addDays( 1 ); |
752 | if ( remCh ) | 752 | if ( remCh ) |
753 | remoteMod =( lastSync.addDays( 1 ) ); | 753 | remoteMod =( lastSync.addDays( 1 ) ); |
754 | 754 | ||
755 | } | 755 | } |
756 | } | 756 | } |
757 | full = true; | 757 | full = true; |
758 | if ( mode < SYNC_PREF_ASK ) | 758 | if ( mode < SYNC_PREF_ASK ) |
759 | mode = SYNC_PREF_ASK; | 759 | mode = SYNC_PREF_ASK; |
760 | } else { | 760 | } else { |
761 | if ( localMod == remoteMod ) | 761 | if ( localMod == remoteMod ) |
762 | if ( local->revision() == remote->revision() ) | 762 | if ( local->revision() == remote->revision() ) |
763 | return 0; | 763 | return 0; |
764 | 764 | ||
765 | } | 765 | } |
766 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 766 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
767 | 767 | ||
768 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 768 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
769 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 769 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
770 | //full = true; //debug only | 770 | //full = true; //debug only |
771 | if ( full ) { | 771 | if ( full ) { |
772 | bool equ = false; | 772 | bool equ = false; |
773 | if ( local->type() == "Event" ) { | 773 | if ( local->type() == "Event" ) { |
774 | equ = (*((Event*) local) == *((Event*) remote)); | 774 | equ = (*((Event*) local) == *((Event*) remote)); |
775 | } | 775 | } |
776 | else if ( local->type() =="Todo" ) | 776 | else if ( local->type() =="Todo" ) |
777 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 777 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
778 | else if ( local->type() =="Journal" ) | 778 | else if ( local->type() =="Journal" ) |
779 | equ = (*((Journal*) local) == *((Journal*) remote)); | 779 | equ = (*((Journal*) local) == *((Journal*) remote)); |
780 | if ( equ ) { | 780 | if ( equ ) { |
781 | //qDebug("equal "); | 781 | //qDebug("equal "); |
782 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 782 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
783 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 783 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
784 | } | 784 | } |
785 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 785 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
786 | return 0; | 786 | return 0; |
787 | 787 | ||
788 | }//else //debug only | 788 | }//else //debug only |
789 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 789 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
790 | } | 790 | } |
791 | int result; | 791 | int result; |
792 | bool localIsNew; | 792 | bool localIsNew; |
793 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 793 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
794 | 794 | ||
795 | if ( full && mode < SYNC_PREF_NEWEST ) | 795 | if ( full && mode < SYNC_PREF_NEWEST ) |
796 | mode = SYNC_PREF_ASK; | 796 | mode = SYNC_PREF_ASK; |
797 | 797 | ||
798 | switch( mode ) { | 798 | switch( mode ) { |
799 | case SYNC_PREF_LOCAL: | 799 | case SYNC_PREF_LOCAL: |
800 | if ( lastSync > remoteMod ) | 800 | if ( lastSync > remoteMod ) |
801 | return 1; | 801 | return 1; |
802 | if ( lastSync > localMod ) | 802 | if ( lastSync > localMod ) |
803 | return 2; | 803 | return 2; |
804 | return 1; | 804 | return 1; |
805 | break; | 805 | break; |
806 | case SYNC_PREF_REMOTE: | 806 | case SYNC_PREF_REMOTE: |
807 | if ( lastSync > remoteMod ) | 807 | if ( lastSync > remoteMod ) |
808 | return 1; | 808 | return 1; |
809 | if ( lastSync > localMod ) | 809 | if ( lastSync > localMod ) |
810 | return 2; | 810 | return 2; |
811 | return 2; | 811 | return 2; |
812 | break; | 812 | break; |
813 | case SYNC_PREF_NEWEST: | 813 | case SYNC_PREF_NEWEST: |
814 | if ( localMod > remoteMod ) | 814 | if ( localMod > remoteMod ) |
815 | return 1; | 815 | return 1; |
816 | else | 816 | else |
817 | return 2; | 817 | return 2; |
818 | break; | 818 | break; |
819 | case SYNC_PREF_ASK: | 819 | case SYNC_PREF_ASK: |
820 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 820 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
821 | if ( lastSync > remoteMod ) | 821 | if ( lastSync > remoteMod ) |
822 | return 1; | 822 | return 1; |
823 | if ( lastSync > localMod ) | 823 | if ( lastSync > localMod ) |
824 | return 2; | 824 | return 2; |
825 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 825 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
826 | localIsNew = localMod >= remoteMod; | 826 | localIsNew = localMod >= remoteMod; |
827 | if ( localIsNew ) | 827 | if ( localIsNew ) |
828 | getEventViewerDialog()->setColorMode( 1 ); | 828 | getEventViewerDialog()->setColorMode( 1 ); |
829 | else | 829 | else |
830 | getEventViewerDialog()->setColorMode( 2 ); | 830 | getEventViewerDialog()->setColorMode( 2 ); |
831 | getEventViewerDialog()->setIncidence(local); | 831 | getEventViewerDialog()->setIncidence(local); |
832 | if ( localIsNew ) | 832 | if ( localIsNew ) |
833 | getEventViewerDialog()->setColorMode( 2 ); | 833 | getEventViewerDialog()->setColorMode( 2 ); |
834 | else | 834 | else |
835 | getEventViewerDialog()->setColorMode( 1 ); | 835 | getEventViewerDialog()->setColorMode( 1 ); |
836 | getEventViewerDialog()->addIncidence(remote); | 836 | getEventViewerDialog()->addIncidence(remote); |
837 | getEventViewerDialog()->setColorMode( 0 ); | 837 | getEventViewerDialog()->setColorMode( 0 ); |
838 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 838 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
839 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 839 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
840 | getEventViewerDialog()->showMe(); | 840 | getEventViewerDialog()->showMe(); |
841 | result = getEventViewerDialog()->executeS( localIsNew ); | 841 | result = getEventViewerDialog()->executeS( localIsNew ); |
842 | return result; | 842 | return result; |
843 | 843 | ||
844 | break; | 844 | break; |
845 | case SYNC_PREF_FORCE_LOCAL: | 845 | case SYNC_PREF_FORCE_LOCAL: |
846 | return 1; | 846 | return 1; |
847 | break; | 847 | break; |
848 | case SYNC_PREF_FORCE_REMOTE: | 848 | case SYNC_PREF_FORCE_REMOTE: |
849 | return 2; | 849 | return 2; |
850 | break; | 850 | break; |
851 | 851 | ||
852 | default: | 852 | default: |
853 | // SYNC_PREF_TAKE_BOTH not implemented | 853 | // SYNC_PREF_TAKE_BOTH not implemented |
854 | break; | 854 | break; |
855 | } | 855 | } |
856 | return 0; | 856 | return 0; |
857 | } | 857 | } |
858 | Event* CalendarView::getLastSyncEvent() | 858 | Event* CalendarView::getLastSyncEvent() |
859 | { | 859 | { |
860 | Event* lse; | 860 | Event* lse; |
861 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 861 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
862 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 862 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
863 | if (!lse) { | 863 | if (!lse) { |
864 | lse = new Event(); | 864 | lse = new Event(); |
865 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 865 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
866 | QString sum = ""; | 866 | QString sum = ""; |
867 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 867 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
868 | sum = "E: "; | 868 | sum = "E: "; |
869 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 869 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
870 | lse->setDtStart( mLastCalendarSync ); | 870 | lse->setDtStart( mLastCalendarSync ); |
871 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 871 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
872 | lse->setCategories( i18n("SyncEvent") ); | 872 | lse->setCategories( i18n("SyncEvent") ); |
873 | lse->setReadOnly( true ); | 873 | lse->setReadOnly( true ); |
874 | mCalendar->addEvent( lse ); | 874 | mCalendar->addEvent( lse ); |
875 | } | 875 | } |
876 | 876 | ||
877 | return lse; | 877 | return lse; |
878 | 878 | ||
879 | } | 879 | } |
880 | // probaly useless | ||
881 | void CalendarView::setupExternSyncProfiles() | ||
882 | { | ||
883 | Event* lse; | ||
884 | mExternLastSyncEvent.clear(); | ||
885 | int i; | ||
886 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { | ||
887 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); | ||
888 | if ( lse ) | ||
889 | mExternLastSyncEvent.append( lse ); | ||
890 | else | ||
891 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); | ||
892 | } | ||
893 | 880 | ||
894 | } | ||
895 | // we check, if the to delete event has a id for a profile | 881 | // we check, if the to delete event has a id for a profile |
896 | // if yes, we set this id in the profile to delete | 882 | // if yes, we set this id in the profile to delete |
897 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 883 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
898 | { | 884 | { |
899 | if ( lastSync.count() == 0 ) { | 885 | if ( lastSync.count() == 0 ) { |
900 | //qDebug(" lastSync.count() == 0"); | 886 | //qDebug(" lastSync.count() == 0"); |
901 | return; | 887 | return; |
902 | } | 888 | } |
903 | if ( toDelete->type() == "Journal" ) | 889 | if ( toDelete->type() == "Journal" ) |
904 | return; | 890 | return; |
905 | 891 | ||
906 | Event* eve = lastSync.first(); | 892 | Event* eve = lastSync.first(); |
907 | 893 | ||
908 | while ( eve ) { | 894 | while ( eve ) { |
909 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 895 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
910 | if ( !id.isEmpty() ) { | 896 | if ( !id.isEmpty() ) { |
911 | QString des = eve->description(); | 897 | QString des = eve->description(); |
912 | QString pref = "e"; | 898 | QString pref = "e"; |
913 | if ( toDelete->type() == "Todo" ) | 899 | if ( toDelete->type() == "Todo" ) |
914 | pref = "t"; | 900 | pref = "t"; |
915 | des += pref+ id + ","; | 901 | des += pref+ id + ","; |
916 | eve->setReadOnly( false ); | 902 | eve->setReadOnly( false ); |
917 | eve->setDescription( des ); | 903 | eve->setDescription( des ); |
918 | //qDebug("setdes %s ", des.latin1()); | 904 | //qDebug("setdes %s ", des.latin1()); |
919 | eve->setReadOnly( true ); | 905 | eve->setReadOnly( true ); |
920 | } | 906 | } |
921 | eve = lastSync.next(); | 907 | eve = lastSync.next(); |
922 | } | 908 | } |
923 | 909 | ||
924 | } | 910 | } |
925 | void CalendarView::checkExternalId( Incidence * inc ) | 911 | void CalendarView::checkExternalId( Incidence * inc ) |
926 | { | 912 | { |
927 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 913 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
928 | checkExternSyncEvent( lastSync, inc ); | 914 | checkExternSyncEvent( lastSync, inc ); |
929 | 915 | ||
930 | } | 916 | } |
931 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 917 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
932 | { | 918 | { |
933 | bool syncOK = true; | 919 | bool syncOK = true; |
934 | int addedEvent = 0; | 920 | int addedEvent = 0; |
935 | int addedEventR = 0; | 921 | int addedEventR = 0; |
936 | int deletedEventR = 0; | 922 | int deletedEventR = 0; |
937 | int deletedEventL = 0; | 923 | int deletedEventL = 0; |
938 | int changedLocal = 0; | 924 | int changedLocal = 0; |
939 | int changedRemote = 0; | 925 | int changedRemote = 0; |
940 | //QPtrList<Event> el = local->rawEvents(); | 926 | //QPtrList<Event> el = local->rawEvents(); |
941 | Event* eventR; | 927 | Event* eventR; |
942 | QString uid; | 928 | QString uid; |
943 | int take; | 929 | int take; |
944 | Event* eventL; | 930 | Event* eventL; |
945 | Event* eventRSync; | 931 | Event* eventRSync; |
946 | Event* eventLSync; | 932 | Event* eventLSync; |
947 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 933 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
948 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 934 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
949 | bool fullDateRange = false; | 935 | bool fullDateRange = false; |
950 | local->resetTempSyncStat(); | 936 | local->resetTempSyncStat(); |
951 | mLastCalendarSync = QDateTime::currentDateTime(); | 937 | mLastCalendarSync = QDateTime::currentDateTime(); |
952 | QDateTime modifiedCalendar = mLastCalendarSync;; | 938 | QDateTime modifiedCalendar = mLastCalendarSync;; |
953 | eventLSync = getLastSyncEvent(); | 939 | eventLSync = getLastSyncEvent(); |
954 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 940 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
955 | if ( eventR ) { | 941 | if ( eventR ) { |
956 | eventRSync = (Event*) eventR->clone(); | 942 | eventRSync = (Event*) eventR->clone(); |
957 | remote->deleteEvent(eventR ); | 943 | remote->deleteEvent(eventR ); |
958 | 944 | ||
959 | } else { | 945 | } else { |
960 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 946 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
961 | eventRSync = (Event*)eventLSync->clone(); | 947 | eventRSync = (Event*)eventLSync->clone(); |
962 | } else { | 948 | } else { |
963 | fullDateRange = true; | 949 | fullDateRange = true; |
964 | eventRSync = new Event(); | 950 | eventRSync = new Event(); |
965 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 951 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
966 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 952 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
967 | eventRSync->setDtStart( mLastCalendarSync ); | 953 | eventRSync->setDtStart( mLastCalendarSync ); |
968 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 954 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
969 | eventRSync->setCategories( i18n("SyncEvent") ); | 955 | eventRSync->setCategories( i18n("SyncEvent") ); |
970 | } | 956 | } |
971 | } | 957 | } |
972 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 958 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
973 | fullDateRange = true; | 959 | fullDateRange = true; |
974 | 960 | ||
975 | if ( ! fullDateRange ) { | 961 | if ( ! fullDateRange ) { |
976 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 962 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
977 | 963 | ||
978 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 964 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
979 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 965 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
980 | fullDateRange = true; | 966 | fullDateRange = true; |
981 | } | 967 | } |
982 | } | 968 | } |
983 | if ( fullDateRange ) | 969 | if ( fullDateRange ) |
984 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 970 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
985 | else | 971 | else |
986 | mLastCalendarSync = eventLSync->dtStart(); | 972 | mLastCalendarSync = eventLSync->dtStart(); |
987 | // for resyncing if own file has changed | 973 | // for resyncing if own file has changed |
988 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 974 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
989 | mLastCalendarSync = loadedFileVersion; | 975 | mLastCalendarSync = loadedFileVersion; |
990 | qDebug("setting mLastCalendarSync "); | 976 | qDebug("setting mLastCalendarSync "); |
991 | } | 977 | } |
992 | //qDebug("*************************** "); | 978 | //qDebug("*************************** "); |
993 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); | 979 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); |
994 | QPtrList<Incidence> er = remote->rawIncidences(); | 980 | QPtrList<Incidence> er = remote->rawIncidences(); |
995 | Incidence* inR = er.first(); | 981 | Incidence* inR = er.first(); |
996 | Incidence* inL; | 982 | Incidence* inL; |
997 | QProgressBar bar( er.count(),0 ); | 983 | QProgressBar bar( er.count(),0 ); |
998 | bar.setCaption (i18n("Syncing - close to abort!") ); | 984 | bar.setCaption (i18n("Syncing - close to abort!") ); |
999 | 985 | ||
1000 | int w = 300; | 986 | int w = 300; |
1001 | if ( QApplication::desktop()->width() < 320 ) | 987 | if ( QApplication::desktop()->width() < 320 ) |
1002 | w = 220; | 988 | w = 220; |
1003 | int h = bar.sizeHint().height() ; | 989 | int h = bar.sizeHint().height() ; |
1004 | int dw = QApplication::desktop()->width(); | 990 | int dw = QApplication::desktop()->width(); |
1005 | int dh = QApplication::desktop()->height(); | 991 | int dh = QApplication::desktop()->height(); |
1006 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 992 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1007 | bar.show(); | 993 | bar.show(); |
1008 | int modulo = (er.count()/10)+1; | 994 | int modulo = (er.count()/10)+1; |
1009 | int incCounter = 0; | 995 | int incCounter = 0; |
1010 | while ( inR ) { | 996 | while ( inR ) { |
1011 | if ( ! bar.isVisible() ) | 997 | if ( ! bar.isVisible() ) |
1012 | return false; | 998 | return false; |
1013 | if ( incCounter % modulo == 0 ) | 999 | if ( incCounter % modulo == 0 ) |
1014 | bar.setProgress( incCounter ); | 1000 | bar.setProgress( incCounter ); |
1015 | ++incCounter; | 1001 | ++incCounter; |
1016 | uid = inR->uid(); | 1002 | uid = inR->uid(); |
1017 | bool skipIncidence = false; | 1003 | bool skipIncidence = false; |
1018 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1004 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1019 | skipIncidence = true; | 1005 | skipIncidence = true; |
1020 | QString idS; | 1006 | QString idS; |
1021 | qApp->processEvents(); | 1007 | qApp->processEvents(); |
1022 | if ( !skipIncidence ) { | 1008 | if ( !skipIncidence ) { |
1023 | inL = local->incidence( uid ); | 1009 | inL = local->incidence( uid ); |
1024 | if ( inL ) { // maybe conflict - same uid in both calendars | 1010 | if ( inL ) { // maybe conflict - same uid in both calendars |
1025 | int maxrev = inL->revision(); | 1011 | int maxrev = inL->revision(); |
1026 | if ( maxrev < inR->revision() ) | 1012 | if ( maxrev < inR->revision() ) |
1027 | maxrev = inR->revision(); | 1013 | maxrev = inR->revision(); |
1028 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1014 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1029 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1015 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1030 | if ( take == 3 ) | 1016 | if ( take == 3 ) |
1031 | return false; | 1017 | return false; |
1032 | if ( take == 1 ) {// take local | 1018 | if ( take == 1 ) {// take local |
1033 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1019 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1034 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1020 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1035 | else | 1021 | else |
1036 | idS = inR->IDStr(); | 1022 | idS = inR->IDStr(); |
1037 | remote->deleteIncidence( inR ); | 1023 | remote->deleteIncidence( inR ); |
1038 | if ( inL->revision() < maxrev ) | 1024 | if ( inL->revision() < maxrev ) |
1039 | inL->setRevision( maxrev ); | 1025 | inL->setRevision( maxrev ); |
1040 | inR = inL->clone(); | 1026 | inR = inL->clone(); |
1041 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1027 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1042 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1028 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1043 | inR->setIDStr( idS ); | 1029 | inR->setIDStr( idS ); |
1044 | remote->addIncidence( inR ); | 1030 | remote->addIncidence( inR ); |
1045 | ++changedRemote; | 1031 | ++changedRemote; |
1046 | } else { | 1032 | } else { |
1047 | if ( inR->revision() < maxrev ) | 1033 | if ( inR->revision() < maxrev ) |
1048 | inR->setRevision( maxrev ); | 1034 | inR->setRevision( maxrev ); |
1049 | idS = inL->IDStr(); | 1035 | idS = inL->IDStr(); |
1050 | local->deleteIncidence( inL ); | 1036 | local->deleteIncidence( inL ); |
1051 | inL = inR->clone(); | 1037 | inL = inR->clone(); |
1052 | inL->setIDStr( idS ); | 1038 | inL->setIDStr( idS ); |
1053 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1039 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1054 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1040 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1055 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1041 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1056 | } | 1042 | } |
1057 | local->addIncidence( inL ); | 1043 | local->addIncidence( inL ); |
1058 | ++changedLocal; | 1044 | ++changedLocal; |
1059 | } | 1045 | } |
1060 | } | 1046 | } |
1061 | } else { // no conflict | 1047 | } else { // no conflict |
1062 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1048 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1063 | QString des = eventLSync->description(); | 1049 | QString des = eventLSync->description(); |
1064 | QString pref = "e"; | 1050 | QString pref = "e"; |
1065 | if ( inR->type() == "Todo" ) | 1051 | if ( inR->type() == "Todo" ) |
1066 | pref = "t"; | 1052 | pref = "t"; |
1067 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1053 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1068 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1054 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1069 | //remote->deleteIncidence( inR ); | 1055 | //remote->deleteIncidence( inR ); |
1070 | ++deletedEventR; | 1056 | ++deletedEventR; |
1071 | } else { | 1057 | } else { |
1072 | inR->setLastModified( modifiedCalendar ); | 1058 | inR->setLastModified( modifiedCalendar ); |
1073 | inL = inR->clone(); | 1059 | inL = inR->clone(); |
1074 | local->addIncidence( inL ); | 1060 | local->addIncidence( inL ); |
1075 | ++addedEvent; | 1061 | ++addedEvent; |
1076 | } | 1062 | } |
1077 | } else { | 1063 | } else { |
1078 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1064 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1079 | inR->setLastModified( modifiedCalendar ); | 1065 | inR->setLastModified( modifiedCalendar ); |
1080 | local->addIncidence( inR->clone() ); | 1066 | local->addIncidence( inR->clone() ); |
1081 | ++addedEvent; | 1067 | ++addedEvent; |
1082 | } else { | 1068 | } else { |
1083 | checkExternSyncEvent(eventRSyncSharp, inR); | 1069 | checkExternSyncEvent(eventRSyncSharp, inR); |
1084 | remote->deleteIncidence( inR ); | 1070 | remote->deleteIncidence( inR ); |
1085 | ++deletedEventR; | 1071 | ++deletedEventR; |
1086 | } | 1072 | } |
1087 | } | 1073 | } |
1088 | } | 1074 | } |
1089 | } | 1075 | } |
1090 | inR = er.next(); | 1076 | inR = er.next(); |
1091 | } | 1077 | } |
1092 | QPtrList<Incidence> el = local->rawIncidences(); | 1078 | QPtrList<Incidence> el = local->rawIncidences(); |
1093 | inL = el.first(); | 1079 | inL = el.first(); |
1094 | modulo = (el.count()/10)+1; | 1080 | modulo = (el.count()/10)+1; |
1095 | bar.setCaption (i18n("Add / remove events") ); | 1081 | bar.setCaption (i18n("Add / remove events") ); |
1096 | bar.setTotalSteps ( el.count() ) ; | 1082 | bar.setTotalSteps ( el.count() ) ; |
1097 | bar.show(); | 1083 | bar.show(); |
1098 | incCounter = 0; | 1084 | incCounter = 0; |
1099 | 1085 | ||
1100 | while ( inL ) { | 1086 | while ( inL ) { |
1101 | 1087 | ||
1102 | qApp->processEvents(); | 1088 | qApp->processEvents(); |
1103 | if ( ! bar.isVisible() ) | 1089 | if ( ! bar.isVisible() ) |
1104 | return false; | 1090 | return false; |
1105 | if ( incCounter % modulo == 0 ) | 1091 | if ( incCounter % modulo == 0 ) |
1106 | bar.setProgress( incCounter ); | 1092 | bar.setProgress( incCounter ); |
1107 | ++incCounter; | 1093 | ++incCounter; |
1108 | uid = inL->uid(); | 1094 | uid = inL->uid(); |
1109 | bool skipIncidence = false; | 1095 | bool skipIncidence = false; |
1110 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1096 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1111 | skipIncidence = true; | 1097 | skipIncidence = true; |
1112 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1098 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1113 | skipIncidence = true; | 1099 | skipIncidence = true; |
1114 | if ( !skipIncidence ) { | 1100 | if ( !skipIncidence ) { |
1115 | inR = remote->incidence( uid ); | 1101 | inR = remote->incidence( uid ); |
1116 | if ( ! inR ) { | 1102 | if ( ! inR ) { |
1117 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1103 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1118 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1104 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1119 | checkExternSyncEvent(eventLSyncSharp, inL); | 1105 | checkExternSyncEvent(eventLSyncSharp, inL); |
1120 | local->deleteIncidence( inL ); | 1106 | local->deleteIncidence( inL ); |
1121 | ++deletedEventL; | 1107 | ++deletedEventL; |
1122 | } else { | 1108 | } else { |
1123 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1109 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1124 | inL->removeID(mCurrentSyncDevice ); | 1110 | inL->removeID(mCurrentSyncDevice ); |
1125 | ++addedEventR; | 1111 | ++addedEventR; |
1126 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1112 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1127 | inL->setLastModified( modifiedCalendar ); | 1113 | inL->setLastModified( modifiedCalendar ); |
1128 | inR = inL->clone(); | 1114 | inR = inL->clone(); |
1129 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1115 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1130 | remote->addIncidence( inR ); | 1116 | remote->addIncidence( inR ); |
1131 | } | 1117 | } |
1132 | } | 1118 | } |
1133 | } else { | 1119 | } else { |
1134 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1120 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1135 | checkExternSyncEvent(eventLSyncSharp, inL); | 1121 | checkExternSyncEvent(eventLSyncSharp, inL); |
1136 | local->deleteIncidence( inL ); | 1122 | local->deleteIncidence( inL ); |
1137 | ++deletedEventL; | 1123 | ++deletedEventL; |
1138 | } else { | 1124 | } else { |
1139 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1125 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1140 | ++addedEventR; | 1126 | ++addedEventR; |
1141 | inL->setLastModified( modifiedCalendar ); | 1127 | inL->setLastModified( modifiedCalendar ); |
1142 | remote->addIncidence( inL->clone() ); | 1128 | remote->addIncidence( inL->clone() ); |
1143 | } | 1129 | } |
1144 | } | 1130 | } |
1145 | } | 1131 | } |
1146 | } | 1132 | } |
1147 | } | 1133 | } |
1148 | inL = el.next(); | 1134 | inL = el.next(); |
1149 | } | 1135 | } |
1150 | int delFut = 0; | 1136 | int delFut = 0; |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index a713c91..0f7e696 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,596 +1,594 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | 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 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | 42 | ||
43 | #include <korganizer/calendarviewbase.h> | 43 | #include <korganizer/calendarviewbase.h> |
44 | 44 | ||
45 | class QWidgetStack; | 45 | class QWidgetStack; |
46 | class QSplitter; | 46 | class QSplitter; |
47 | 47 | ||
48 | class CalPrinter; | 48 | class CalPrinter; |
49 | class KOFilterView; | 49 | class KOFilterView; |
50 | class KOViewManager; | 50 | class KOViewManager; |
51 | class KODialogManager; | 51 | class KODialogManager; |
52 | class KOTodoView; | 52 | class KOTodoView; |
53 | class KDateNavigator; | 53 | class KDateNavigator; |
54 | class DateNavigator; | 54 | class DateNavigator; |
55 | class KOIncidenceEditor; | 55 | class KOIncidenceEditor; |
56 | class KDatePicker; | 56 | class KDatePicker; |
57 | class ResourceView; | 57 | class ResourceView; |
58 | class NavigatorBar; | 58 | class NavigatorBar; |
59 | class KOEventEditor; | 59 | class KOEventEditor; |
60 | class KOTodoEditor ; | 60 | class KOTodoEditor ; |
61 | class KOEventViewerDialog; | 61 | class KOEventViewerDialog; |
62 | class KOBeamPrefs; | 62 | class KOBeamPrefs; |
63 | class KSyncProfile; | 63 | class KSyncProfile; |
64 | class AlarmDialog; | 64 | class AlarmDialog; |
65 | class KCal::Attendee; | 65 | class KCal::Attendee; |
66 | 66 | ||
67 | namespace KCal { class FileStorage; } | 67 | namespace KCal { class FileStorage; } |
68 | 68 | ||
69 | using namespace KCal; | 69 | using namespace KCal; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | This is the main calendar widget. It provides the different vies on t he | 72 | This is the main calendar widget. It provides the different vies on t he |
73 | calendar data as well as the date navigator. It also handles synchronisation | 73 | calendar data as well as the date navigator. It also handles synchronisation |
74 | of the different views and controls the different dialogs like preferences, | 74 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 75 | event editor, search dialog etc. |
76 | 76 | ||
77 | @short main calendar view widget | 77 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 78 | @author Cornelius Schumacher |
79 | */ | 79 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | /** | 84 | /** |
85 | Constructs a new calendar view widget. | 85 | Constructs a new calendar view widget. |
86 | 86 | ||
87 | @param calendar calendar document | 87 | @param calendar calendar document |
88 | @param parent parent window | 88 | @param parent parent window |
89 | @param name Qt internal widget object name | 89 | @param name Qt internal widget object name |
90 | */ | 90 | */ |
91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
92 | const char *name = 0 ); | 92 | const char *name = 0 ); |
93 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 93 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | virtual ~CalendarView(); | 95 | virtual ~CalendarView(); |
96 | 96 | ||
97 | Calendar *calendar() { return mCalendar; } | 97 | Calendar *calendar() { return mCalendar; } |
98 | 98 | ||
99 | KOViewManager *viewManager(); | 99 | KOViewManager *viewManager(); |
100 | KODialogManager *dialogManager(); | 100 | KODialogManager *dialogManager(); |
101 | 101 | ||
102 | QDate startDate(); | 102 | QDate startDate(); |
103 | QDate endDate(); | 103 | QDate endDate(); |
104 | 104 | ||
105 | QWidgetStack *viewStack(); | 105 | QWidgetStack *viewStack(); |
106 | QWidget *leftFrame(); | 106 | QWidget *leftFrame(); |
107 | NavigatorBar *navigatorBar(); | 107 | NavigatorBar *navigatorBar(); |
108 | 108 | ||
109 | DateNavigator *dateNavigator(); | 109 | DateNavigator *dateNavigator(); |
110 | KDateNavigator *dateNavigatorWidget(); | 110 | KDateNavigator *dateNavigatorWidget(); |
111 | 111 | ||
112 | void addView(KOrg::BaseView *); | 112 | void addView(KOrg::BaseView *); |
113 | void showView(KOrg::BaseView *); | 113 | void showView(KOrg::BaseView *); |
114 | KOEventViewerDialog* getEventViewerDialog(); | 114 | KOEventViewerDialog* getEventViewerDialog(); |
115 | Incidence *currentSelection(); | 115 | Incidence *currentSelection(); |
116 | void setupExternSyncProfiles(); | ||
117 | 116 | ||
118 | signals: | 117 | signals: |
119 | /** This todo has been modified */ | 118 | /** This todo has been modified */ |
120 | void todoModified(Todo *, int); | 119 | void todoModified(Todo *, int); |
121 | 120 | ||
122 | /** when change is made to options dialog, the topwidget will catch this | 121 | /** when change is made to options dialog, the topwidget will catch this |
123 | * and emit this signal which notifies all widgets which have registered | 122 | * and emit this signal which notifies all widgets which have registered |
124 | * for notification to update their settings. */ | 123 | * for notification to update their settings. */ |
125 | void configChanged(); | 124 | void configChanged(); |
126 | /** emitted when the topwidget is closing down, so that any attached | 125 | /** emitted when the topwidget is closing down, so that any attached |
127 | child windows can also close. */ | 126 | child windows can also close. */ |
128 | void closingDown(); | 127 | void closingDown(); |
129 | /** emitted right before we die */ | 128 | /** emitted right before we die */ |
130 | void closed(QWidget *); | 129 | void closed(QWidget *); |
131 | 130 | ||
132 | /** Emitted when state of modified flag changes */ | 131 | /** Emitted when state of modified flag changes */ |
133 | void modifiedChanged(bool); | 132 | void modifiedChanged(bool); |
134 | void signalmodified(); | 133 | void signalmodified(); |
135 | 134 | ||
136 | /** Emitted when state of read-only flag changes */ | 135 | /** Emitted when state of read-only flag changes */ |
137 | void readOnlyChanged(bool); | 136 | void readOnlyChanged(bool); |
138 | 137 | ||
139 | /** Emitted when the unit of navigation changes */ | 138 | /** Emitted when the unit of navigation changes */ |
140 | void changeNavStringPrev(const QString &); | 139 | void changeNavStringPrev(const QString &); |
141 | void changeNavStringNext(const QString &); | 140 | void changeNavStringNext(const QString &); |
142 | 141 | ||
143 | /** Emitted when state of events selection has changed and user is organizer*/ | 142 | /** Emitted when state of events selection has changed and user is organizer*/ |
144 | void organizerEventsSelected(bool); | 143 | void organizerEventsSelected(bool); |
145 | /** Emitted when state of events selection has changed and user is attendee*/ | 144 | /** Emitted when state of events selection has changed and user is attendee*/ |
146 | void groupEventsSelected(bool); | 145 | void groupEventsSelected(bool); |
147 | /** | 146 | /** |
148 | Emitted when an incidence gets selected. If the selection is cleared the | 147 | Emitted when an incidence gets selected. If the selection is cleared the |
149 | signal is emitted with 0 as argument. | 148 | signal is emitted with 0 as argument. |
150 | */ | 149 | */ |
151 | void incidenceSelected( Incidence * ); | 150 | void incidenceSelected( Incidence * ); |
152 | /** Emitted, when a todoitem is selected or deselected. */ | 151 | /** Emitted, when a todoitem is selected or deselected. */ |
153 | void todoSelected( bool ); | 152 | void todoSelected( bool ); |
154 | 153 | ||
155 | /** | 154 | /** |
156 | Emitted, when clipboard content changes. Parameter indicates if paste | 155 | Emitted, when clipboard content changes. Parameter indicates if paste |
157 | is possible or not. | 156 | is possible or not. |
158 | */ | 157 | */ |
159 | void pasteEnabled(bool); | 158 | void pasteEnabled(bool); |
160 | 159 | ||
161 | /** Emitted, when the number of incoming messages has changed. */ | 160 | /** Emitted, when the number of incoming messages has changed. */ |
162 | void numIncomingChanged(int); | 161 | void numIncomingChanged(int); |
163 | 162 | ||
164 | /** Emitted, when the number of outgoing messages has changed. */ | 163 | /** Emitted, when the number of outgoing messages has changed. */ |
165 | void numOutgoingChanged(int); | 164 | void numOutgoingChanged(int); |
166 | 165 | ||
167 | /** Send status message, which can e.g. be displayed in the status bar. */ | 166 | /** Send status message, which can e.g. be displayed in the status bar. */ |
168 | void statusMessage(const QString &); | 167 | void statusMessage(const QString &); |
169 | 168 | ||
170 | void calendarViewExpanded( bool ); | 169 | void calendarViewExpanded( bool ); |
171 | void updateSearchDialog(); | 170 | void updateSearchDialog(); |
172 | 171 | ||
173 | 172 | ||
174 | public slots: | 173 | public slots: |
175 | void showOpenError(); | 174 | void showOpenError(); |
176 | void watchSavedFile(); | 175 | void watchSavedFile(); |
177 | void recheckTimerAlarm(); | 176 | void recheckTimerAlarm(); |
178 | void checkNextTimerAlarm(); | 177 | void checkNextTimerAlarm(); |
179 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 178 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
180 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 179 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
181 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 180 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
182 | 181 | ||
183 | /** options dialog made a changed to the configuration. we catch this | 182 | /** options dialog made a changed to the configuration. we catch this |
184 | * and notify all widgets which need to update their configuration. */ | 183 | * and notify all widgets which need to update their configuration. */ |
185 | void updateConfig(); | 184 | void updateConfig(); |
186 | 185 | ||
187 | /** | 186 | /** |
188 | Load calendar from file \a filename. If \a merge is true, load | 187 | Load calendar from file \a filename. If \a merge is true, load |
189 | calendar into existing one, if it is false, clear calendar, before | 188 | calendar into existing one, if it is false, clear calendar, before |
190 | loading. Return true, if calendar could be successfully loaded. | 189 | loading. Return true, if calendar could be successfully loaded. |
191 | */ | 190 | */ |
192 | bool openCalendar(QString filename, bool merge=false); | 191 | bool openCalendar(QString filename, bool merge=false); |
193 | bool syncCalendar(QString filename,int mode = 0 ); | 192 | bool syncCalendar(QString filename,int mode = 0 ); |
194 | 193 | ||
195 | /** | 194 | /** |
196 | Save calendar data to file. Return true if calendar could be | 195 | Save calendar data to file. Return true if calendar could be |
197 | successfully saved. | 196 | successfully saved. |
198 | */ | 197 | */ |
199 | bool saveCalendar(QString filename); | 198 | bool saveCalendar(QString filename); |
200 | 199 | ||
201 | /** | 200 | /** |
202 | Close calendar. Clear calendar data and reset views to display an empty | 201 | Close calendar. Clear calendar data and reset views to display an empty |
203 | calendar. | 202 | calendar. |
204 | */ | 203 | */ |
205 | void closeCalendar(); | 204 | void closeCalendar(); |
206 | 205 | ||
207 | /** Archive old events of calendar */ | 206 | /** Archive old events of calendar */ |
208 | void archiveCalendar(); | 207 | void archiveCalendar(); |
209 | 208 | ||
210 | void showIncidence(); | 209 | void showIncidence(); |
211 | void editIncidence(); | 210 | void editIncidence(); |
212 | void editIncidenceDescription(); | 211 | void editIncidenceDescription(); |
213 | void deleteIncidence(); | 212 | void deleteIncidence(); |
214 | void cloneIncidence(); | 213 | void cloneIncidence(); |
215 | void moveIncidence(); | 214 | void moveIncidence(); |
216 | void beamIncidence(); | 215 | void beamIncidence(); |
217 | void toggleCancelIncidence(); | 216 | void toggleCancelIncidence(); |
218 | 217 | ||
219 | /** create an editeventwin with supplied date/time, and if bool is true, | 218 | /** create an editeventwin with supplied date/time, and if bool is true, |
220 | * make the event take all day. */ | 219 | * make the event take all day. */ |
221 | void newEvent(QDateTime, QDateTime, bool allDay = false); | 220 | void newEvent(QDateTime, QDateTime, bool allDay = false); |
222 | void newEvent(QDateTime fh); | 221 | void newEvent(QDateTime fh); |
223 | void newEvent(QDate dt); | 222 | void newEvent(QDate dt); |
224 | /** create new event without having a date hint. Takes current date as | 223 | /** create new event without having a date hint. Takes current date as |
225 | default hint. */ | 224 | default hint. */ |
226 | void newEvent(); | 225 | void newEvent(); |
227 | void newFloatingEvent(); | 226 | void newFloatingEvent(); |
228 | 227 | ||
229 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 228 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
230 | void showIncidence(Incidence *); | 229 | void showIncidence(Incidence *); |
231 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 230 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
232 | void editIncidence(Incidence *); | 231 | void editIncidence(Incidence *); |
233 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 232 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
234 | void deleteIncidence(Incidence *); | 233 | void deleteIncidence(Incidence *); |
235 | void cloneIncidence(Incidence *); | 234 | void cloneIncidence(Incidence *); |
236 | void cancelIncidence(Incidence *); | 235 | void cancelIncidence(Incidence *); |
237 | /** Create an editor for the supplied event. */ | 236 | /** Create an editor for the supplied event. */ |
238 | void editEvent(Event *); | 237 | void editEvent(Event *); |
239 | /** Delete the supplied event. */ | 238 | /** Delete the supplied event. */ |
240 | void deleteEvent(Event *); | 239 | void deleteEvent(Event *); |
241 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 240 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
242 | found. */ | 241 | found. */ |
243 | bool deleteEvent(const QString &uid); | 242 | bool deleteEvent(const QString &uid); |
244 | /** Create a read-only viewer dialog for the supplied event. */ | 243 | /** Create a read-only viewer dialog for the supplied event. */ |
245 | void showEvent(Event *); | 244 | void showEvent(Event *); |
246 | 245 | ||
247 | void editJournal(Journal *); | 246 | void editJournal(Journal *); |
248 | void showJournal(Journal *); | 247 | void showJournal(Journal *); |
249 | void deleteJournal(Journal *); | 248 | void deleteJournal(Journal *); |
250 | /** Create an editor dialog for a todo */ | 249 | /** Create an editor dialog for a todo */ |
251 | void editTodo(Todo *); | 250 | void editTodo(Todo *); |
252 | /** Create a read-only viewer dialog for the supplied todo */ | 251 | /** Create a read-only viewer dialog for the supplied todo */ |
253 | void showTodo(Todo *); | 252 | void showTodo(Todo *); |
254 | /** create new todo */ | 253 | /** create new todo */ |
255 | void newTodo(); | 254 | void newTodo(); |
256 | /** create new todo with a parent todo */ | 255 | /** create new todo with a parent todo */ |
257 | void newSubTodo(); | 256 | void newSubTodo(); |
258 | /** create new todo with a parent todo */ | 257 | /** create new todo with a parent todo */ |
259 | void newSubTodo(Todo *); | 258 | void newSubTodo(Todo *); |
260 | /** Delete todo */ | 259 | /** Delete todo */ |
261 | void deleteTodo(Todo *); | 260 | void deleteTodo(Todo *); |
262 | 261 | ||
263 | 262 | ||
264 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 263 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
265 | * emitted as result. */ | 264 | * emitted as result. */ |
266 | void checkClipboard(); | 265 | void checkClipboard(); |
267 | 266 | ||
268 | /** using the KConfig associated with the kapp variable, read in the | 267 | /** using the KConfig associated with the kapp variable, read in the |
269 | * settings from the config file. | 268 | * settings from the config file. |
270 | */ | 269 | */ |
271 | void readSettings(); | 270 | void readSettings(); |
272 | 271 | ||
273 | /** write current state to config file. */ | 272 | /** write current state to config file. */ |
274 | void writeSettings(); | 273 | void writeSettings(); |
275 | 274 | ||
276 | /** read settings for calendar filters */ | 275 | /** read settings for calendar filters */ |
277 | void readFilterSettings(KConfig *config); | 276 | void readFilterSettings(KConfig *config); |
278 | 277 | ||
279 | /** write settings for calendar filters */ | 278 | /** write settings for calendar filters */ |
280 | void writeFilterSettings(KConfig *config); | 279 | void writeFilterSettings(KConfig *config); |
281 | 280 | ||
282 | /** passes on the message that an event has changed to the currently | 281 | /** passes on the message that an event has changed to the currently |
283 | * activated view so that it can make appropriate display changes. */ | 282 | * activated view so that it can make appropriate display changes. */ |
284 | void changeEventDisplay(Event *, int); | 283 | void changeEventDisplay(Event *, int); |
285 | void changeIncidenceDisplay(Incidence *, int); | 284 | void changeIncidenceDisplay(Incidence *, int); |
286 | void changeTodoDisplay(Todo *, int); | 285 | void changeTodoDisplay(Todo *, int); |
287 | 286 | ||
288 | void eventAdded(Event *); | 287 | void eventAdded(Event *); |
289 | void eventChanged(Event *); | 288 | void eventChanged(Event *); |
290 | void eventToBeDeleted(Event *); | 289 | void eventToBeDeleted(Event *); |
291 | void eventDeleted(); | 290 | void eventDeleted(); |
292 | 291 | ||
293 | void todoAdded(Todo *); | 292 | void todoAdded(Todo *); |
294 | void todoChanged(Todo *); | 293 | void todoChanged(Todo *); |
295 | void todoToBeDeleted(Todo *); | 294 | void todoToBeDeleted(Todo *); |
296 | void todoDeleted(); | 295 | void todoDeleted(); |
297 | 296 | ||
298 | void updateView(const QDate &start, const QDate &end); | 297 | void updateView(const QDate &start, const QDate &end); |
299 | void updateView(); | 298 | void updateView(); |
300 | 299 | ||
301 | /** Full update of visible todo views */ | 300 | /** Full update of visible todo views */ |
302 | void updateTodoViews(); | 301 | void updateTodoViews(); |
303 | 302 | ||
304 | void updateUnmanagedViews(); | 303 | void updateUnmanagedViews(); |
305 | 304 | ||
306 | /** cut the current appointment to the clipboard */ | 305 | /** cut the current appointment to the clipboard */ |
307 | void edit_cut(); | 306 | void edit_cut(); |
308 | 307 | ||
309 | /** copy the current appointment(s) to the clipboard */ | 308 | /** copy the current appointment(s) to the clipboard */ |
310 | void edit_copy(); | 309 | void edit_copy(); |
311 | 310 | ||
312 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 311 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
313 | void edit_paste(); | 312 | void edit_paste(); |
314 | 313 | ||
315 | /** edit viewing and configuration options. */ | 314 | /** edit viewing and configuration options. */ |
316 | void edit_options(); | 315 | void edit_options(); |
317 | void edit_sync_options(); | 316 | void edit_sync_options(); |
318 | /** | 317 | /** |
319 | Functions for printing, previewing a print, and setting up printing | 318 | Functions for printing, previewing a print, and setting up printing |
320 | parameters. | 319 | parameters. |
321 | */ | 320 | */ |
322 | void print(); | 321 | void print(); |
323 | void printSetup(); | 322 | void printSetup(); |
324 | void printPreview(); | 323 | void printPreview(); |
325 | 324 | ||
326 | /** Export as iCalendar file */ | 325 | /** Export as iCalendar file */ |
327 | void exportICalendar(); | 326 | void exportICalendar(); |
328 | 327 | ||
329 | /** Export as vCalendar file */ | 328 | /** Export as vCalendar file */ |
330 | bool exportVCalendar( QString fn); | 329 | bool exportVCalendar( QString fn); |
331 | 330 | ||
332 | /** pop up a dialog to show an existing appointment. */ | 331 | /** pop up a dialog to show an existing appointment. */ |
333 | void appointment_show(); | 332 | void appointment_show(); |
334 | /** | 333 | /** |
335 | * pop up an Appointment Dialog to edit an existing appointment.Get | 334 | * pop up an Appointment Dialog to edit an existing appointment.Get |
336 | * information on the appointment from the list of unique IDs that is | 335 | * information on the appointment from the list of unique IDs that is |
337 | * currently in the View, called currIds. | 336 | * currently in the View, called currIds. |
338 | */ | 337 | */ |
339 | void appointment_edit(); | 338 | void appointment_edit(); |
340 | /** | 339 | /** |
341 | * pop up dialog confirming deletion of currently selected event in the | 340 | * pop up dialog confirming deletion of currently selected event in the |
342 | * View. | 341 | * View. |
343 | */ | 342 | */ |
344 | void appointment_delete(); | 343 | void appointment_delete(); |
345 | 344 | ||
346 | /** mails the currently selected event to a particular user as a vCalendar | 345 | /** mails the currently selected event to a particular user as a vCalendar |
347 | attachment. */ | 346 | attachment. */ |
348 | void action_mail(); | 347 | void action_mail(); |
349 | 348 | ||
350 | /* frees a subtodo from it's relation */ | 349 | /* frees a subtodo from it's relation */ |
351 | void todo_unsub( Todo * ); | 350 | void todo_unsub( Todo * ); |
352 | 351 | ||
353 | /** Take ownership of selected event. */ | 352 | /** Take ownership of selected event. */ |
354 | void takeOverEvent(); | 353 | void takeOverEvent(); |
355 | 354 | ||
356 | /** Take ownership of all events in calendar. */ | 355 | /** Take ownership of all events in calendar. */ |
357 | void takeOverCalendar(); | 356 | void takeOverCalendar(); |
358 | 357 | ||
359 | /** query whether or not the calendar is "dirty". */ | 358 | /** query whether or not the calendar is "dirty". */ |
360 | bool isModified(); | 359 | bool isModified(); |
361 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 360 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
362 | void setModified(bool modified=true); | 361 | void setModified(bool modified=true); |
363 | 362 | ||
364 | /** query if the calendar is read-only. */ | 363 | /** query if the calendar is read-only. */ |
365 | bool isReadOnly(); | 364 | bool isReadOnly(); |
366 | /** set state of calendar to read-only */ | 365 | /** set state of calendar to read-only */ |
367 | void setReadOnly(bool readOnly=true); | 366 | void setReadOnly(bool readOnly=true); |
368 | 367 | ||
369 | void eventUpdated(Incidence *); | 368 | void eventUpdated(Incidence *); |
370 | 369 | ||
371 | /* iTIP scheduling actions */ | 370 | /* iTIP scheduling actions */ |
372 | void schedule_publish(Incidence *incidence = 0); | 371 | void schedule_publish(Incidence *incidence = 0); |
373 | void schedule_request(Incidence *incidence = 0); | 372 | void schedule_request(Incidence *incidence = 0); |
374 | void schedule_refresh(Incidence *incidence = 0); | 373 | void schedule_refresh(Incidence *incidence = 0); |
375 | void schedule_cancel(Incidence *incidence = 0); | 374 | void schedule_cancel(Incidence *incidence = 0); |
376 | void schedule_add(Incidence *incidence = 0); | 375 | void schedule_add(Incidence *incidence = 0); |
377 | void schedule_reply(Incidence *incidence = 0); | 376 | void schedule_reply(Incidence *incidence = 0); |
378 | void schedule_counter(Incidence *incidence = 0); | 377 | void schedule_counter(Incidence *incidence = 0); |
379 | void schedule_declinecounter(Incidence *incidence = 0); | 378 | void schedule_declinecounter(Incidence *incidence = 0); |
380 | void schedule_publish_freebusy(int daysToPublish = 30); | 379 | void schedule_publish_freebusy(int daysToPublish = 30); |
381 | 380 | ||
382 | void openAddressbook(); | 381 | void openAddressbook(); |
383 | 382 | ||
384 | void editFilters(); | 383 | void editFilters(); |
385 | void toggleFilerEnabled(); | 384 | void toggleFilerEnabled(); |
386 | QPtrList<CalFilter> filters(); | 385 | QPtrList<CalFilter> filters(); |
387 | void toggleFilter(); | 386 | void toggleFilter(); |
388 | void showFilter(bool visible); | 387 | void showFilter(bool visible); |
389 | void updateFilter(); | 388 | void updateFilter(); |
390 | void filterEdited(); | 389 | void filterEdited(); |
391 | void selectFilter( int ); | 390 | void selectFilter( int ); |
392 | KOFilterView *filterView(); | 391 | KOFilterView *filterView(); |
393 | 392 | ||
394 | void showIntro(); | 393 | void showIntro(); |
395 | 394 | ||
396 | /** Move the curdatepient view date to today */ | 395 | /** Move the curdatepient view date to today */ |
397 | void goToday(); | 396 | void goToday(); |
398 | 397 | ||
399 | /** Move to the next date(s) in the current view */ | 398 | /** Move to the next date(s) in the current view */ |
400 | void goNext(); | 399 | void goNext(); |
401 | 400 | ||
402 | /** Move to the previous date(s) in the current view */ | 401 | /** Move to the previous date(s) in the current view */ |
403 | void goPrevious(); | 402 | void goPrevious(); |
404 | /** Move to the next date(s) in the current view */ | 403 | /** Move to the next date(s) in the current view */ |
405 | void goNextMonth(); | 404 | void goNextMonth(); |
406 | 405 | ||
407 | /** Move to the previous date(s) in the current view */ | 406 | /** Move to the previous date(s) in the current view */ |
408 | void goPreviousMonth(); | 407 | void goPreviousMonth(); |
409 | 408 | ||
410 | void toggleExpand(); | 409 | void toggleExpand(); |
411 | void toggleDateNavigatorWidget(); | 410 | void toggleDateNavigatorWidget(); |
412 | void toggleAllDaySize(); | 411 | void toggleAllDaySize(); |
413 | void dialogClosing(Incidence *); | 412 | void dialogClosing(Incidence *); |
414 | 413 | ||
415 | /** Look for new messages in the inbox */ | 414 | /** Look for new messages in the inbox */ |
416 | void lookForIncomingMessages(); | 415 | void lookForIncomingMessages(); |
417 | /** Look for new messages in the outbox */ | 416 | /** Look for new messages in the outbox */ |
418 | void lookForOutgoingMessages(); | 417 | void lookForOutgoingMessages(); |
419 | 418 | ||
420 | void processMainViewSelection( Incidence * ); | 419 | void processMainViewSelection( Incidence * ); |
421 | void processTodoListSelection( Incidence * ); | 420 | void processTodoListSelection( Incidence * ); |
422 | 421 | ||
423 | void processIncidenceSelection( Incidence * ); | 422 | void processIncidenceSelection( Incidence * ); |
424 | 423 | ||
425 | void purgeCompleted(); | 424 | void purgeCompleted(); |
426 | bool removeCompletedSubTodos( Todo* ); | 425 | bool removeCompletedSubTodos( Todo* ); |
427 | void slotCalendarChanged(); | 426 | void slotCalendarChanged(); |
428 | bool importBday(); | 427 | bool importBday(); |
429 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 428 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
430 | bool importQtopia( const QString &categoriesFile, | 429 | bool importQtopia( const QString &categoriesFile, |
431 | const QString &datebookFile, | 430 | const QString &datebookFile, |
432 | const QString &tasklistFile ); | 431 | const QString &tasklistFile ); |
433 | void syncSharp( ); | 432 | void syncSharp( ); |
434 | void syncPhone( ); | 433 | void syncPhone( ); |
435 | void syncExternal( int mode ); | 434 | void syncExternal( int mode ); |
436 | void slotSelectPickerDate( QDate ) ; | 435 | void slotSelectPickerDate( QDate ) ; |
437 | void showDatePicker( ) ; | 436 | void showDatePicker( ) ; |
438 | void moveIncidence(Incidence *) ; | 437 | void moveIncidence(Incidence *) ; |
439 | void beamIncidence(Incidence *) ; | 438 | void beamIncidence(Incidence *) ; |
440 | void beamCalendar() ; | 439 | void beamCalendar() ; |
441 | void beamFilteredCalendar() ; | 440 | void beamFilteredCalendar() ; |
442 | void beamIncidenceList(QPtrList<Incidence>) ; | 441 | void beamIncidenceList(QPtrList<Incidence>) ; |
443 | void manageCategories(); | 442 | void manageCategories(); |
444 | int addCategories(); | 443 | int addCategories(); |
445 | void removeCategories(); | 444 | void removeCategories(); |
446 | void setSyncDevice( QString ); | 445 | void setSyncDevice( QString ); |
447 | void setSyncName( QString ); | 446 | void setSyncName( QString ); |
448 | protected slots: | 447 | protected slots: |
449 | void timerAlarm(); | 448 | void timerAlarm(); |
450 | void suspendAlarm(); | 449 | void suspendAlarm(); |
451 | void beamDone( Ir *ir ); | 450 | void beamDone( Ir *ir ); |
452 | /** Select a view or adapt the current view to display the specified dates. */ | 451 | /** Select a view or adapt the current view to display the specified dates. */ |
453 | void showDates( const KCal::DateList & ); | 452 | void showDates( const KCal::DateList & ); |
454 | void selectWeekNum ( int ); | 453 | void selectWeekNum ( int ); |
455 | 454 | ||
456 | public: | 455 | public: |
457 | // show a standard warning | 456 | // show a standard warning |
458 | // returns KMsgBox::yesNoCancel() | 457 | // returns KMsgBox::yesNoCancel() |
459 | int msgCalModified(); | 458 | int msgCalModified(); |
460 | void confSync(); | 459 | void confSync(); |
461 | void setLoadedFileVersion(QDateTime); | 460 | void setLoadedFileVersion(QDateTime); |
462 | bool checkFileVersion(QString fn); | 461 | bool checkFileVersion(QString fn); |
463 | bool checkFileChanged(QString fn); | 462 | bool checkFileChanged(QString fn); |
464 | Event* getLastSyncEvent(); | 463 | Event* getLastSyncEvent(); |
465 | /** Adapt navigation units correpsonding to step size of navigation of the | 464 | /** Adapt navigation units correpsonding to step size of navigation of the |
466 | * current view. | 465 | * current view. |
467 | */ | 466 | */ |
468 | void adaptNavigationUnits(); | 467 | void adaptNavigationUnits(); |
469 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 468 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
470 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 469 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
471 | //Attendee* getYourAttendee(Event *event); | 470 | //Attendee* getYourAttendee(Event *event); |
472 | protected: | 471 | protected: |
473 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 472 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
474 | 473 | ||
475 | // returns KMsgBox::OKCandel() | 474 | // returns KMsgBox::OKCandel() |
476 | int msgItemDelete(); | 475 | int msgItemDelete(); |
477 | void showEventEditor(); | 476 | void showEventEditor(); |
478 | void showTodoEditor(); | 477 | void showTodoEditor(); |
479 | void writeLocale(); | 478 | void writeLocale(); |
480 | Todo *selectedTodo(); | 479 | Todo *selectedTodo(); |
481 | 480 | ||
482 | private: | 481 | private: |
483 | AlarmDialog * mAlarmDialog; | 482 | AlarmDialog * mAlarmDialog; |
484 | QString mAlarmNotification; | 483 | QString mAlarmNotification; |
485 | QString mSuspendAlarmNotification; | 484 | QString mSuspendAlarmNotification; |
486 | QTimer* mSuspendTimer; | 485 | QTimer* mSuspendTimer; |
487 | QTimer* mAlarmTimer; | 486 | QTimer* mAlarmTimer; |
488 | QTimer* mRecheckAlarmTimer; | 487 | QTimer* mRecheckAlarmTimer; |
489 | void computeAlarm( QString ); | 488 | void computeAlarm( QString ); |
490 | void startAlarm( QString, QString ); | 489 | void startAlarm( QString, QString ); |
491 | void setSyncEventsReadOnly(); | 490 | void setSyncEventsReadOnly(); |
492 | 491 | ||
493 | QDateTime loadedFileVersion; | 492 | QDateTime loadedFileVersion; |
494 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 493 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
495 | void checkExternalId( Incidence * inc ); | 494 | void checkExternalId( Incidence * inc ); |
496 | int mGlobalSyncMode; | 495 | int mGlobalSyncMode; |
497 | QString mCurrentSyncDevice; | 496 | QString mCurrentSyncDevice; |
498 | QString mCurrentSyncName; | 497 | QString mCurrentSyncName; |
499 | KOBeamPrefs* beamDialog; | 498 | KOBeamPrefs* beamDialog; |
500 | void init(); | 499 | void init(); |
501 | int mDatePickerMode; | 500 | int mDatePickerMode; |
502 | bool mFlagEditDescription; | 501 | bool mFlagEditDescription; |
503 | QDateTime mLastCalendarSync; | 502 | QDateTime mLastCalendarSync; |
504 | void createPrinter(); | 503 | void createPrinter(); |
505 | 504 | ||
506 | void calendarModified( bool, Calendar * ); | 505 | void calendarModified( bool, Calendar * ); |
507 | 506 | ||
508 | CalPrinter *mCalPrinter; | 507 | CalPrinter *mCalPrinter; |
509 | 508 | ||
510 | QSplitter *mPanner; | 509 | QSplitter *mPanner; |
511 | QSplitter *mLeftSplitter; | 510 | QSplitter *mLeftSplitter; |
512 | QWidget *mLeftFrame; | 511 | QWidget *mLeftFrame; |
513 | QWidgetStack *mRightFrame; | 512 | QWidgetStack *mRightFrame; |
514 | 513 | ||
515 | KDatePicker* mDatePicker; | 514 | KDatePicker* mDatePicker; |
516 | QVBox* mDateFrame; | 515 | QVBox* mDateFrame; |
517 | NavigatorBar *mNavigatorBar; | 516 | NavigatorBar *mNavigatorBar; |
518 | 517 | ||
519 | KDateNavigator *mDateNavigator; // widget showing small month view. | 518 | KDateNavigator *mDateNavigator; // widget showing small month view. |
520 | 519 | ||
521 | KOFilterView *mFilterView; | 520 | KOFilterView *mFilterView; |
522 | 521 | ||
523 | ResourceView *mResourceView; | 522 | ResourceView *mResourceView; |
524 | 523 | ||
525 | // calendar object for this viewing instance | 524 | // calendar object for this viewing instance |
526 | Calendar *mCalendar; | 525 | Calendar *mCalendar; |
527 | 526 | ||
528 | CalendarResourceManager *mResourceManager; | 527 | CalendarResourceManager *mResourceManager; |
529 | 528 | ||
530 | FileStorage *mStorage; | 529 | FileStorage *mStorage; |
531 | 530 | ||
532 | DateNavigator *mNavigator; | 531 | DateNavigator *mNavigator; |
533 | 532 | ||
534 | KOViewManager *mViewManager; | 533 | KOViewManager *mViewManager; |
535 | KODialogManager *mDialogManager; | 534 | KODialogManager *mDialogManager; |
536 | 535 | ||
537 | // Calendar filters | 536 | // Calendar filters |
538 | QPtrList<CalFilter> mFilters; | 537 | QPtrList<CalFilter> mFilters; |
539 | 538 | ||
540 | // various housekeeping variables. | 539 | // various housekeeping variables. |
541 | bool mModified; // flag indicating if calendar is modified | 540 | bool mModified; // flag indicating if calendar is modified |
542 | bool mReadOnly; // flag indicating if calendar is read-only | 541 | bool mReadOnly; // flag indicating if calendar is read-only |
543 | QDate mSaveSingleDate; | 542 | QDate mSaveSingleDate; |
544 | 543 | ||
545 | Incidence *mSelectedIncidence; | 544 | Incidence *mSelectedIncidence; |
546 | Incidence *mMoveIncidence; | 545 | Incidence *mMoveIncidence; |
547 | QPtrList<Event> mExternLastSyncEvent; | ||
548 | KOTodoView *mTodoList; | 546 | KOTodoView *mTodoList; |
549 | KOEventEditor * mEventEditor; | 547 | KOEventEditor * mEventEditor; |
550 | KOTodoEditor * mTodoEditor; | 548 | KOTodoEditor * mTodoEditor; |
551 | KOEventViewerDialog * mEventViewerDialog; | 549 | KOEventViewerDialog * mEventViewerDialog; |
552 | void keyPressEvent ( QKeyEvent *e) ; | 550 | void keyPressEvent ( QKeyEvent *e) ; |
553 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 551 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
554 | }; | 552 | }; |
555 | 553 | ||
556 | 554 | ||
557 | class CalendarViewVisitor : public Incidence::Visitor | 555 | class CalendarViewVisitor : public Incidence::Visitor |
558 | { | 556 | { |
559 | public: | 557 | public: |
560 | CalendarViewVisitor() : mView( 0 ) {} | 558 | CalendarViewVisitor() : mView( 0 ) {} |
561 | 559 | ||
562 | bool act( Incidence *incidence, CalendarView *view ) | 560 | bool act( Incidence *incidence, CalendarView *view ) |
563 | { | 561 | { |
564 | mView = view; | 562 | mView = view; |
565 | return incidence->accept( *this ); | 563 | return incidence->accept( *this ); |
566 | } | 564 | } |
567 | 565 | ||
568 | protected: | 566 | protected: |
569 | CalendarView *mView; | 567 | CalendarView *mView; |
570 | }; | 568 | }; |
571 | 569 | ||
572 | class ShowIncidenceVisitor : public CalendarViewVisitor | 570 | class ShowIncidenceVisitor : public CalendarViewVisitor |
573 | { | 571 | { |
574 | protected: | 572 | protected: |
575 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 573 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
576 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 574 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
577 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 575 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
578 | }; | 576 | }; |
579 | 577 | ||
580 | class EditIncidenceVisitor : public CalendarViewVisitor | 578 | class EditIncidenceVisitor : public CalendarViewVisitor |
581 | { | 579 | { |
582 | protected: | 580 | protected: |
583 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 581 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
584 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 582 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
585 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 583 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
586 | }; | 584 | }; |
587 | 585 | ||
588 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 586 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
589 | { | 587 | { |
590 | protected: | 588 | protected: |
591 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 589 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
592 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 590 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
593 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 591 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
594 | }; | 592 | }; |
595 | 593 | ||
596 | #endif | 594 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ec69b11..9104347 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -737,513 +737,512 @@ void MainWindow::initActions() | |||
737 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 737 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
738 | 738 | ||
739 | importMenu->insertSeparator(); | 739 | importMenu->insertSeparator(); |
740 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 740 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
741 | this ); | 741 | this ); |
742 | action->addTo( importMenu ); | 742 | action->addTo( importMenu ); |
743 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 743 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
744 | #ifndef DESKTOP_VERSION | 744 | #ifndef DESKTOP_VERSION |
745 | importMenu->insertSeparator(); | 745 | importMenu->insertSeparator(); |
746 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 746 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
747 | this ); | 747 | this ); |
748 | action->addTo( importMenu ); | 748 | action->addTo( importMenu ); |
749 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 749 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
750 | 750 | ||
751 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 751 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
752 | this ); | 752 | this ); |
753 | action->addTo( importMenu ); | 753 | action->addTo( importMenu ); |
754 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 754 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
755 | #else | 755 | #else |
756 | importMenu->insertSeparator(); | 756 | importMenu->insertSeparator(); |
757 | icon = loadPixmap( pathString + "print" ); | 757 | icon = loadPixmap( pathString + "print" ); |
758 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 758 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
759 | action->addTo( importMenu ); | 759 | action->addTo( importMenu ); |
760 | connect( action, SIGNAL( activated() ), | 760 | connect( action, SIGNAL( activated() ), |
761 | this, SLOT( printCal() ) ); | 761 | this, SLOT( printCal() ) ); |
762 | 762 | ||
763 | icon = loadPixmap( pathString + "print" ); | 763 | icon = loadPixmap( pathString + "print" ); |
764 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 764 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
765 | action->addTo( importMenu ); | 765 | action->addTo( importMenu ); |
766 | connect( action, SIGNAL( activated() ), | 766 | connect( action, SIGNAL( activated() ), |
767 | this, SLOT( printSel() ) ); | 767 | this, SLOT( printSel() ) ); |
768 | #endif | 768 | #endif |
769 | importMenu->insertSeparator(); | 769 | importMenu->insertSeparator(); |
770 | action = new QAction( "beam all", i18n("Save"), 0, | 770 | action = new QAction( "beam all", i18n("Save"), 0, |
771 | this ); | 771 | this ); |
772 | action->addTo( importMenu ); | 772 | action->addTo( importMenu ); |
773 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 773 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
774 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 774 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
775 | this ); | 775 | this ); |
776 | action->addTo( importMenu ); | 776 | action->addTo( importMenu ); |
777 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 777 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
778 | 778 | ||
779 | //menuBar->insertItem( "Configure",configureMenu ); | 779 | //menuBar->insertItem( "Configure",configureMenu ); |
780 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 780 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
781 | icon = loadPixmap( "korganizer/korganizer" ); | 781 | icon = loadPixmap( "korganizer/korganizer" ); |
782 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 782 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
783 | action->addTo( helpMenu ); | 783 | action->addTo( helpMenu ); |
784 | connect( action, SIGNAL( activated() ), | 784 | connect( action, SIGNAL( activated() ), |
785 | SLOT( keyBindings() ) ); | 785 | SLOT( keyBindings() ) ); |
786 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 786 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
787 | action->addTo( helpMenu ); | 787 | action->addTo( helpMenu ); |
788 | connect( action, SIGNAL( activated() ), | 788 | connect( action, SIGNAL( activated() ), |
789 | SLOT( features() ) ); | 789 | SLOT( features() ) ); |
790 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 790 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
791 | action->addTo( helpMenu ); | 791 | action->addTo( helpMenu ); |
792 | connect( action, SIGNAL( activated() ), | 792 | connect( action, SIGNAL( activated() ), |
793 | SLOT( aboutAutoSaving() ) ); | 793 | SLOT( aboutAutoSaving() ) ); |
794 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 794 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
795 | action->addTo( helpMenu ); | 795 | action->addTo( helpMenu ); |
796 | connect( action, SIGNAL( activated() ), | 796 | connect( action, SIGNAL( activated() ), |
797 | SLOT( aboutKnownBugs() ) ); | 797 | SLOT( aboutKnownBugs() ) ); |
798 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 798 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
799 | action->addTo( helpMenu ); | 799 | action->addTo( helpMenu ); |
800 | connect( action, SIGNAL( activated() ), | 800 | connect( action, SIGNAL( activated() ), |
801 | SLOT( usertrans() ) ); | 801 | SLOT( usertrans() ) ); |
802 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 802 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
803 | action->addTo( helpMenu ); | 803 | action->addTo( helpMenu ); |
804 | connect( action, SIGNAL( activated() ), | 804 | connect( action, SIGNAL( activated() ), |
805 | SLOT( synchowto() ) ); | 805 | SLOT( synchowto() ) ); |
806 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 806 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
807 | action->addTo( helpMenu ); | 807 | action->addTo( helpMenu ); |
808 | connect( action, SIGNAL( activated() ), | 808 | connect( action, SIGNAL( activated() ), |
809 | SLOT( whatsNew() ) ); | 809 | SLOT( whatsNew() ) ); |
810 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 810 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
811 | action->addTo( helpMenu ); | 811 | action->addTo( helpMenu ); |
812 | connect( action, SIGNAL( activated() ), | 812 | connect( action, SIGNAL( activated() ), |
813 | SLOT( faq() ) ); | 813 | SLOT( faq() ) ); |
814 | 814 | ||
815 | 815 | ||
816 | action = new QAction( "about", i18n("About..."), 0, this ); | 816 | action = new QAction( "about", i18n("About..."), 0, this ); |
817 | action->addTo( helpMenu ); | 817 | action->addTo( helpMenu ); |
818 | connect( action, SIGNAL( activated() ), | 818 | connect( action, SIGNAL( activated() ), |
819 | SLOT( about() ) ); | 819 | SLOT( about() ) ); |
820 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 820 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
821 | action->addTo( helpMenu ); | 821 | action->addTo( helpMenu ); |
822 | connect( action, SIGNAL( activated() ), | 822 | connect( action, SIGNAL( activated() ), |
823 | SLOT( licence() ) ); | 823 | SLOT( licence() ) ); |
824 | //menuBar->insertSeparator(); | 824 | //menuBar->insertSeparator(); |
825 | 825 | ||
826 | // ****************************************************** | 826 | // ****************************************************** |
827 | // menubar icons | 827 | // menubar icons |
828 | 828 | ||
829 | 829 | ||
830 | iconToolBar->setHorizontalStretchable (true ); | 830 | iconToolBar->setHorizontalStretchable (true ); |
831 | //menuBar->insertItem( iconToolBar ); | 831 | //menuBar->insertItem( iconToolBar ); |
832 | //xdays_action | 832 | //xdays_action |
833 | if (p-> mShowIconNewEvent) | 833 | if (p-> mShowIconNewEvent) |
834 | ne_action->addTo( iconToolBar ); | 834 | ne_action->addTo( iconToolBar ); |
835 | if (p->mShowIconNewTodo ) | 835 | if (p->mShowIconNewTodo ) |
836 | nt_action->addTo( iconToolBar ); | 836 | nt_action->addTo( iconToolBar ); |
837 | if (p-> mShowIconSearch) | 837 | if (p-> mShowIconSearch) |
838 | search_action->addTo( iconToolBar ); | 838 | search_action->addTo( iconToolBar ); |
839 | if (p-> mShowIconNext) | 839 | if (p-> mShowIconNext) |
840 | whatsnext_action->addTo( iconToolBar ); | 840 | whatsnext_action->addTo( iconToolBar ); |
841 | if (p-> mShowIconNextDays) | 841 | if (p-> mShowIconNextDays) |
842 | xdays_action->addTo( iconToolBar ); | 842 | xdays_action->addTo( iconToolBar ); |
843 | if (p-> mShowIconList) | 843 | if (p-> mShowIconList) |
844 | showlist_action->addTo( iconToolBar ); | 844 | showlist_action->addTo( iconToolBar ); |
845 | if (p-> mShowIconDay1) | 845 | if (p-> mShowIconDay1) |
846 | day1_action->addTo( iconToolBar ); | 846 | day1_action->addTo( iconToolBar ); |
847 | if (p-> mShowIconDay5) | 847 | if (p-> mShowIconDay5) |
848 | day5_action->addTo( iconToolBar ); | 848 | day5_action->addTo( iconToolBar ); |
849 | if (p-> mShowIconDay7) | 849 | if (p-> mShowIconDay7) |
850 | day7_action->addTo( iconToolBar ); | 850 | day7_action->addTo( iconToolBar ); |
851 | if (p-> mShowIconMonth) | 851 | if (p-> mShowIconMonth) |
852 | month_action->addTo( iconToolBar ); | 852 | month_action->addTo( iconToolBar ); |
853 | if (p-> mShowIconTodoview) | 853 | if (p-> mShowIconTodoview) |
854 | todoview_action->addTo( iconToolBar ); | 854 | todoview_action->addTo( iconToolBar ); |
855 | if (p-> mShowIconJournal) | 855 | if (p-> mShowIconJournal) |
856 | viewjournal_action->addTo( iconToolBar ); | 856 | viewjournal_action->addTo( iconToolBar ); |
857 | icon = loadPixmap( pathString + "2leftarrowB" ); | 857 | icon = loadPixmap( pathString + "2leftarrowB" ); |
858 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 858 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
859 | if (p-> mShowIconBackFast) { | 859 | if (p-> mShowIconBackFast) { |
860 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 860 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
861 | connect( action, SIGNAL( activated() ), | 861 | connect( action, SIGNAL( activated() ), |
862 | mView, SLOT( goPreviousMonth() ) ); | 862 | mView, SLOT( goPreviousMonth() ) ); |
863 | action->addTo( iconToolBar ); | 863 | action->addTo( iconToolBar ); |
864 | } | 864 | } |
865 | icon = loadPixmap( pathString + "1leftarrowB" ); | 865 | icon = loadPixmap( pathString + "1leftarrowB" ); |
866 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 866 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
867 | if (p-> mShowIconBack) { | 867 | if (p-> mShowIconBack) { |
868 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 868 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
869 | connect( action, SIGNAL( activated() ), | 869 | connect( action, SIGNAL( activated() ), |
870 | mView, SLOT( goPrevious() ) ); | 870 | mView, SLOT( goPrevious() ) ); |
871 | action->addTo( iconToolBar ); | 871 | action->addTo( iconToolBar ); |
872 | } | 872 | } |
873 | if (p-> mShowIconToday) | 873 | if (p-> mShowIconToday) |
874 | today_action->addTo( iconToolBar ); | 874 | today_action->addTo( iconToolBar ); |
875 | icon = loadPixmap( pathString + "1rightarrowB" ); | 875 | icon = loadPixmap( pathString + "1rightarrowB" ); |
876 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 876 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
877 | if (p-> mShowIconForward) { | 877 | if (p-> mShowIconForward) { |
878 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 878 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
879 | connect( action, SIGNAL( activated() ), | 879 | connect( action, SIGNAL( activated() ), |
880 | mView, SLOT( goNext() ) ); | 880 | mView, SLOT( goNext() ) ); |
881 | action->addTo( iconToolBar ); | 881 | action->addTo( iconToolBar ); |
882 | } | 882 | } |
883 | icon = loadPixmap( pathString + "2rightarrowB" ); | 883 | icon = loadPixmap( pathString + "2rightarrowB" ); |
884 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 884 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
885 | if (p-> mShowIconForwardFast) { | 885 | if (p-> mShowIconForwardFast) { |
886 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 886 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
887 | connect( action, SIGNAL( activated() ), | 887 | connect( action, SIGNAL( activated() ), |
888 | mView, SLOT( goNextMonth() ) ); | 888 | mView, SLOT( goNextMonth() ) ); |
889 | action->addTo( iconToolBar ); | 889 | action->addTo( iconToolBar ); |
890 | } | 890 | } |
891 | 891 | ||
892 | 892 | ||
893 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 893 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
894 | 894 | ||
895 | if (p-> mShowIconNewEvent) | 895 | if (p-> mShowIconNewEvent) |
896 | configureToolBarMenu->setItemChecked( 10, true ); | 896 | configureToolBarMenu->setItemChecked( 10, true ); |
897 | if (p->mShowIconNewTodo ) | 897 | if (p->mShowIconNewTodo ) |
898 | configureToolBarMenu->setItemChecked( 20, true ); | 898 | configureToolBarMenu->setItemChecked( 20, true ); |
899 | if (p-> mShowIconSearch) | 899 | if (p-> mShowIconSearch) |
900 | configureToolBarMenu->setItemChecked( 120, true ); | 900 | configureToolBarMenu->setItemChecked( 120, true ); |
901 | if (p-> mShowIconList) | 901 | if (p-> mShowIconList) |
902 | configureToolBarMenu->setItemChecked( 30, true ); | 902 | configureToolBarMenu->setItemChecked( 30, true ); |
903 | if (p-> mShowIconDay1) | 903 | if (p-> mShowIconDay1) |
904 | configureToolBarMenu->setItemChecked( 40, true ); | 904 | configureToolBarMenu->setItemChecked( 40, true ); |
905 | if (p-> mShowIconDay5) | 905 | if (p-> mShowIconDay5) |
906 | configureToolBarMenu->setItemChecked( 50, true ); | 906 | configureToolBarMenu->setItemChecked( 50, true ); |
907 | if (p-> mShowIconDay7) | 907 | if (p-> mShowIconDay7) |
908 | configureToolBarMenu->setItemChecked( 60, true ); | 908 | configureToolBarMenu->setItemChecked( 60, true ); |
909 | if (p-> mShowIconMonth) | 909 | if (p-> mShowIconMonth) |
910 | configureToolBarMenu->setItemChecked( 70, true ); | 910 | configureToolBarMenu->setItemChecked( 70, true ); |
911 | if (p-> mShowIconTodoview) | 911 | if (p-> mShowIconTodoview) |
912 | configureToolBarMenu->setItemChecked( 80, true ); | 912 | configureToolBarMenu->setItemChecked( 80, true ); |
913 | if (p-> mShowIconBackFast) | 913 | if (p-> mShowIconBackFast) |
914 | configureToolBarMenu->setItemChecked( 200, true ); | 914 | configureToolBarMenu->setItemChecked( 200, true ); |
915 | if (p-> mShowIconBack) | 915 | if (p-> mShowIconBack) |
916 | configureToolBarMenu->setItemChecked( 210, true ); | 916 | configureToolBarMenu->setItemChecked( 210, true ); |
917 | if (p-> mShowIconToday) | 917 | if (p-> mShowIconToday) |
918 | configureToolBarMenu->setItemChecked( 130, true ); | 918 | configureToolBarMenu->setItemChecked( 130, true ); |
919 | if (p-> mShowIconForward) | 919 | if (p-> mShowIconForward) |
920 | configureToolBarMenu->setItemChecked( 220, true ); | 920 | configureToolBarMenu->setItemChecked( 220, true ); |
921 | if (p-> mShowIconForwardFast) | 921 | if (p-> mShowIconForwardFast) |
922 | configureToolBarMenu->setItemChecked( 230, true ); | 922 | configureToolBarMenu->setItemChecked( 230, true ); |
923 | if (p-> mShowIconNextDays) | 923 | if (p-> mShowIconNextDays) |
924 | configureToolBarMenu->setItemChecked( 100, true ); | 924 | configureToolBarMenu->setItemChecked( 100, true ); |
925 | if (p-> mShowIconNext) | 925 | if (p-> mShowIconNext) |
926 | configureToolBarMenu->setItemChecked( 110, true ); | 926 | configureToolBarMenu->setItemChecked( 110, true ); |
927 | if (p-> mShowIconJournal) | 927 | if (p-> mShowIconJournal) |
928 | configureToolBarMenu->setItemChecked( 90, true ); | 928 | configureToolBarMenu->setItemChecked( 90, true ); |
929 | if (p-> mShowIconWhatsThis) | 929 | if (p-> mShowIconWhatsThis) |
930 | configureToolBarMenu->setItemChecked( 300, true ); | 930 | configureToolBarMenu->setItemChecked( 300, true ); |
931 | 931 | ||
932 | QLabel* dummy = new QLabel( iconToolBar ); | 932 | QLabel* dummy = new QLabel( iconToolBar ); |
933 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 933 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
934 | if (!p-> mShowIconStretch) | 934 | if (!p-> mShowIconStretch) |
935 | iconToolBar->setStretchableWidget ( dummy ) ; | 935 | iconToolBar->setStretchableWidget ( dummy ) ; |
936 | else | 936 | else |
937 | configureToolBarMenu->setItemChecked( 5, true ); | 937 | configureToolBarMenu->setItemChecked( 5, true ); |
938 | if (p-> mShowIconWhatsThis) | 938 | if (p-> mShowIconWhatsThis) |
939 | QWhatsThis::whatsThisButton ( iconToolBar ); | 939 | QWhatsThis::whatsThisButton ( iconToolBar ); |
940 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 940 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
941 | configureAgenda( p->mHourSize ); | 941 | configureAgenda( p->mHourSize ); |
942 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 942 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
943 | } | 943 | } |
944 | void MainWindow::fillSyncMenu() | 944 | void MainWindow::fillSyncMenu() |
945 | { | 945 | { |
946 | if ( syncMenu->count() ) | 946 | if ( syncMenu->count() ) |
947 | syncMenu->clear(); | 947 | syncMenu->clear(); |
948 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 948 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
949 | syncMenu->insertSeparator(); | 949 | syncMenu->insertSeparator(); |
950 | if ( mServerSocket == 0 ) { | 950 | if ( mServerSocket == 0 ) { |
951 | syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | 951 | syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
952 | } else { | 952 | } else { |
953 | syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | 953 | syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
954 | } | 954 | } |
955 | syncMenu->insertSeparator(); | 955 | syncMenu->insertSeparator(); |
956 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 956 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
957 | syncMenu->insertSeparator(); | 957 | syncMenu->insertSeparator(); |
958 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 958 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
959 | config.setGroup("General"); | 959 | config.setGroup("General"); |
960 | QStringList prof = config.readListEntry("SyncProfileNames"); | 960 | QStringList prof = config.readListEntry("SyncProfileNames"); |
961 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 961 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
962 | if ( prof.count() < 3 ) { | 962 | if ( prof.count() < 3 ) { |
963 | prof.clear(); | 963 | prof.clear(); |
964 | prof << i18n("Sharp_DTM"); | 964 | prof << i18n("Sharp_DTM"); |
965 | prof << i18n("Local_file"); | 965 | prof << i18n("Local_file"); |
966 | prof << i18n("Last_file"); | 966 | prof << i18n("Last_file"); |
967 | KSyncProfile* temp = new KSyncProfile (); | 967 | KSyncProfile* temp = new KSyncProfile (); |
968 | temp->setName( prof[0] ); | 968 | temp->setName( prof[0] ); |
969 | temp->writeConfig(&config); | 969 | temp->writeConfig(&config); |
970 | temp->setName( prof[1] ); | 970 | temp->setName( prof[1] ); |
971 | temp->writeConfig(&config); | 971 | temp->writeConfig(&config); |
972 | temp->setName( prof[2] ); | 972 | temp->setName( prof[2] ); |
973 | temp->writeConfig(&config); | 973 | temp->writeConfig(&config); |
974 | config.setGroup("General"); | 974 | config.setGroup("General"); |
975 | config.writeEntry("SyncProfileNames",prof); | 975 | config.writeEntry("SyncProfileNames",prof); |
976 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 976 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
977 | config.sync(); | 977 | config.sync(); |
978 | delete temp; | 978 | delete temp; |
979 | } | 979 | } |
980 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 980 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
981 | KOPrefs::instance()->mSyncProfileNames = prof; | 981 | KOPrefs::instance()->mSyncProfileNames = prof; |
982 | int i; | 982 | int i; |
983 | for ( i = 0; i < prof.count(); ++i ) { | 983 | for ( i = 0; i < prof.count(); ++i ) { |
984 | 984 | ||
985 | syncMenu->insertItem( prof[i], 1000+i ); | 985 | syncMenu->insertItem( prof[i], 1000+i ); |
986 | if ( i == 2 ) | 986 | if ( i == 2 ) |
987 | syncMenu->insertSeparator(); | 987 | syncMenu->insertSeparator(); |
988 | } | 988 | } |
989 | QDir app_dir; | 989 | QDir app_dir; |
990 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 990 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
991 | syncMenu->setItemEnabled( false , 1000 ); | 991 | syncMenu->setItemEnabled( false , 1000 ); |
992 | } | 992 | } |
993 | mView->setupExternSyncProfiles(); | ||
994 | } | 993 | } |
995 | 994 | ||
996 | int MainWindow::ringSync() | 995 | int MainWindow::ringSync() |
997 | { | 996 | { |
998 | int syncedProfiles = 0; | 997 | int syncedProfiles = 0; |
999 | int i; | 998 | int i; |
1000 | QTime timer; | 999 | QTime timer; |
1001 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 1000 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
1002 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 1001 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
1003 | KSyncProfile* temp = new KSyncProfile (); | 1002 | KSyncProfile* temp = new KSyncProfile (); |
1004 | KOPrefs::instance()->mAskForPreferences = false; | 1003 | KOPrefs::instance()->mAskForPreferences = false; |
1005 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 1004 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
1006 | mCurrentSyncProfile = i; | 1005 | mCurrentSyncProfile = i; |
1007 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 1006 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
1008 | temp->readConfig(&config); | 1007 | temp->readConfig(&config); |
1009 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 1008 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
1010 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 1009 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
1011 | ++syncedProfiles; | 1010 | ++syncedProfiles; |
1012 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 1011 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
1013 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 1012 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
1014 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 1013 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
1015 | KOPrefs::instance()->mWriteBackInFuture = 0; | 1014 | KOPrefs::instance()->mWriteBackInFuture = 0; |
1016 | if ( temp->getWriteBackFuture() ) | 1015 | if ( temp->getWriteBackFuture() ) |
1017 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 1016 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
1018 | KOPrefs::instance()->mShowSyncSummary = false; | 1017 | KOPrefs::instance()->mShowSyncSummary = false; |
1019 | mView->setSyncDevice(syncProfileNames[i] ); | 1018 | mView->setSyncDevice(syncProfileNames[i] ); |
1020 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 1019 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
1021 | if ( i == 0 ) { | 1020 | if ( i == 0 ) { |
1022 | syncSharp(); | 1021 | syncSharp(); |
1023 | } else { | 1022 | } else { |
1024 | if ( temp->getIsLocalFileSync() ) { | 1023 | if ( temp->getIsLocalFileSync() ) { |
1025 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 1024 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
1026 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1025 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
1027 | } else { | 1026 | } else { |
1028 | if ( temp->getIsPhoneSync() ) { | 1027 | if ( temp->getIsPhoneSync() ) { |
1029 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | 1028 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; |
1030 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | 1029 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); |
1031 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1030 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1032 | syncPhone(); | 1031 | syncPhone(); |
1033 | } else if ( temp->getIsPiSync() ) { | 1032 | } else if ( temp->getIsPiSync() ) { |
1034 | mPassWordPiSync = temp->getRemotePw(); | 1033 | mPassWordPiSync = temp->getRemotePw(); |
1035 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | 1034 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); |
1036 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | 1035 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); |
1037 | syncPi(); | 1036 | syncPi(); |
1038 | } else | 1037 | } else |
1039 | syncRemote( temp, false ); | 1038 | syncRemote( temp, false ); |
1040 | 1039 | ||
1041 | } | 1040 | } |
1042 | } | 1041 | } |
1043 | timer.start(); | 1042 | timer.start(); |
1044 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 1043 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
1045 | while ( timer.elapsed () < 2000 ) { | 1044 | while ( timer.elapsed () < 2000 ) { |
1046 | qApp->processEvents(); | 1045 | qApp->processEvents(); |
1047 | #ifndef _WIN32_ | 1046 | #ifndef _WIN32_ |
1048 | sleep (1); | 1047 | sleep (1); |
1049 | #endif | 1048 | #endif |
1050 | } | 1049 | } |
1051 | 1050 | ||
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | } | 1053 | } |
1055 | delete temp; | 1054 | delete temp; |
1056 | return syncedProfiles; | 1055 | return syncedProfiles; |
1057 | } | 1056 | } |
1058 | 1057 | ||
1059 | void MainWindow::multiSync( bool askforPrefs ) | 1058 | void MainWindow::multiSync( bool askforPrefs ) |
1060 | { | 1059 | { |
1061 | if (mBlockSaveFlag) | 1060 | if (mBlockSaveFlag) |
1062 | return; | 1061 | return; |
1063 | mBlockSaveFlag = true; | 1062 | mBlockSaveFlag = true; |
1064 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 1063 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
1065 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1064 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1066 | question, | 1065 | question, |
1067 | i18n("Yes"), i18n("No"), | 1066 | i18n("Yes"), i18n("No"), |
1068 | 0, 0 ) != 0 ) { | 1067 | 0, 0 ) != 0 ) { |
1069 | mBlockSaveFlag = false; | 1068 | mBlockSaveFlag = false; |
1070 | setCaption(i18n("Aborted! Nothing synced!")); | 1069 | setCaption(i18n("Aborted! Nothing synced!")); |
1071 | return; | 1070 | return; |
1072 | } | 1071 | } |
1073 | mView->setSyncDevice(i18n("Multiple profiles") ); | 1072 | mView->setSyncDevice(i18n("Multiple profiles") ); |
1074 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 1073 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
1075 | if ( askforPrefs ) { | 1074 | if ( askforPrefs ) { |
1076 | mView->edit_sync_options(); | 1075 | mView->edit_sync_options(); |
1077 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 1076 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
1078 | } | 1077 | } |
1079 | setCaption(i18n("Multiple sync started.") ); | 1078 | setCaption(i18n("Multiple sync started.") ); |
1080 | qApp->processEvents(); | 1079 | qApp->processEvents(); |
1081 | int num = ringSync() ; | 1080 | int num = ringSync() ; |
1082 | if ( num > 1 ) | 1081 | if ( num > 1 ) |
1083 | ringSync(); | 1082 | ringSync(); |
1084 | mBlockSaveFlag = false; | 1083 | mBlockSaveFlag = false; |
1085 | if ( num ) | 1084 | if ( num ) |
1086 | save(); | 1085 | save(); |
1087 | if ( num ) | 1086 | if ( num ) |
1088 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 1087 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
1089 | else | 1088 | else |
1090 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 1089 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
1091 | return; | 1090 | return; |
1092 | } | 1091 | } |
1093 | void MainWindow::slotSyncMenu( int action ) | 1092 | void MainWindow::slotSyncMenu( int action ) |
1094 | { | 1093 | { |
1095 | qDebug("syncaction %d ", action); | 1094 | qDebug("syncaction %d ", action); |
1096 | if ( action == 0 ) { | 1095 | if ( action == 0 ) { |
1097 | 1096 | ||
1098 | // seems to be a Qt2 event handling bug | 1097 | // seems to be a Qt2 event handling bug |
1099 | // syncmenu.clear causes a segfault at first time | 1098 | // syncmenu.clear causes a segfault at first time |
1100 | // when we call it after the main event loop, it is ok | 1099 | // when we call it after the main event loop, it is ok |
1101 | // same behaviour when calling OM/Pi via QCOP for the first time | 1100 | // same behaviour when calling OM/Pi via QCOP for the first time |
1102 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 1101 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
1103 | //confSync(); | 1102 | //confSync(); |
1104 | 1103 | ||
1105 | return; | 1104 | return; |
1106 | } | 1105 | } |
1107 | if ( action == 1 ) { | 1106 | if ( action == 1 ) { |
1108 | multiSync( true ); | 1107 | multiSync( true ); |
1109 | return; | 1108 | return; |
1110 | } | 1109 | } |
1111 | if ( action == 2 ) { | 1110 | if ( action == 2 ) { |
1112 | enableQuick(); | 1111 | enableQuick(); |
1113 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 1112 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
1114 | return; | 1113 | return; |
1115 | } | 1114 | } |
1116 | if ( action == 3 ) { | 1115 | if ( action == 3 ) { |
1117 | delete mServerSocket; | 1116 | delete mServerSocket; |
1118 | mServerSocket = 0; | 1117 | mServerSocket = 0; |
1119 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 1118 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
1120 | return; | 1119 | return; |
1121 | } | 1120 | } |
1122 | 1121 | ||
1123 | if (mBlockSaveFlag) | 1122 | if (mBlockSaveFlag) |
1124 | return; | 1123 | return; |
1125 | mBlockSaveFlag = true; | 1124 | mBlockSaveFlag = true; |
1126 | mCurrentSyncProfile = action - 1000 ; | 1125 | mCurrentSyncProfile = action - 1000 ; |
1127 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 1126 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
1128 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 1127 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
1129 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 1128 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
1130 | KSyncProfile* temp = new KSyncProfile (); | 1129 | KSyncProfile* temp = new KSyncProfile (); |
1131 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1130 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1132 | temp->readConfig(&config); | 1131 | temp->readConfig(&config); |
1133 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 1132 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
1134 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 1133 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
1135 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 1134 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
1136 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 1135 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
1137 | KOPrefs::instance()->mWriteBackInFuture = 0; | 1136 | KOPrefs::instance()->mWriteBackInFuture = 0; |
1138 | if ( temp->getWriteBackFuture() ) | 1137 | if ( temp->getWriteBackFuture() ) |
1139 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 1138 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
1140 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 1139 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
1141 | if ( action == 1000 ) { | 1140 | if ( action == 1000 ) { |
1142 | syncSharp(); | 1141 | syncSharp(); |
1143 | 1142 | ||
1144 | } else if ( action == 1001 ) { | 1143 | } else if ( action == 1001 ) { |
1145 | syncLocalFile(); | 1144 | syncLocalFile(); |
1146 | 1145 | ||
1147 | } else if ( action == 1002 ) { | 1146 | } else if ( action == 1002 ) { |
1148 | quickSyncLocalFile(); | 1147 | quickSyncLocalFile(); |
1149 | 1148 | ||
1150 | } else if ( action >= 1003 ) { | 1149 | } else if ( action >= 1003 ) { |
1151 | if ( temp->getIsLocalFileSync() ) { | 1150 | if ( temp->getIsLocalFileSync() ) { |
1152 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 1151 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
1153 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1152 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
1154 | } else { | 1153 | } else { |
1155 | if ( temp->getIsPhoneSync() ) { | 1154 | if ( temp->getIsPhoneSync() ) { |
1156 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | 1155 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; |
1157 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | 1156 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); |
1158 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1157 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1159 | syncPhone(); | 1158 | syncPhone(); |
1160 | } else if ( temp->getIsPiSync() ) { | 1159 | } else if ( temp->getIsPiSync() ) { |
1161 | mPassWordPiSync = temp->getRemotePw(); | 1160 | mPassWordPiSync = temp->getRemotePw(); |
1162 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | 1161 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); |
1163 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | 1162 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); |
1164 | syncPi(); | 1163 | syncPi(); |
1165 | } else | 1164 | } else |
1166 | syncRemote( temp ); | 1165 | syncRemote( temp ); |
1167 | 1166 | ||
1168 | } | 1167 | } |
1169 | } | 1168 | } |
1170 | delete temp; | 1169 | delete temp; |
1171 | mBlockSaveFlag = false; | 1170 | mBlockSaveFlag = false; |
1172 | } | 1171 | } |
1173 | void MainWindow::exportToPhone( int mode ) | 1172 | void MainWindow::exportToPhone( int mode ) |
1174 | { | 1173 | { |
1175 | 1174 | ||
1176 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1175 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1177 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1176 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1178 | KOex2phonePrefs ex2phone; | 1177 | KOex2phonePrefs ex2phone; |
1179 | 1178 | ||
1180 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1179 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1181 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1180 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1182 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1181 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1183 | if ( mode == 1 ) | 1182 | if ( mode == 1 ) |
1184 | ex2phone.setCaption(i18n("Export complete calendar")); | 1183 | ex2phone.setCaption(i18n("Export complete calendar")); |
1185 | if ( mode == 2 ) | 1184 | if ( mode == 2 ) |
1186 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1185 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1187 | 1186 | ||
1188 | if ( !ex2phone.exec() ) { | 1187 | if ( !ex2phone.exec() ) { |
1189 | return; | 1188 | return; |
1190 | } | 1189 | } |
1191 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1190 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1192 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1191 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1193 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1192 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1194 | 1193 | ||
1195 | int inFuture = 0; | 1194 | int inFuture = 0; |
1196 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1195 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1197 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1196 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1198 | QPtrList<Incidence> delSel; | 1197 | QPtrList<Incidence> delSel; |
1199 | if ( mode == 1 ) | 1198 | if ( mode == 1 ) |
1200 | delSel = mCalendar->rawIncidences(); | 1199 | delSel = mCalendar->rawIncidences(); |
1201 | if ( mode == 2 ) | 1200 | if ( mode == 2 ) |
1202 | delSel = mCalendar->incidences(); | 1201 | delSel = mCalendar->incidences(); |
1203 | CalendarLocal* cal = new CalendarLocal(); | 1202 | CalendarLocal* cal = new CalendarLocal(); |
1204 | cal->setLocalTime(); | 1203 | cal->setLocalTime(); |
1205 | Incidence *incidence = delSel.first(); | 1204 | Incidence *incidence = delSel.first(); |
1206 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1205 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1207 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1206 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1208 | while ( incidence ) { | 1207 | while ( incidence ) { |
1209 | if ( incidence->type() != "Journal" ) { | 1208 | if ( incidence->type() != "Journal" ) { |
1210 | bool add = true; | 1209 | bool add = true; |
1211 | if ( inFuture ) { | 1210 | if ( inFuture ) { |
1212 | QDateTime dt; | 1211 | QDateTime dt; |
1213 | if ( incidence->type() == "Todo" ) { | 1212 | if ( incidence->type() == "Todo" ) { |
1214 | Todo * t = (Todo*)incidence; | 1213 | Todo * t = (Todo*)incidence; |
1215 | if ( t->hasDueDate() ) | 1214 | if ( t->hasDueDate() ) |
1216 | dt = t->dtDue(); | 1215 | dt = t->dtDue(); |
1217 | else | 1216 | else |
1218 | dt = cur.addSecs( 62 ); | 1217 | dt = cur.addSecs( 62 ); |
1219 | } | 1218 | } |
1220 | else { | 1219 | else { |
1221 | bool ok; | 1220 | bool ok; |
1222 | dt = incidence->getNextOccurence( cur, &ok ); | 1221 | dt = incidence->getNextOccurence( cur, &ok ); |
1223 | if ( !ok ) | 1222 | if ( !ok ) |
1224 | dt = cur.addSecs( -62 ); | 1223 | dt = cur.addSecs( -62 ); |
1225 | } | 1224 | } |
1226 | if ( dt < cur || dt > end ) { | 1225 | if ( dt < cur || dt > end ) { |
1227 | add = false; | 1226 | add = false; |
1228 | } | 1227 | } |
1229 | } | 1228 | } |
1230 | if ( add ) { | 1229 | if ( add ) { |
1231 | Incidence *in = incidence->clone(); | 1230 | Incidence *in = incidence->clone(); |
1232 | cal->addIncidence( in ); | 1231 | cal->addIncidence( in ); |
1233 | } | 1232 | } |
1234 | } | 1233 | } |
1235 | incidence = delSel.next(); | 1234 | incidence = delSel.next(); |
1236 | } | 1235 | } |
1237 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1236 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1238 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1237 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1239 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1238 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1240 | 1239 | ||
1241 | setCaption( i18n("Writing to phone...")); | 1240 | setCaption( i18n("Writing to phone...")); |
1242 | if ( PhoneFormat::writeToPhone( cal ) ) | 1241 | if ( PhoneFormat::writeToPhone( cal ) ) |
1243 | setCaption( i18n("Export to phone successful!")); | 1242 | setCaption( i18n("Export to phone successful!")); |
1244 | else | 1243 | else |
1245 | setCaption( i18n("Error exporting to phone!")); | 1244 | setCaption( i18n("Error exporting to phone!")); |
1246 | delete cal; | 1245 | delete cal; |
1247 | } | 1246 | } |
1248 | 1247 | ||
1249 | 1248 | ||