summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile30
-rw-r--r--korganizer/calendarview.cpp47
-rw-r--r--libkcal/sharpformat.cpp15
-rw-r--r--libkcal/syncdefines.h22
-rw-r--r--libkdepim/ksyncprofile.h10
5 files changed, 62 insertions, 62 deletions
diff --git a/Makefile b/Makefile
index 826e70e..19c57e5 100644
--- a/Makefile
+++ b/Makefile
@@ -23,25 +23,19 @@ SUBDIRS_MICROKDE = \
23 kabc/plugins/dir \ 23 kabc/plugins/dir \
24 korganizer \ 24 korganizer \
25 kalarmd \ 25 kalarmd \
26 kaddressbook 26 kaddressbook
27 27
28SUBDIRS_QTOPIA_PLUGIN = \ 28SUBDIRS_QTOPIA_PLUGIN = \
29 kabc/converter/qtopia \ 29 kabc/plugins/qtopia
30 kabc/plugins/qtopia \
31 kaddressbook/xxport/qtopia
32 30
33SUBDIRS_OPIE_PLUGIN = \ 31SUBDIRS_OPIE_PLUGIN = \
34 kabc/converter/opie \ 32 kabc/plugins/opie
35 kabc/plugins/opie \
36 kaddressbook/xxport/opie
37 33
38SUBDIRS_SHARP_PLUGIN = \ 34SUBDIRS_SHARP_PLUGIN = \
39 kabc/converter/sharpdtm \ 35 kabc/plugins/sharpdtm
40 kabc/plugins/sharpdtm \
41 kaddressbook/xxport/sharpdtm
42 36
43SUBDIRS_LDAP_PLUGIN = \ 37SUBDIRS_LDAP_PLUGIN = \
44 kabc/plugins/ldap 38 kabc/plugins/ldap
45 39
46SUBDIRS_MICROMAIL = \ 40SUBDIRS_MICROMAIL = \
47 kmicromail/libetpan \ 41 kmicromail/libetpan \
@@ -145,16 +139,16 @@ variable_test: variable_info
145 ifdef BUILD_NO_MICROMAIL 139 ifdef BUILD_NO_MICROMAIL
146 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) 140 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL)
147 endif 141 endif
148 ifdef BUILD_NO_SHARP_PLUGIN 142 ifdef BUILD_NO_SHARP_PLUGIN
149 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) 143 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN)
150 else 144 else
151 ifndef SHARPDTMSDK 145 ifndef SHARPDTMSDK
152 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) 146 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK)
153 $(error SHARPDTMSDK is not defined) 147 $(error SHARPDTMSDK is not defined)
154 endif 148 endif
155 endif 149 endif
156 @echo -------------------------------------- 150 @echo --------------------------------------
157 151
158 152
159objects: 153objects:
160 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done 154 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
@@ -193,15 +187,12 @@ tmake: objects \
193 libkdepim/Makefile$(PLATFORM) \ 187 libkdepim/Makefile$(PLATFORM) \
194 korganizer/Makefile$(PLATFORM) \ 188 korganizer/Makefile$(PLATFORM) \
195 kalarmd/Makefile$(PLATFORM) \ 189 kalarmd/Makefile$(PLATFORM) \
196 libical/src/libical/Makefile$(PLATFORM) \ 190 libical/src/libical/Makefile$(PLATFORM) \
197 libical/src/libicalss/Makefile$(PLATFORM) \ 191 libical/src/libicalss/Makefile$(PLATFORM) \
198 kabc/Makefile$(PLATFORM) \ 192 kabc/Makefile$(PLATFORM) \
199 kabc/converter/opie/Makefile$(PLATFORM) \
200 kabc/converter/qtopia/Makefile$(PLATFORM) \
201 kabc/converter/sharpdtm/Makefile$(PLATFORM) \
202 kabc/formats/binary/Makefile$(PLATFORM) \ 193 kabc/formats/binary/Makefile$(PLATFORM) \
203 kabc/plugins/file/Makefile$(PLATFORM) \ 194 kabc/plugins/file/Makefile$(PLATFORM) \
204 kabc/plugins/dir/Makefile$(PLATFORM) \ 195 kabc/plugins/dir/Makefile$(PLATFORM) \
205 kabc/plugins/ldap/Makefile$(PLATFORM) \ 196 kabc/plugins/ldap/Makefile$(PLATFORM) \
206 kabc/plugins/opie/Makefile$(PLATFORM) \ 197 kabc/plugins/opie/Makefile$(PLATFORM) \
207 kabc/plugins/qtopia/Makefile$(PLATFORM) \ 198 kabc/plugins/qtopia/Makefile$(PLATFORM) \
@@ -210,13 +201,12 @@ tmake: objects \
210 kaddressbook/xxport/qtopia/Makefile$(PLATFORM) \ 201 kaddressbook/xxport/qtopia/Makefile$(PLATFORM) \
211 kaddressbook/xxport/sharpdtm/Makefile$(PLATFORM) \ 202 kaddressbook/xxport/sharpdtm/Makefile$(PLATFORM) \
212 kaddressbook/Makefile$(PLATFORM) \ 203 kaddressbook/Makefile$(PLATFORM) \
213 kmicromail/Makefile$(PLATFORM) \ 204 kmicromail/Makefile$(PLATFORM) \
214 kmicromail/libetpan/Makefile$(PLATFORM) \ 205 kmicromail/libetpan/Makefile$(PLATFORM) \
215 kmicromail/libmailwrapper/Makefile$(PLATFORM) 206 kmicromail/libmailwrapper/Makefile$(PLATFORM)
216
217 207
218 208
219 209
220qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro 210qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
221 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) 211 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM)
222 212
@@ -242,22 +232,12 @@ libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
242libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro 232libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
243 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) 233 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM)
244 234
245kabc/Makefile$(PLATFORM): kabc/kabcE.pro 235kabc/Makefile$(PLATFORM): kabc/kabcE.pro
246 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) 236 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM)
247 237
248kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieE.pro
249 cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM)
250
251kabc/converter/qtopia/Makefile$(PLATFORM): kabc/converter/qtopia/qtopiaE.pro
252 cd kabc/converter/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM)
253
254kabc/converter/sharpdtm/Makefile$(PLATFORM): kabc/converter/sharpdtm/sharpdtmE.pro
255 cd kabc/converter/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM)
256
257
258kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro 238kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
259 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) 239 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
260 240
261kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro 241kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
262 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) 242 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM)
263 243
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 58b3d70..fd68dc4 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -126,15 +126,13 @@
126#endif 126#endif
127using namespace KOrg; 127using namespace KOrg;
128using namespace KCal; 128using namespace KCal;
129extern int globalFlagBlockAgenda; 129extern int globalFlagBlockAgenda;
130extern int globalFlagBlockStartup; 130extern int globalFlagBlockStartup;
131 131
132#define SYNC_MODE_NORMAL 0 132
133#define SYNC_MODE_SHARP 1
134#define SYNC_MODE_QTOPIA 2
135 133
136class KOBeamPrefs : public QDialog 134class KOBeamPrefs : public QDialog
137{ 135{
138 public: 136 public:
139 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 137 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
140 QDialog( parent, name, true ) 138 QDialog( parent, name, true )
@@ -724,16 +722,16 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
724 // int zaurusStat() const; 722 // int zaurusStat() const;
725 // 0 equal 723 // 0 equal
726 // 1 take local 724 // 1 take local
727 // 2 take remote 725 // 2 take remote
728 // 3 cancel 726 // 3 cancel
729 QDateTime lastSync = mLastCalendarSync; 727 QDateTime lastSync = mLastCalendarSync;
730 if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { 728 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
731 bool remCh, locCh; 729 bool remCh, locCh;
732 remCh = ( remote->zaurusUid() != local->zaurusUid() ); 730 remCh = ( remote->zaurusUid() != local->zaurusUid() );
733 locCh = ( local->zaurusStat() != local->revision() ); 731 locCh = ( local->lastModified() > mLastCalendarSync );
734 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); 732 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() );
735 if ( !remCh && ! locCh ) { 733 if ( !remCh && ! locCh ) {
736 //qDebug("both not changed "); 734 //qDebug("both not changed ");
737 lastSync = local->lastModified().addDays(1); 735 lastSync = local->lastModified().addDays(1);
738 } else { 736 } else {
739 if ( locCh ) { 737 if ( locCh ) {
@@ -747,14 +745,14 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
747 if ( remCh ) 745 if ( remCh )
748 remote->setLastModified( lastSync.addDays( 1 ) ); 746 remote->setLastModified( lastSync.addDays( 1 ) );
749 747
750 } 748 }
751 } 749 }
752 full = true; 750 full = true;
753 if ( mode < 3 ) 751 if ( mode < SYNC_PREF_ASK )
754 mode = 3; 752 mode = SYNC_PREF_ASK;
755 } else { 753 } else {
756 if ( local->lastModified() == remote->lastModified() ) 754 if ( local->lastModified() == remote->lastModified() )
757 if ( local->revision() == remote->revision() ) 755 if ( local->revision() == remote->revision() )
758 return 0; 756 return 0;
759 757
760 } 758 }
@@ -771,48 +769,48 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
771 else if ( local->type() =="Todo" ) 769 else if ( local->type() =="Todo" )
772 equ = (*((Todo*) local) == (*(Todo*) remote)); 770 equ = (*((Todo*) local) == (*(Todo*) remote));
773 else if ( local->type() =="Journal" ) 771 else if ( local->type() =="Journal" )
774 equ = (*((Journal*) local) == *((Journal*) remote)); 772 equ = (*((Journal*) local) == *((Journal*) remote));
775 if ( equ ) { 773 if ( equ ) {
776 //qDebug("equal "); 774 //qDebug("equal ");
777 if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { 775 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
778 local->setZaurusUid( remote->zaurusUid() ); 776 local->setZaurusUid( remote->zaurusUid() );
779 } 777 }
780 if ( mode < 4 ) 778 if ( mode < SYNC_PREF_FORCE_LOCAL )
781 return 0; 779 return 0;
782 780
783 }//else //debug only 781 }//else //debug only
784 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 782 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
785 } 783 }
786 int result; 784 int result;
787 bool localIsNew; 785 bool localIsNew;
788 if ( full && mode < 2 ) 786 if ( full && mode < SYNC_PREF_NEWEST )
789 mode = 3; 787 mode = SYNC_PREF_ASK;
790 788
791 switch( mode ) { 789 switch( mode ) {
792 case 0: 790 case SYNC_PREF_LOCAL:
793 if ( lastSync > remote->lastModified() ) 791 if ( lastSync > remote->lastModified() )
794 return 1; 792 return 1;
795 if ( lastSync > local->lastModified() ) 793 if ( lastSync > local->lastModified() )
796 return 2; 794 return 2;
797 return 1; 795 return 1;
798 break; 796 break;
799 case 1: 797 case SYNC_PREF_REMOTE:
800 if ( lastSync > remote->lastModified() ) 798 if ( lastSync > remote->lastModified() )
801 return 1; 799 return 1;
802 if ( lastSync > local->lastModified() ) 800 if ( lastSync > local->lastModified() )
803 return 2; 801 return 2;
804 return 2; 802 return 2;
805 break; 803 break;
806 case 2: 804 case SYNC_PREF_NEWEST:
807 if ( local->lastModified() > remote->lastModified() ) 805 if ( local->lastModified() > remote->lastModified() )
808 return 1; 806 return 1;
809 else 807 else
810 return 2; 808 return 2;
811 break; 809 break;
812 case 3: 810 case SYNC_PREF_ASK:
813 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 811 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
814 if ( lastSync > remote->lastModified() ) 812 if ( lastSync > remote->lastModified() )
815 return 1; 813 return 1;
816 if ( lastSync > local->lastModified() ) 814 if ( lastSync > local->lastModified() )
817 return 2; 815 return 2;
818 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 816 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
@@ -832,20 +830,21 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
832 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 830 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
833 getEventViewerDialog()->showMe(); 831 getEventViewerDialog()->showMe();
834 result = getEventViewerDialog()->executeS( localIsNew ); 832 result = getEventViewerDialog()->executeS( localIsNew );
835 return result; 833 return result;
836 834
837 break; 835 break;
838 case 4: 836 case SYNC_PREF_FORCE_LOCAL:
839 return 1; 837 return 1;
840 break; 838 break;
841 case 5: 839 case SYNC_PREF_FORCE_REMOTE:
842 return 2; 840 return 2;
843 break; 841 break;
844 842
845 default: 843 default:
844 // SYNC_PREF_TAKE_BOTH not implemented
846 break; 845 break;
847 } 846 }
848 return 0; 847 return 0;
849} 848}
850Event* CalendarView::getLastSyncEvent() 849Event* CalendarView::getLastSyncEvent()
851{ 850{
@@ -993,19 +992,19 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
993 local->deleteIncidence( inL ); 992 local->deleteIncidence( inL );
994 local->addIncidence( inR->clone() ); 993 local->addIncidence( inR->clone() );
995 ++changedLocal; 994 ++changedLocal;
996 } 995 }
997 } 996 }
998 } else { // no conflict 997 } else { // no conflict
999 if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { 998 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1000 QString des = eventLSync->description(); 999 QString des = eventLSync->description();
1001 QString pref = "e"; 1000 QString pref = "e";
1002 if ( inR->type() == "Todo" ) 1001 if ( inR->type() == "Todo" )
1003 pref = "t"; 1002 pref = "t";
1004 if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it 1003 if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it
1005 inR->setZaurusStat( -3 ); 1004 inR->setZaurusStat( SYNC_TEMPSTATE_DELETE );
1006 //remote->deleteIncidence( inR ); 1005 //remote->deleteIncidence( inR );
1007 ++deletedEventR; 1006 ++deletedEventR;
1008 } else { 1007 } else {
1009 inR->setLastModified( modifiedCalendar ); 1008 inR->setLastModified( modifiedCalendar );
1010 local->addIncidence( inR->clone() ); 1009 local->addIncidence( inR->clone() );
1011 ++addedEvent; 1010 ++addedEvent;
@@ -1042,18 +1041,18 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1042 bar.setProgress( incCounter ); 1041 bar.setProgress( incCounter );
1043 ++incCounter; 1042 ++incCounter;
1044 uid = inL->uid(); 1043 uid = inL->uid();
1045 bool skipIncidence = false; 1044 bool skipIncidence = false;
1046 if ( uid.left(21) == QString("last-syncEvent-device") ) 1045 if ( uid.left(21) == QString("last-syncEvent-device") )
1047 skipIncidence = true; 1046 skipIncidence = true;
1048 if ( mGlobalSyncMode == SYNC_MODE_SHARP && inL->type() == "Journal" ) 1047 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1049 skipIncidence = true; 1048 skipIncidence = true;
1050 if ( !skipIncidence ) { 1049 if ( !skipIncidence ) {
1051 inR = remote->incidence( uid ); 1050 inR = remote->incidence( uid );
1052 if ( ! inR ) { 1051 if ( ! inR ) {
1053 if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { 1052 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1054 if ( inL->zaurusId() >= 0 && mode != 4 ) { 1053 if ( inL->zaurusId() >= 0 && mode != 4 ) {
1055 local->deleteIncidence( inL ); 1054 local->deleteIncidence( inL );
1056 ++deletedEventL; 1055 ++deletedEventL;
1057 } else { 1056 } else {
1058 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1057 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1059 inL->setZaurusId( -1 ); 1058 inL->setZaurusId( -1 );
@@ -1138,13 +1137,13 @@ bool CalendarView::syncCalendar(QString filename, int mode)
1138 updateView(); 1137 updateView();
1139 return syncOK; 1138 return syncOK;
1140} 1139}
1141void CalendarView::syncSharp() 1140void CalendarView::syncSharp()
1142{ 1141{
1143#ifndef DESKTOP_VERSION 1142#ifndef DESKTOP_VERSION
1144 mGlobalSyncMode = SYNC_MODE_SHARP; 1143 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1145 //mCurrentSyncDevice = "sharp-DTM"; 1144 //mCurrentSyncDevice = "sharp-DTM";
1146 if ( KOPrefs::instance()->mAskForPreferences ) 1145 if ( KOPrefs::instance()->mAskForPreferences )
1147 edit_sync_options(); 1146 edit_sync_options();
1148 qApp->processEvents(); 1147 qApp->processEvents();
1149 CalendarLocal* calendar = new CalendarLocal(); 1148 CalendarLocal* calendar = new CalendarLocal();
1150 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1149 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
@@ -1157,23 +1156,25 @@ void CalendarView::syncSharp()
1157 qApp->processEvents(); 1156 qApp->processEvents();
1158 if ( syncOK ) { 1157 if ( syncOK ) {
1159 if ( KOPrefs::instance()->mWriteBackFile ) 1158 if ( KOPrefs::instance()->mWriteBackFile )
1160 { 1159 {
1161 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1160 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1162 Incidence* inc = iL.first(); 1161 Incidence* inc = iL.first();
1162 /* obsolete
1163 while ( inc ) { 1163 while ( inc ) {
1164 inc->setZaurusStat( inc->revision () ); 1164 inc->setZaurusStat( inc->revision () );
1165 inc = iL.next(); 1165 inc = iL.next();
1166 } 1166 }
1167 */
1167 // pending: clean last sync event description 1168 // pending: clean last sync event description
1168 sharpFormat.save(calendar); 1169 sharpFormat.save(calendar);
1169 iL = calendar->rawIncidences(); 1170 iL = calendar->rawIncidences();
1170 inc = iL.first(); 1171 inc = iL.first();
1171 Incidence* loc; 1172 Incidence* loc;
1172 while ( inc ) { 1173 while ( inc ) {
1173 if ( inc->zaurusStat() == -4 ) { 1174 if ( inc->zaurusStat() == SYNC_TEMPSTATE_NEW_ID ) {
1174 loc = mCalendar->incidence(inc->uid() ); 1175 loc = mCalendar->incidence(inc->uid() );
1175 if ( loc ) { 1176 if ( loc ) {
1176 loc->setZaurusId( inc->zaurusId() ); 1177 loc->setZaurusId( inc->zaurusId() );
1177 loc->setZaurusUid( inc->zaurusUid() ); 1178 loc->setZaurusUid( inc->zaurusUid() );
1178 } 1179 }
1179 } 1180 }
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index f83f72e..973f19d 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -39,12 +39,13 @@
39#include "calendar.h" 39#include "calendar.h"
40#include "alarm.h" 40#include "alarm.h"
41#include "recurrence.h" 41#include "recurrence.h"
42#include "calendarlocal.h" 42#include "calendarlocal.h"
43 43
44#include "sharpformat.h" 44#include "sharpformat.h"
45#include "syncdefines.h"
45 46
46using namespace KCal; 47using namespace KCal;
47 48
48//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY 49//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY
49// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 50// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
50 51
@@ -88,13 +89,13 @@ class SharpParser : public QObject
88 if ( event ) 89 if ( event )
89 event = (Event*)event->clone(); 90 event = (Event*)event->clone();
90 else 91 else
91 event = new Event; 92 event = new Event;
92 event->setZaurusId( attList[0].toInt() ); 93 event->setZaurusId( attList[0].toInt() );
93 event->setZaurusUid( cSum ); 94 event->setZaurusUid( cSum );
94 event->setZaurusStat( -2 ); 95 event->setZaurusStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
95 96
96 event->setSummary( attList[2] ); 97 event->setSummary( attList[2] );
97 event->setLocation( attList[3] ); 98 event->setLocation( attList[3] );
98 event->setDescription( attList[4] ); 99 event->setDescription( attList[4] );
99 if ( attList[7] == "1" ) { 100 if ( attList[7] == "1" ) {
100 event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) )); 101 event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) ));
@@ -199,13 +200,13 @@ class SharpParser : public QObject
199//1,,,,,1,4,Loch zumachen,"" 200//1,,,,,1,4,Loch zumachen,""
200//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " 201//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
201//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes 202//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes
202 203
203 todo->setZaurusId( attList[0].toInt() ); 204 todo->setZaurusId( attList[0].toInt() );
204 todo->setZaurusUid( cSum ); 205 todo->setZaurusUid( cSum );
205 todo->setZaurusStat( -2 ); 206 todo->setZaurusStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
206 207
207 todo->setSummary( attList[7] ); 208 todo->setSummary( attList[7] );
208 todo->setDescription( attList[8]); 209 todo->setDescription( attList[8]);
209 210
210 int priority = attList[6].toInt(); 211 int priority = attList[6].toInt();
211 if ( priority == 0 ) priority = 3; 212 if ( priority == 0 ) priority = 3;
@@ -464,13 +465,13 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
464 bool ok; 465 bool ok;
465 int newnum = templist[0].toInt( &ok ); 466 int newnum = templist[0].toInt( &ok );
466 if ( ok && newnum > 0) { 467 if ( ok && newnum > 0) {
467 retval = newnum; 468 retval = newnum;
468 inc->setZaurusId( newnum ); 469 inc->setZaurusId( newnum );
469 inc->setZaurusUid( getCsum( templist ) ); 470 inc->setZaurusUid( getCsum( templist ) );
470 inc->setZaurusStat( -4 ); 471 inc->setZaurusStat( SYNC_TEMPSTATE_NEW_ID );
471 } 472 }
472 } 473 }
473 } 474 }
474 //qDebug("getNumFromRecord returning : %d ", retval); 475 //qDebug("getNumFromRecord returning : %d ", retval);
475 return retval; 476 return retval;
476} 477}
@@ -503,17 +504,17 @@ bool SharpFormat::save( Calendar *calendar)
503 bool deleteEnt = false; 504 bool deleteEnt = false;
504 bool changeEnt = false; 505 bool changeEnt = false;
505 QString message = i18n("Processing event # "); 506 QString message = i18n("Processing event # ");
506 int procCount = 0; 507 int procCount = 0;
507 while ( ev ) { 508 while ( ev ) {
508 //qDebug("i %d ", ++i); 509 //qDebug("i %d ", ++i);
509 if ( ev->zaurusStat() != -2 ) { 510 if ( ev->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
510 status.setText ( message + QString::number ( ++procCount ) ); 511 status.setText ( message + QString::number ( ++procCount ) );
511 qApp->processEvents(); 512 qApp->processEvents();
512 QString eString = getEventString( ev ); 513 QString eString = getEventString( ev );
513 if ( ev->zaurusStat() == -3 ) { // delete 514 if ( ev->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete
514 // deleting empty strings does not work. 515 // deleting empty strings does not work.
515 // we write first and x and then delete the record with the x 516 // we write first and x and then delete the record with the x
516 eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); 517 eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
517 changeString += eString + "\n"; 518 changeString += eString + "\n";
518 deleteString += eString + "\n"; 519 deleteString += eString + "\n";
519 deleteEnt = true; 520 deleteEnt = true;
@@ -589,17 +590,17 @@ bool SharpFormat::save( Calendar *calendar)
589 QPtrList<Todo> tl = calendar->rawTodos(); 590 QPtrList<Todo> tl = calendar->rawTodos();
590 Todo* to = tl.first(); 591 Todo* to = tl.first();
591 i = 0; 592 i = 0;
592 message = i18n("Processing todo # "); 593 message = i18n("Processing todo # ");
593 procCount = 0; 594 procCount = 0;
594 while ( to ) { 595 while ( to ) {
595 if ( to->zaurusStat() != -2 ) { 596 if ( to->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
596 status.setText ( message + QString::number ( ++procCount ) ); 597 status.setText ( message + QString::number ( ++procCount ) );
597 qApp->processEvents(); 598 qApp->processEvents();
598 QString eString = getTodoString( to ); 599 QString eString = getTodoString( to );
599 if ( to->zaurusStat() == -3 ) { // delete 600 if ( to->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete
600 // deleting empty strings does not work. 601 // deleting empty strings does not work.
601 // we write first and x and then delete the record with the x 602 // we write first and x and then delete the record with the x
602 eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); 603 eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
603 changeString += eString + "\n"; 604 changeString += eString + "\n";
604 deleteString += eString + "\n"; 605 deleteString += eString + "\n";
605 deleteEnt = true; 606 deleteEnt = true;
diff --git a/libkcal/syncdefines.h b/libkcal/syncdefines.h
new file mode 100644
index 0000000..57642ec
--- a/dev/null
+++ b/libkcal/syncdefines.h
@@ -0,0 +1,22 @@
1
2#ifndef _KSYNC_DEFINES_H_
3#define _KSYNC_DEFINES_H_
4
5#define SYNC_PREF_LOCAL 0
6#define SYNC_PREF_REMOTE 1
7#define SYNC_PREF_NEWEST 2
8#define SYNC_PREF_ASK 3
9#define SYNC_PREF_FORCE_LOCAL 4
10#define SYNC_PREF_FORCE_REMOTE 5
11#define SYNC_PREF_TAKE_BOTH 6
12
13#define SYNC_MODE_NORMAL 0
14#define SYNC_MODE_EXTERNAL 1
15
16#define SYNC_TEMPSTATE_INITIAL 0
17#define SYNC_TEMPSTATE_NEW_EXTERNAL -2
18#define SYNC_TEMPSTATE_DELETE -3
19#define SYNC_TEMPSTATE_NEW_ID -4
20
21
22#endif
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h
index 238ffad..3f7f1ac 100644
--- a/libkdepim/ksyncprofile.h
+++ b/libkdepim/ksyncprofile.h
@@ -24,19 +24,15 @@
24#include <qcolor.h> 24#include <qcolor.h>
25#include <qfont.h> 25#include <qfont.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27#include <qobject.h> 27#include <qobject.h>
28#include <qstring.h> 28#include <qstring.h>
29 29
30#define SYNC_PREF_LOCAL 0 30#include <libkcal/syncdefines.h>
31#define SYNC_PREF_REMOTE 1 31
32#define SYNC_PREF_NEWEST 2 32
33#define SYNC_PREF_ASK 3
34#define SYNC_PREF_FORCE_LOCAL 4
35#define SYNC_PREF_FORCE_REMOTE 5
36#define SYNC_PREF_TAKE_BOTH 6
37 33
38class KConfig; 34class KConfig;
39 35
40/** 36/**
41 @short Class for storing a preferences setting 37 @short Class for storing a preferences setting
42 @author Cornelius Schumacher 38 @author Cornelius Schumacher