-rw-r--r-- | libkcal/sharpformat.cpp | 15 | ||||
-rw-r--r-- | libkcal/syncdefines.h | 22 |
2 files changed, 30 insertions, 7 deletions
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index f83f72e..973f19d 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "calendarlocal.h" | 42 | #include "calendarlocal.h" |
43 | 43 | ||
44 | #include "sharpformat.h" | 44 | #include "sharpformat.h" |
45 | #include "syncdefines.h" | ||
45 | 46 | ||
46 | using namespace KCal; | 47 | using namespace KCal; |
47 | 48 | ||
@@ -91,7 +92,7 @@ class SharpParser : public QObject | |||
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] ); |
@@ -202,7 +203,7 @@ class SharpParser : public QObject | |||
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]); |
@@ -467,7 +468,7 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | |||
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 | } |
@@ -506,11 +507,11 @@ bool SharpFormat::save( Calendar *calendar) | |||
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\"" ); |
@@ -592,11 +593,11 @@ bool SharpFormat::save( Calendar *calendar) | |||
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\"" ); |
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 | ||