summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-06 20:51:01 (UTC)
committer zautrix <zautrix>2004-10-06 20:51:01 (UTC)
commit0afcfa29ace7bc5e42a11fae44301e1e8230a376 (patch) (unidiff)
treeb54f85b19ace24219be1b845469444089cacc94f /korganizer
parented4675de07d947f55d2672c721599e3a0af1e24b (diff)
downloadkdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.zip
kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.gz
kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.bz2
some prefs cleanups
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp14
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/mainwindow.cpp1
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
@@ -816,143 +816,129 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
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}
858Event* CalendarView::getLastSyncEvent() 858Event* 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
881void 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
897void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 883void 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}
925void CalendarView::checkExternalId( Incidence * inc ) 911void 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}
931bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 917bool 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
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index a713c91..0f7e696 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -52,129 +52,128 @@ class KODialogManager;
52class KOTodoView; 52class KOTodoView;
53class KDateNavigator; 53class KDateNavigator;
54class DateNavigator; 54class DateNavigator;
55class KOIncidenceEditor; 55class KOIncidenceEditor;
56class KDatePicker; 56class KDatePicker;
57class ResourceView; 57class ResourceView;
58class NavigatorBar; 58class NavigatorBar;
59class KOEventEditor; 59class KOEventEditor;
60class KOTodoEditor ; 60class KOTodoEditor ;
61class KOEventViewerDialog; 61class KOEventViewerDialog;
62class KOBeamPrefs; 62class KOBeamPrefs;
63class KSyncProfile; 63class KSyncProfile;
64class AlarmDialog; 64class AlarmDialog;
65class KCal::Attendee; 65class KCal::Attendee;
66 66
67namespace KCal { class FileStorage; } 67namespace KCal { class FileStorage; }
68 68
69using namespace KCal; 69using 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*/
80class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer 80class 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 &noti ); 178 void addAlarm(const QDateTime &qdt, const QString &noti );
180 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 179 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
@@ -483,114 +482,113 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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
557class CalendarViewVisitor : public Incidence::Visitor 555class 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
572class ShowIncidenceVisitor : public CalendarViewVisitor 570class 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
580class EditIncidenceVisitor : public CalendarViewVisitor 578class 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
588class DeleteIncidenceVisitor : public CalendarViewVisitor 586class 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
@@ -929,129 +929,128 @@ void MainWindow::initActions()
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}
944void MainWindow::fillSyncMenu() 944void 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
996int MainWindow::ringSync() 995int 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}