summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-09-12 22:05:14 (UTC)
committer zautrix <zautrix>2004-09-12 22:05:14 (UTC)
commit483c6ac49ea1764bdd154e33e220b7945a6ab754 (patch) (side-by-side diff)
tree29d5cb00ff3a36595c2fb0e1125d3e2b8ec246a6 /libkcal
parent185e2f4a2b10c65d8186dad63fe6cc3acd6b84f1 (diff)
downloadkdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.zip
kdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.tar.gz
kdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.tar.bz2
fix for Z
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 99d6a06..c67dc6a 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -363,49 +363,53 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
add = add * mul *ii*ii*ii;
cSum += add;
}
}
}
//QString dump = attList.join(",");
//qDebug("csum: %d %s", cSum,dump.latin1());
return cSum;
}
//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
#include <stdlib.h>
#define DEBUGMODE false
bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
{
QString fileName;
#ifdef _WIN32_
fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs";
#else
fileName = "/tmp/kdepimtemp.vcs";
#endif
+#ifdef DESKTOP_VERSION
QString command ="./kammu --backup " + fileName + " -yes" ;
+#else
+ QString command ="kammu --backup " + fileName + " -yes" ;
+#endif
int ret = system ( command.latin1() );
if ( ret != 0 ) {
qDebug("Error::command returned %d", ret);
return false;
}
VCalFormat vfload;
vfload.setLocalTime ( true );
qDebug("loading file ...");
if ( ! vfload.load( calendar, fileName ) )
return false;
QPtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
qDebug("reading events... ");
while ( ev ) {
QStringList cat = ev->categories();
if ( cat.contains( "MeetingDEF" )) {
ev->setCategories( QStringList() );
}
int id = ev->pilotId();
Event *event;
event = existingCal->event( mProfileName ,QString::number( id ) );
if ( event ) {
event = (Event*)event->clone();
@@ -594,49 +598,53 @@ bool PhoneFormat::save( Calendar *calendar)
} else {
}
ev = er.next();
}
// 2 remove todos which should be deleted
QPtrList<Todo> tl = calendar->rawTodos();
Todo* to = tl.first();
while ( to ) {
if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
calendar->deleteTodo( to );
} else {
if ( to->isCompleted()) {
calendar->deleteTodo( to );
}
}
to = tl.next();
}
// 3 save file
VCalFormat vfsave;
vfsave.setLocalTime ( true );
if ( ! vfsave.save( calendar, fileName ) )
return false;
// 4 call kammu
+#ifdef DESKTOP_VERSION
QString command ="./kammu --restore " + fileName ;
+#else
+ QString command ="kammu --restore " + fileName ;
+#endif
int ret;
while ( (ret = system ( command.latin1())) != 0 ) {
qDebug("Error S::command returned %d. asking users", ret);
int retval = KMessageBox::warningContinueCancel(0,
i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone sync"),i18n("Retry"),i18n("Cancel"));
if ( retval != KMessageBox::Continue )
return false;
}
// 5 reread data
message = i18n(" Rereading all data ... ");
status.setText ( message );
qApp->processEvents();
CalendarLocal* calendarTemp = new CalendarLocal();
calendarTemp->setTimeZoneId( calendar->timeZoneId());
if ( ! load( calendarTemp,calendar) ){
qDebug("error reloading calendar ");
delete calendarTemp;
return false;
}
// 6 compare data
//algo 6 compare event
er = calendar->rawEvents();