summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp51
1 files changed, 44 insertions, 7 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 2ad1b5a..6df639f 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -37,2 +37,3 @@
#include <kglobal.h>
+#include <kmessagebox.h>
@@ -248,2 +249,4 @@ ulong PhoneFormat::getCsumEvent( Event* event )
attList << event->categoriesStr();
+ //qDebug("csum cat %s", event->categoriesStr().latin1());
+
attList << event->secrecyStr();
@@ -271,2 +274,5 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
}
+ //QString dump = attList.join(",");
+ //qDebug("csum: %s", dump.latin1());
+
return cSum;
@@ -289,6 +295,11 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
int ret = system ( command.latin1() );
- if ( ret != 0 )
+ if ( ret != 0 ) {
+ qDebug("Error::command returned %d", ret);
return false;
+ }
+ qDebug("Command returned %d", ret);
VCalFormat vfload;
vfload.setLocalTime ( true );
+ qDebug("loading file ...");
+
if ( ! vfload.load( calendar, fileName ) )
@@ -297,3 +308,8 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
Event* ev = er.first();
+ qDebug("reading events... ");
while ( ev ) {
+ QStringList cat = ev->categories();
+ if ( cat.contains( "MeetingDEF" )) {
+ ev->setCategories( QStringList() );
+ }
int id = ev->pilotId();
@@ -317,2 +333,3 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
{
+ qDebug("reading todos... ");
QPtrList<Todo> tr = calendar->rawTodos();
@@ -492,6 +509,15 @@ bool PhoneFormat::save( Calendar *calendar)
QString command ="./kammu --restore " + fileName + " -C" +
- mConnection +" -D" + mDevice +" -M" + mModel;;
- int ret = system ( command.latin1() );
- if ( ret != 0 )
+ mConnection +" -D" + mDevice +" -M" + mModel;
+ 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;
+ }
+ if ( ret != 0 ) {
+ qDebug("Error S::command returned %d", ret);
return false;
+ }
// 5 reread data
@@ -517,6 +543,10 @@ bool PhoneFormat::save( Calendar *calendar)
while ( ev ) {
- qDebug("event new ID ");
+ //qDebug("event new ID %s",ev->summary().latin1());
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
- QString cSum = ev->getCsum(mProfileName);
+ uint csum;
+ csum = PhoneFormat::getCsumEvent( ev );
+ QString cSum = QString::number( csum );
+ ev->setCsum( mProfileName, cSum );
+ //qDebug("Event cSum %s ", cSum.latin1());
ev1 = er1.first();
@@ -527,2 +557,4 @@ bool PhoneFormat::save( Calendar *calendar)
ev->setID(mProfileName, ev1->getID(mProfileName) );
+ //qDebug("Event found on phone for %s ", ev->summary().latin1());
+
break;
@@ -540,2 +572,3 @@ bool PhoneFormat::save( Calendar *calendar)
//algo 6 compare todo
+ tl = calendar->rawTodos();
to = tl.first();
@@ -549,3 +582,7 @@ bool PhoneFormat::save( Calendar *calendar)
qApp->processEvents();
- QString cSum = to->getCsum(mProfileName);
+ uint csum;
+ csum = PhoneFormat::getCsumTodo( to );
+ QString cSum = QString::number( csum );
+ to->setCsum( mProfileName, cSum );
+ qDebug("Todo cSum %s ", cSum.latin1());
Todo* to1 = tl1.first();