summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/caldump/main.cpp38
-rw-r--r--korganizer/calendarview.cpp29
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--libkcal/calendar.cpp8
-rw-r--r--libkcal/calendar.h2
5 files changed, 42 insertions, 36 deletions
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp
index 755e792..be1735b 100644
--- a/kde2file/caldump/main.cpp
+++ b/kde2file/caldump/main.cpp
@@ -46,24 +46,25 @@
46#include <kstandarddirs.h> 46#include <kstandarddirs.h>
47#include <kdebug.h> 47#include <kdebug.h>
48 48
49#include <libkcal/calformat.h> 49#include <libkcal/calformat.h>
50#include <libkcal/calendarresources.h> 50#include <libkcal/calendarresources.h>
51#include <libkcal/resourcelocal.h> 51#include <libkcal/resourcelocal.h>
52#include <libkcal/filestorage.h> 52#include <libkcal/filestorage.h>
53#include <libkcal/icalformat.h> 53#include <libkcal/icalformat.h>
54 54
55#include <qdatetime.h> 55#include <qdatetime.h>
56#include <qfile.h> 56#include <qfile.h>
57#include <qdir.h> 57#include <qdir.h>
58#include <qapplication.h>
58 59
59#include <stdlib.h> 60#include <stdlib.h>
60#include <iostream> 61#include <iostream>
61 62
62using namespace KCal; 63using namespace KCal;
63using namespace std; 64using namespace std;
64 65
65static const char progName[] = "kdecalendar"; 66static const char progName[] = "kdecalendar";
66static const char progDisplay[] = "KDE_Calendar"; 67static const char progDisplay[] = "KDE_Calendar";
67static const char progVersion[] = "33.1/3"; 68static const char progVersion[] = "33.1/3";
68static const char progDesc[] = "A command line interface to KDE calendars"; 69static const char progDesc[] = "A command line interface to KDE calendars";
69 70
@@ -143,78 +144,75 @@ int main( int argc, char *argv[] )
143 144
144 FileStorage* storage = new FileStorage( calendarResource ); 145 FileStorage* storage = new FileStorage( calendarResource );
145 storage->setFileName( fileName ); 146 storage->setFileName( fileName );
146 storage->setSaveFormat( new ICalFormat() ); 147 storage->setSaveFormat( new ICalFormat() );
147 storage->save(); 148 storage->save();
148 delete storage; 149 delete storage;
149 qDebug("************************************* "); 150 qDebug("************************************* ");
150 qDebug("************kdecaldump*************** "); 151 qDebug("************kdecaldump*************** ");
151 qDebug("************************************* "); 152 qDebug("************************************* ");
152 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1()); 153 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1());
153 154
154 } else { 155 } else {
155 qDebug("*************************load"); 156 qDebug("************load");
156 localCalendar = new CalendarLocal(); 157 localCalendar = new CalendarLocal();
157 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 158 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
158 FileStorage* storage = new FileStorage( localCalendar ); 159 FileStorage* storage = new FileStorage( localCalendar );
159 storage->setFileName( fileName ); 160 storage->setFileName( fileName );
160 int num = 0; 161 int num = 0;
161 int del = 0; 162 int del = 0;
162 int add = 0; 163 int add = 0;
163 if ( storage->load() ) { 164 if ( storage->load() ) {
164 qDebug("*************************loaded!"); 165 qDebug("***********loaded!");
165 KCal::Incidence::List newInc = localCalendar->rawIncidences(); 166 KCal::Incidence::List newInc = localCalendar->rawIncidences();
166 Incidence::List::ConstIterator it; 167 Incidence::List::ConstIterator it;
167 for( it = newInc.begin(); it != newInc.end(); ++it ) { 168 for( it = newInc.begin(); it != newInc.end(); ++it ) {
168 if ( (*it)->pilotId() > 0 ) { //changed 169 if ( (*it)->pilotId() > 1 ) { //changed
169 Incidence* cl = (*it)->clone(); 170 qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1());
170 Incidence *incOld = calendarResource->incidence( cl->uid() ); 171 Incidence *incOld = calendarResource->incidence( (*it)->uid() );
171 ResourceCalendar * res = 0; 172 ResourceCalendar * res = 0;
172 if ( incOld ) 173 if ( incOld )
173 res = calendarResource->resource( incOld ); 174 res = calendarResource->resource( incOld );
174 if ( res ) { 175 if ( res ) {
176 Incidence* cl = (*it)->clone();
175 cl->setPilotId( incOld->pilotId() ); 177 cl->setPilotId( incOld->pilotId() );
176 ++num; 178 ++num;
177 if ( incOld->type() == "Journal" ) 179 if ( incOld->type() == "Journal" )
178 calendarResource->deleteJournal( (Journal *) incOld ); 180 calendarResource->deleteJournal( (Journal *) incOld );
179 else if ( incOld->type() == "Todo" ) 181 else if ( incOld->type() == "Todo" )
180 calendarResource->deleteTodo( (Todo *) incOld ); 182 calendarResource->deleteTodo( (Todo *) incOld );
181 else if ( incOld->type() == "Event" ) 183 else if ( incOld->type() == "Event" )
182 calendarResource->deleteEvent( (Event *) incOld ); 184 calendarResource->deleteEvent( (Event *) incOld );
183 185 qDebug("*********change incidence %s ",cl->summary().latin1());
184 if ( cl->type() == "Journal" ) 186 if ( cl->type() == "Journal" )
185 calendarResource->addJournal( (Journal *) cl, res ); 187 calendarResource->addJournal( (Journal *) cl, res );
186 else if ( cl->type() == "Todo" ) 188 else if ( cl->type() == "Todo" )
187 calendarResource->addTodo( (Todo *) cl, res ); 189 calendarResource->addTodo( (Todo *) cl, res );
188 else if ( cl->type() == "Event" ) 190 else if ( cl->type() == "Event" )
189 calendarResource->addEvent( (Event *) cl, res ); 191 calendarResource->addEvent( (Event *) cl, res );
190 192
191 } else { 193 } else {
192 if ( incOld ) { 194 Incidence* cl = (*it)->clone();
193 qDebug("ERROR: no resource found for old incidence "); 195 qDebug("*********add incidence %s ",cl->summary().latin1());
194 if ( incOld->type() == "Journal" ) 196 calendarResource->addIncidence( cl );
195 calendarResource->deleteJournal( (Journal *) incOld ); 197 ++add;
196 else if ( incOld->type() == "Todo" ) 198 }
197 calendarResource->deleteTodo( (Todo *) incOld ); 199 } else { // maybe added
198 else if ( incOld->type() == "Event" ) 200 Incidence *incOld = calendarResource->incidence( (*it)->uid() );
199 calendarResource->deleteEvent( (Event *) incOld ); 201 if ( !incOld ) { //added
200 202 Incidence* cl = (*it)->clone();
201 } 203 qDebug("*********add incidence %s ",cl->summary().latin1());
202 calendarResource->addIncidence( cl ); 204 calendarResource->addIncidence( cl );
203 ++add; 205 ++add;
204 } 206 }
205 } else { // added
206 Incidence* cl = (*it)->clone();
207 calendarResource->addIncidence( cl );
208 ++add;
209 } 207 }
210 } 208 }
211 KCal::Incidence::List allInc = calendarResource->rawIncidences(); 209 KCal::Incidence::List allInc = calendarResource->rawIncidences();
212 210
213 for( it = allInc.begin(); it != allInc.end(); ++it ) { 211 for( it = allInc.begin(); it != allInc.end(); ++it ) {
214 ResourceCalendar * re = calendarResource->resource( (*it) ); 212 ResourceCalendar * re = calendarResource->resource( (*it) );
215 if ( re && !re->readOnly() ) { 213 if ( re && !re->readOnly() ) {
216 Incidence* cl = localCalendar->incidence( (*it)->uid() ); 214 Incidence* cl = localCalendar->incidence( (*it)->uid() );
217 if ( !cl ) { 215 if ( !cl ) {
218 ++del; 216 ++del;
219 cl = (*it); 217 cl = (*it);
220 if ( cl->type() == "Journal" ) 218 if ( cl->type() == "Journal" )
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index f727cd4..ff1db2c 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -748,25 +748,25 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
748 //qDebug(" not loc changed "); 748 //qDebug(" not loc changed ");
749 lastSync = localMod.addDays( 1 ); 749 lastSync = localMod.addDays( 1 );
750 if ( remCh ) 750 if ( remCh )
751 remoteMod =( lastSync.addDays( 1 ) ); 751 remoteMod =( lastSync.addDays( 1 ) );
752 752
753 } 753 }
754 } 754 }
755 full = true; 755 full = true;
756 if ( mode < SYNC_PREF_ASK ) 756 if ( mode < SYNC_PREF_ASK )
757 mode = SYNC_PREF_ASK; 757 mode = SYNC_PREF_ASK;
758 } else { 758 } else {
759 if ( localMod == remoteMod ) 759 if ( localMod == remoteMod )
760 if ( local->revision() == remote->revision() ) 760 // if ( local->revision() == remote->revision() )
761 return 0; 761 return 0;
762 762
763 } 763 }
764 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 764 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
765 765
766 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 766 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
767 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 767 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
768 //full = true; //debug only 768 //full = true; //debug only
769 if ( full ) { 769 if ( full ) {
770 bool equ = false; 770 bool equ = false;
771 if ( local->type() == "Event" ) { 771 if ( local->type() == "Event" ) {
772 equ = (*((Event*) local) == *((Event*) remote)); 772 equ = (*((Event*) local) == *((Event*) remote));
@@ -923,29 +923,26 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
923 int changedRemote = 0; 923 int changedRemote = 0;
924 //QPtrList<Event> el = local->rawEvents(); 924 //QPtrList<Event> el = local->rawEvents();
925 Event* eventR; 925 Event* eventR;
926 QString uid; 926 QString uid;
927 int take; 927 int take;
928 Event* eventL; 928 Event* eventL;
929 Event* eventRSync; 929 Event* eventRSync;
930 Event* eventLSync; 930 Event* eventLSync;
931 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 931 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
932 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 932 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
933 bool fullDateRange = false; 933 bool fullDateRange = false;
934 local->resetTempSyncStat(); 934 local->resetTempSyncStat();
935#ifdef DESKTOP_VERSION 935 if ( mSyncKDE )
936 //Needed for KDE - OL sync 936 remote->resetPilotStat(1);
937 local->resetPilotStat();
938 remote->resetPilotStat();
939#endif
940 mLastCalendarSync = QDateTime::currentDateTime(); 937 mLastCalendarSync = QDateTime::currentDateTime();
941 QDateTime modifiedCalendar = mLastCalendarSync;; 938 QDateTime modifiedCalendar = mLastCalendarSync;;
942 eventLSync = getLastSyncEvent(); 939 eventLSync = getLastSyncEvent();
943 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 940 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
944 if ( eventR ) { 941 if ( eventR ) {
945 eventRSync = (Event*) eventR->clone(); 942 eventRSync = (Event*) eventR->clone();
946 remote->deleteEvent(eventR ); 943 remote->deleteEvent(eventR );
947 944
948 } else { 945 } else {
949 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 946 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
950 eventRSync = (Event*)eventLSync->clone(); 947 eventRSync = (Event*)eventLSync->clone();
951 } else { 948 } else {
@@ -960,25 +957,25 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
960 } 957 }
961 if ( eventLSync->dtStart() == mLastCalendarSync ) 958 if ( eventLSync->dtStart() == mLastCalendarSync )
962 fullDateRange = true; 959 fullDateRange = true;
963 960
964 if ( ! fullDateRange ) { 961 if ( ! fullDateRange ) {
965 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 962 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
966 963
967 // 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() );
968 //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());
969 fullDateRange = true; 966 fullDateRange = true;
970 } 967 }
971 } 968 }
972 if ( fullDateRange ) 969 if ( fullDateRange && !mSyncKDE )
973 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 970 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
974 else 971 else
975 mLastCalendarSync = eventLSync->dtStart(); 972 mLastCalendarSync = eventLSync->dtStart();
976 // for resyncing if own file has changed 973 // for resyncing if own file has changed
977 if ( mCurrentSyncDevice == "deleteaftersync" ) { 974 if ( mCurrentSyncDevice == "deleteaftersync" ) {
978 mLastCalendarSync = loadedFileVersion; 975 mLastCalendarSync = loadedFileVersion;
979 qDebug("setting mLastCalendarSync "); 976 qDebug("setting mLastCalendarSync ");
980 } 977 }
981 //qDebug("*************************** "); 978 //qDebug("*************************** ");
982 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); 979 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() );
983 QPtrList<Incidence> er = remote->rawIncidences(); 980 QPtrList<Incidence> er = remote->rawIncidences();
984 Incidence* inR = er.first(); 981 Incidence* inR = er.first();
@@ -1022,34 +1019,36 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1022 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1019 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1023 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1020 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1024 else 1021 else
1025 idS = inR->IDStr(); 1022 idS = inR->IDStr();
1026 remote->deleteIncidence( inR ); 1023 remote->deleteIncidence( inR );
1027 if ( inL->revision() < maxrev ) 1024 if ( inL->revision() < maxrev )
1028 inL->setRevision( maxrev ); 1025 inL->setRevision( maxrev );
1029 inR = inL->clone(); 1026 inR = inL->clone();
1030 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1027 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1031 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1028 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1032 inR->setIDStr( idS ); 1029 inR->setIDStr( idS );
1033 remote->addIncidence( inR ); 1030 remote->addIncidence( inR );
1034#ifdef DESKTOP_VERSION 1031 if ( mSyncKDE )
1035 inR->setPilotId( 1 ); 1032 inR->setPilotId( 2 );
1036#endif
1037 ++changedRemote; 1033 ++changedRemote;
1038 } else { 1034 } else {
1039 if ( inR->revision() < maxrev ) 1035 if ( inR->revision() < maxrev )
1040 inR->setRevision( maxrev ); 1036 inR->setRevision( maxrev );
1041 idS = inL->IDStr(); 1037 idS = inL->IDStr();
1038 int pid = inL->pilotId();
1042 local->deleteIncidence( inL ); 1039 local->deleteIncidence( inL );
1043 inL = inR->clone(); 1040 inL = inR->clone();
1041 if ( mSyncKDE )
1042 inL->setPilotId( pid );
1044 inL->setIDStr( idS ); 1043 inL->setIDStr( idS );
1045 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1044 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1046 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1045 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1047 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1046 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1048 } 1047 }
1049 local->addIncidence( inL ); 1048 local->addIncidence( inL );
1050 ++changedLocal; 1049 ++changedLocal;
1051 } 1050 }
1052 } 1051 }
1053 } else { // no conflict 1052 } else { // no conflict
1054 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1053 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1055 QString des = eventLSync->description(); 1054 QString des = eventLSync->description();
@@ -1172,26 +1171,28 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1172 } 1171 }
1173 } 1172 }
1174 bar.hide(); 1173 bar.hide();
1175 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1174 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1176 eventLSync->setReadOnly( false ); 1175 eventLSync->setReadOnly( false );
1177 eventLSync->setDtStart( mLastCalendarSync ); 1176 eventLSync->setDtStart( mLastCalendarSync );
1178 eventRSync->setDtStart( mLastCalendarSync ); 1177 eventRSync->setDtStart( mLastCalendarSync );
1179 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1178 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1180 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1179 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1181 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1180 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1182 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1181 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1183 eventLSync->setReadOnly( true ); 1182 eventLSync->setReadOnly( true );
1184 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1183 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal...
1185 remote->addEvent( eventRSync ); 1184 remote->addEvent( eventRSync );
1185 else
1186 delete eventRSync;
1186 QString mes; 1187 QString mes;
1187 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1188 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1188 QString delmess; 1189 QString delmess;
1189 if ( delFut ) { 1190 if ( delFut ) {
1190 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1191 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1191 mes += delmess; 1192 mes += delmess;
1192 } 1193 }
1193 if ( mSyncManager->mShowSyncSummary ) { 1194 if ( mSyncManager->mShowSyncSummary ) {
1194 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1195 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1195 } 1196 }
1196 qDebug( mes ); 1197 qDebug( mes );
1197 mCalendar->checkAlarmForIncidence( 0, true ); 1198 mCalendar->checkAlarmForIncidence( 0, true );
@@ -3725,30 +3726,36 @@ NavigatorBar *CalendarView::navigatorBar()
3725 3726
3726 3727
3727void CalendarView::keyPressEvent ( QKeyEvent *e) 3728void CalendarView::keyPressEvent ( QKeyEvent *e)
3728{ 3729{
3729 //qDebug(" alendarView::keyPressEvent "); 3730 //qDebug(" alendarView::keyPressEvent ");
3730 e->ignore(); 3731 e->ignore();
3731} 3732}
3732 3733
3733 3734
3734bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3735bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3735{ 3736{
3736 // mSyncManager = manager; 3737 // mSyncManager = manager;
3738 mSyncKDE = false;
3739 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3740 qDebug("SyncKDE request detected!");
3741 mSyncKDE = true;
3742 }
3737 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3743 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3738 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3744 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3739 return syncCalendar( filename, mode ); 3745 return syncCalendar( filename, mode );
3740} 3746}
3741bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3747bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3742{ 3748{
3749 mSyncKDE = false;
3743 //mSyncManager = manager; 3750 //mSyncManager = manager;
3744 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3751 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3745 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3752 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3746 if ( resource == "sharp" ) 3753 if ( resource == "sharp" )
3747 syncExternal( 0 ); 3754 syncExternal( 0 );
3748 if ( resource == "phone" ) 3755 if ( resource == "phone" )
3749 syncExternal( 1 ); 3756 syncExternal( 1 );
3750 // pending setmodified 3757 // pending setmodified
3751 return true; 3758 return true;
3752} 3759}
3753void CalendarView::setSyncManager(KSyncManager* manager) 3760void CalendarView::setSyncManager(KSyncManager* manager)
3754{ 3761{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 9f56cc8..1cd896d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -478,24 +478,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
478 //Attendee* getYourAttendee(Event *event); 478 //Attendee* getYourAttendee(Event *event);
479 protected: 479 protected:
480 void schedule(Scheduler::Method, Incidence *incidence = 0); 480 void schedule(Scheduler::Method, Incidence *incidence = 0);
481 481
482 // returns KMsgBox::OKCandel() 482 // returns KMsgBox::OKCandel()
483 int msgItemDelete(); 483 int msgItemDelete();
484 void showEventEditor(); 484 void showEventEditor();
485 void showTodoEditor(); 485 void showTodoEditor();
486 void writeLocale(); 486 void writeLocale();
487 Todo *selectedTodo(); 487 Todo *selectedTodo();
488 488
489 private: 489 private:
490 bool mSyncKDE;
490 KSyncManager* mSyncManager; 491 KSyncManager* mSyncManager;
491 AlarmDialog * mAlarmDialog; 492 AlarmDialog * mAlarmDialog;
492 QString mAlarmNotification; 493 QString mAlarmNotification;
493 QString mSuspendAlarmNotification; 494 QString mSuspendAlarmNotification;
494 QTimer* mSuspendTimer; 495 QTimer* mSuspendTimer;
495 QTimer* mAlarmTimer; 496 QTimer* mAlarmTimer;
496 QTimer* mRecheckAlarmTimer; 497 QTimer* mRecheckAlarmTimer;
497 void computeAlarm( QString ); 498 void computeAlarm( QString );
498 void startAlarm( QString, QString ); 499 void startAlarm( QString, QString );
499 void setSyncEventsReadOnly(); 500 void setSyncEventsReadOnly();
500 501
501 QDateTime loadedFileVersion; 502 QDateTime loadedFileVersion;
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index eeb5f48..52daaaa 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -240,38 +240,38 @@ QPtrList<Incidence> Calendar::incidences()
240 QPtrList<Event> e = events(); 240 QPtrList<Event> e = events();
241 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 241 for( i = e.first(); i; i = e.next() ) incidences.append( i );
242 242
243 QPtrList<Todo> t = todos(); 243 QPtrList<Todo> t = todos();
244 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 244 for( i = t.first(); i; i = t.next() ) incidences.append( i );
245 245
246 QPtrList<Journal> j = journals(); 246 QPtrList<Journal> j = journals();
247 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 247 for( i = j.first(); i; i = j.next() ) incidences.append( i );
248 248
249 return incidences; 249 return incidences;
250} 250}
251 251
252void Calendar::resetPilotStat() 252void Calendar::resetPilotStat(int id )
253{ 253{
254 QPtrList<Incidence> incidences; 254 QPtrList<Incidence> incidences;
255 255
256 Incidence *i; 256 Incidence *i;
257 257
258 QPtrList<Event> e = rawEvents(); 258 QPtrList<Event> e = rawEvents();
259 for( i = e.first(); i; i = e.next() ) i->setPilotId( 0 ); 259 for( i = e.first(); i; i = e.next() ) i->setPilotId( id );
260 260
261 QPtrList<Todo> t = rawTodos(); 261 QPtrList<Todo> t = rawTodos();
262 for( i = t.first(); i; i = t.next() ) i->setPilotId( 0 ); 262 for( i = t.first(); i; i = t.next() ) i->setPilotId( id );
263 263
264 QPtrList<Journal> j = journals(); 264 QPtrList<Journal> j = journals();
265 for( i = j.first(); i; i = j.next() ) i->setPilotId( 0 ); 265 for( i = j.first(); i; i = j.next() ) i->setPilotId( id );
266} 266}
267void Calendar::resetTempSyncStat() 267void Calendar::resetTempSyncStat()
268{ 268{
269 QPtrList<Incidence> incidences; 269 QPtrList<Incidence> incidences;
270 270
271 Incidence *i; 271 Incidence *i;
272 272
273 QPtrList<Event> e = rawEvents(); 273 QPtrList<Event> e = rawEvents();
274 for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 274 for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
275 275
276 QPtrList<Todo> t = rawTodos(); 276 QPtrList<Todo> t = rawTodos();
277 for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 277 for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index d5294eb..b801186 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -58,25 +58,25 @@ namespace KCal {
58 Calendar. 58 Calendar.
59*/ 59*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 Calendar(); 65 Calendar();
66 Calendar(const QString &timeZoneId); 66 Calendar(const QString &timeZoneId);
67 virtual ~Calendar(); 67 virtual ~Calendar();
68 void deleteIncidence(Incidence *in); 68 void deleteIncidence(Incidence *in);
69 void resetTempSyncStat(); 69 void resetTempSyncStat();
70 void resetPilotStat(); 70 void resetPilotStat(int id);
71 /** 71 /**
72 Clears out the current calendar, freeing all used memory etc. 72 Clears out the current calendar, freeing all used memory etc.
73 */ 73 */
74 virtual void close() = 0; 74 virtual void close() = 0;
75 75
76 /** 76 /**
77 Sync changes in memory to persistant storage. 77 Sync changes in memory to persistant storage.
78 */ 78 */
79 virtual void save() = 0; 79 virtual void save() = 0;
80 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 80 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
81 virtual bool isSaving() { return false; } 81 virtual bool isSaving() { return false; }
82 82