summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-02 00:09:04 (UTC)
committer zautrix <zautrix>2004-08-02 00:09:04 (UTC)
commit3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0 (patch) (unidiff)
treefdff56329649c084b6f5af8d8e96c0157686575e
parent3b4aa1cd78395c0f94b99decd901842944765746 (diff)
downloadkdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.zip
kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.gz
kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.bz2
More sync hacking
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp76
-rw-r--r--korganizer/calendarview.h5
-rw-r--r--korganizer/koprefs.cpp27
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/mainwindow.cpp3
-rw-r--r--libkcal/calendar.h2
-rw-r--r--libkcal/calendarlocal.cpp14
-rw-r--r--libkcal/calendarlocal.h2
8 files changed, 87 insertions, 43 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index cfc6b10..9160e1d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -852,7 +852,10 @@ Event* CalendarView::getLastSyncEvent()
852 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 852 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
853 lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); 853 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
854 if (!lse) { 854 if (!lse) {
855 lse = new Event(); 855 lse = new Event();
856 lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); 856 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
857 lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); 857 QString sum = "";
858 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
859 sum = "E: ";
860 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
858 lse->setDtStart( mLastCalendarSync ); 861 lse->setDtStart( mLastCalendarSync );
@@ -867,7 +870,21 @@ Event* CalendarView::getLastSyncEvent()
867} 870}
868void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) 871void CalendarView::setupExternSyncProfiles()
869{ 872{
870 if ( ! lastSync ) 873 Event* lse;
871 return; 874 mExternLastSyncEvent.clear();
872 if ( toDelete->zaurusId() < 0 ) 875 int i;
876 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) {
877 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] );
878 if ( lse )
879 mExternLastSyncEvent.append( lse );
880 else
881 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1());
882 }
883
884}
885// we check, if the to delete event has a id for a profile
886// if yes, we set this id in the profile to delete
887void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
888{
889 if ( ! lastSync.count() == 0 )
873 return; 890 return;
@@ -875,10 +892,19 @@ void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete )
875 return; 892 return;
876 QString des = lastSync->description(); 893
877 QString pref = "e"; 894 Event* eve = lastSync.first();
878 if ( toDelete->type() == "Todo" ) 895
879 pref = "t"; 896 while ( eve ) {
880 des += pref+ QString::number ( toDelete->zaurusId() ) + ","; 897 int id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
881 lastSync->setReadOnly( false ); 898 if ( id >= 0 ) {
882 lastSync->setDescription( des ); 899 QString des = eve->description();
883 lastSync->setReadOnly( true ); 900 QString pref = "e";
901 if ( toDelete->type() == "Todo" )
902 pref = "t";
903 des += pref+ QString::number ( id ) + ",";
904 eve->setReadOnly( false );
905 eve->setDescription( des );
906 eve->setReadOnly( true );
907 }
908 eve = lastSync.next();
909 }
884 910
@@ -901,4 +927,4 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
901 Event* eventLSync; 927 Event* eventLSync;
902 Event* eventRSyncSharp = remote->event( "last-syncEvent-device-Sharp-DTM"); 928 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
903 Event* eventLSyncSharp = local->event( "last-syncEvent-device-Sharp-DTM"); 929 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
904 bool fullDateRange = false; 930 bool fullDateRange = false;
@@ -906,3 +932,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
906 QDateTime modifiedCalendar = mLastCalendarSync;; 932 QDateTime modifiedCalendar = mLastCalendarSync;;
907 eventR = remote->event("last-syncEvent-device-"+mCurrentSyncName ); 933 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
908 if ( eventR ) { 934 if ( eventR ) {
@@ -915,3 +941,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
915 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 941 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
916 eventRSync->setUid("last-syncEvent-device-"+mCurrentSyncName ); 942 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
917 eventRSync->setDtStart( mLastCalendarSync ); 943 eventRSync->setDtStart( mLastCalendarSync );
@@ -967,3 +993,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
967 bool skipIncidence = false; 993 bool skipIncidence = false;
968 if ( uid.left(21) == QString("last-syncEvent-device") ) 994 if ( uid.left(15) == QString("last-syncEvent-") )
969 skipIncidence = true; 995 skipIncidence = true;
@@ -1017,3 +1043,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1017 } else { 1043 } else {
1018 checkSharpEvent(eventRSyncSharp, inR); 1044 checkExternSyncEvent(eventRSyncSharp, inR);
1019 remote->deleteIncidence( inR ); 1045 remote->deleteIncidence( inR );
@@ -1044,3 +1070,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1044 bool skipIncidence = false; 1070 bool skipIncidence = false;
1045 if ( uid.left(21) == QString("last-syncEvent-device") ) 1071 if ( uid.left(15) == QString("last-syncEvent-") )
1046 skipIncidence = true; 1072 skipIncidence = true;
@@ -1065,3 +1091,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1065 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1091 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1066 checkSharpEvent(eventLSyncSharp, inL); 1092 checkExternSyncEvent(eventLSyncSharp, inL);
1067 local->deleteIncidence( inL ); 1093 local->deleteIncidence( inL );
@@ -1344,3 +1370,3 @@ void CalendarView::setSyncEventsReadOnly()
1344 while ( ev ) { 1370 while ( ev ) {
1345 if ( ev->uid().left(21) == QString("last-syncEvent-device") ) 1371 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1346 ev->setReadOnly( true ); 1372 ev->setReadOnly( true );
@@ -1808,3 +1834,3 @@ void CalendarView::checkZaurusId( int id, bool todo )
1808 if ( id >= 0 ) { 1834 if ( id >= 0 ) {
1809 Incidence* lse = mCalendar->event( "last-syncEvent-device-Sharp-DTM"); 1835 Incidence* lse = mCalendar->event( "last-syncEvent-Sharp-DTM");
1810 if ( lse ) { 1836 if ( lse ) {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 8aa5e1c..557554f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -115,2 +115,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
115 Incidence *currentSelection(); 115 Incidence *currentSelection();
116 void setupExternSyncProfiles();
116 117
@@ -483,3 +484,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
483 QDateTime loadedFileVersion; 484 QDateTime loadedFileVersion;
484 void checkSharpEvent( Event* lastSync, Incidence* toDelete ); 485 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
485 void checkZaurusId( int id, bool todo = false ); 486 void checkZaurusId( int id, bool todo = false );
@@ -536,3 +537,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
536 Incidence *mMoveIncidence; 537 Incidence *mMoveIncidence;
537 538 QPtrList<Event> mExternLastSyncEvent;
538 KOTodoView *mTodoList; 539 KOTodoView *mTodoList;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 3ba5ab2..f3231ff 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -179,12 +179,13 @@ KOPrefs::KOPrefs() :
179 179
180 KPrefs::setCurrentGroup("SyncProfiles"); 180// KPrefs::setCurrentGroup("SyncProfiles");
181 addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 181// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
182 addItemStringList("SyncProfileNames",&mSyncProfileNames); 182// addItemStringList("SyncProfileNames",&mSyncProfileNames);
183// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
183 184
184 KPrefs::setCurrentGroup("RemoteSyncing"); 185 KPrefs::setCurrentGroup("RemoteSyncing");
185 addItemBool("UsePasswd",&mUsePassWd,false); 186// addItemBool("UsePasswd",&mUsePassWd,false);
186 addItemBool("WriteBackFile",&mWriteBackFile,true); 187// addItemBool("WriteBackFile",&mWriteBackFile,true);
187 addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 188// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
188 addItemBool("AskForPreferences",&mAskForPreferences,true); 189// addItemBool("AskForPreferences",&mAskForPreferences,true);
189 addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 190// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
190 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 191 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
@@ -199,7 +200,7 @@ KOPrefs::KOPrefs() :
199#endif 200#endif
200 addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); 201// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
201 addItemString("RemoteUser",&mRemoteUser, "zaurus"); 202// addItemString("RemoteUser",&mRemoteUser, "zaurus");
202 addItemString("RemotePassWd",&mRemotePassWd, ""); 203// addItemString("RemotePassWd",&mRemotePassWd, "");
203 addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); 204// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
204 addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); 205// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
205 206
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index fe044e6..424fa98 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -217,2 +217,3 @@ class KOPrefs : public KPimPrefs
217 QStringList mSyncProfileNames; 217 QStringList mSyncProfileNames;
218 QStringList mExternSyncProfiles;
218 QString mLocalMachineName; 219 QString mLocalMachineName;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 44b1264..6020a46 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -838,2 +838,3 @@ void MainWindow::fillSyncMenu()
838 config.writeEntry("SyncProfileNames",prof); 838 config.writeEntry("SyncProfileNames",prof);
839 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
839 config.sync(); 840 config.sync();
@@ -841,2 +842,3 @@ void MainWindow::fillSyncMenu()
841 } 842 }
843 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
842 KOPrefs::instance()->mSyncProfileNames = prof; 844 KOPrefs::instance()->mSyncProfileNames = prof;
@@ -853,2 +855,3 @@ void MainWindow::fillSyncMenu()
853 } 855 }
856 mView->setupExternSyncProfiles();
854} 857}
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 7d23619..df5bbcf 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -77,3 +77,3 @@ public:
77 virtual void save() = 0; 77 virtual void save() = 0;
78 78 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
79 virtual bool isSaving() { return false; } 79 virtual bool isSaving() { return false; }
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 3c572f0..09ce9f0 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -224,2 +224,15 @@ Todo *CalendarLocal::todo( int id )
224 224
225QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
226{
227 QPtrList<Event> el;
228 Event *todo;
229 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
230 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
231 if ( todo->summary().left(3) == "E: " )
232 el.append( todo );
233 }
234
235 return el;
236
237}
225Event *CalendarLocal::event( int id ) 238Event *CalendarLocal::event( int id )
@@ -322,3 +335,2 @@ QString CalendarLocal:: getAlarmNotification()
322} 335}
323
324void CalendarLocal::registerAlarm() 336void CalendarLocal::registerAlarm()
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a2e50e3..3257198 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -87,3 +87,3 @@ class CalendarLocal : public Calendar
87 QPtrList<Event> rawEvents(); 87 QPtrList<Event> rawEvents();
88 88 QPtrList<Event> getExternLastSyncEvents();
89 /** 89 /**