summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/sharpformat.cpp15
-rw-r--r--libkcal/syncdefines.h22
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
@@ -39,12 +39,13 @@
#include "calendar.h"
#include "alarm.h"
#include "recurrence.h"
#include "calendarlocal.h"
#include "sharpformat.h"
+#include "syncdefines.h"
using namespace KCal;
//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
@@ -88,13 +89,13 @@ class SharpParser : public QObject
if ( event )
event = (Event*)event->clone();
else
event = new Event;
event->setZaurusId( attList[0].toInt() );
event->setZaurusUid( cSum );
- event->setZaurusStat( -2 );
+ event->setZaurusStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
event->setSummary( attList[2] );
event->setLocation( attList[3] );
event->setDescription( attList[4] );
if ( attList[7] == "1" ) {
event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) ));
@@ -199,13 +200,13 @@ class SharpParser : public QObject
//1,,,,,1,4,Loch zumachen,""
//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes
todo->setZaurusId( attList[0].toInt() );
todo->setZaurusUid( cSum );
- todo->setZaurusStat( -2 );
+ todo->setZaurusStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
todo->setSummary( attList[7] );
todo->setDescription( attList[8]);
int priority = attList[6].toInt();
if ( priority == 0 ) priority = 3;
@@ -464,13 +465,13 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
bool ok;
int newnum = templist[0].toInt( &ok );
if ( ok && newnum > 0) {
retval = newnum;
inc->setZaurusId( newnum );
inc->setZaurusUid( getCsum( templist ) );
- inc->setZaurusStat( -4 );
+ inc->setZaurusStat( SYNC_TEMPSTATE_NEW_ID );
}
}
}
//qDebug("getNumFromRecord returning : %d ", retval);
return retval;
}
@@ -503,17 +504,17 @@ bool SharpFormat::save( Calendar *calendar)
bool deleteEnt = false;
bool changeEnt = false;
QString message = i18n("Processing event # ");
int procCount = 0;
while ( ev ) {
//qDebug("i %d ", ++i);
- if ( ev->zaurusStat() != -2 ) {
+ if ( ev->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getEventString( ev );
- if ( ev->zaurusStat() == -3 ) { // delete
+ if ( ev->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
@@ -589,17 +590,17 @@ bool SharpFormat::save( Calendar *calendar)
QPtrList<Todo> tl = calendar->rawTodos();
Todo* to = tl.first();
i = 0;
message = i18n("Processing todo # ");
procCount = 0;
while ( to ) {
- if ( to->zaurusStat() != -2 ) {
+ if ( to->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getTodoString( to );
- if ( to->zaurusStat() == -3 ) { // delete
+ if ( to->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
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 @@
+
+#ifndef _KSYNC_DEFINES_H_
+#define _KSYNC_DEFINES_H_
+
+#define SYNC_PREF_LOCAL 0
+#define SYNC_PREF_REMOTE 1
+#define SYNC_PREF_NEWEST 2
+#define SYNC_PREF_ASK 3
+#define SYNC_PREF_FORCE_LOCAL 4
+#define SYNC_PREF_FORCE_REMOTE 5
+#define SYNC_PREF_TAKE_BOTH 6
+
+#define SYNC_MODE_NORMAL 0
+#define SYNC_MODE_EXTERNAL 1
+
+#define SYNC_TEMPSTATE_INITIAL 0
+#define SYNC_TEMPSTATE_NEW_EXTERNAL -2
+#define SYNC_TEMPSTATE_DELETE -3
+#define SYNC_TEMPSTATE_NEW_ID -4
+
+
+#endif