summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-12 13:11:10 (UTC)
committer zautrix <zautrix>2004-09-12 13:11:10 (UTC)
commitb2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26 (patch) (side-by-side diff)
treea25dbba0cac09b7a7892405b11eb08c7d02e6b6b
parent3c954091cb8d90c185403c68a8bbbb2a961f67fe (diff)
downloadkdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.zip
kdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.tar.gz
kdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.tar.bz2
many phonesync fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c2
-rw-r--r--gammu/emb/gammu/gammu.c41
-rw-r--r--libkcal/phoneformat.cpp51
3 files changed, 79 insertions, 15 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index 598292c..ddf9790 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -143,5 +143,5 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
} else {
- SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "AALARM");
+ SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
}
}
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c
index 5163d81..a3b93a8 100644
--- a/gammu/emb/gammu/gammu.c
+++ b/gammu/emb/gammu/gammu.c
@@ -8242,9 +8242,10 @@ int main(int argc, char *argv[])
/* Is first parameter numeric? If so treat it as config that should be loaded. */
- if (isdigit(argv[1][0])) {
- only_config = atoi(argv[1]);
- if (only_config >= 0) start++; else only_config = -1;
- }
-
+ //if (isdigit(argv[1][0])) {
+ //only_config = atoi(argv[1]);
+ //if (only_config >= 0) start++; else only_config = -1;
+ //}
+ only_config = 0;;
+#if 0
GSM_ReadConfig(NULL, &s.Config[0], 0);
s.ConfigNum = 1;
@@ -8270,5 +8271,5 @@ int main(int argc, char *argv[])
}
argc = argc-3;
-#if 0
+ //#if 0
if ( ! mConnection.isEmpty() ) {
cfg->Connection = strdup(mConnection.latin1());
@@ -8291,5 +8292,5 @@ int main(int argc, char *argv[])
#endif
-#if 0
+
cfg=GSM_FindGammuRC();
for (i = 0; i <= MAX_CONFIG_NUM; i++) {
@@ -8316,4 +8317,5 @@ int main(int argc, char *argv[])
/* Wanted user specific configuration? */
+
if (only_config != -1) {
/* Here we get only in first for loop */
@@ -8351,5 +8353,29 @@ int main(int argc, char *argv[])
if (only_config != -1) {break;}
}
+#if 0
+ GSM_Config *con = &s.Config[0];
+
+ char* tempC;
+ tempC = argv[argc-1]+2;
+ if ( *tempC != 0 ) {
+ fprintf(stderr,"Using model %s \n",tempC);
+ strcpy(con->Model,tempC );
+ }
+ tempC = argv[argc-2]+2;
+ if ( *tempC != 0 ) {
+ fprintf(stderr,"Using device %s \n",tempC);
+ con->Device = strdup(tempC);
+ con->DefaultDevice = false;
+ }
+ tempC = argv[argc-3]+2;
+ if ( *tempC != 0 ) {
+ fprintf(stderr,"Using connection %s \n",tempC);
+ con->Connection = strdup(tempC);
+ con->DefaultConnection = false;
+ }
#endif
+ argc = argc-3;
+
+
/* Do we have enough parameters? */
if (argc == 1 + start) {
@@ -8370,4 +8396,5 @@ int main(int argc, char *argv[])
if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) {
if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) {
+ fprintf(stderr,"Executing \n");
Parameters[z].Function(argc - start, argv + start);
break;
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 2ad1b5a..6df639f 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -36,4 +36,5 @@
#include <klocale.h>
#include <kglobal.h>
+#include <kmessagebox.h>
#include "calendar.h"
@@ -247,4 +248,6 @@ ulong PhoneFormat::getCsumEvent( Event* event )
attList << list.join("");
attList << event->categoriesStr();
+ //qDebug("csum cat %s", event->categoriesStr().latin1());
+
attList << event->secrecyStr();
return PhoneFormat::getCsum(attList );
@@ -270,4 +273,7 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
}
}
+ //QString dump = attList.join(",");
+ //qDebug("csum: %s", dump.latin1());
+
return cSum;
@@ -288,13 +294,23 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
mConnection +" -D" + mDevice +" -M" + mModel;
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 ) )
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;
@@ -316,4 +332,5 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
}
{
+ qDebug("reading todos... ");
QPtrList<Todo> tr = calendar->rawTodos();
Todo* ev = tr.first();
@@ -491,8 +508,17 @@ bool PhoneFormat::save( Calendar *calendar)
// 4 call kammu
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
message = i18n(" Rereading all data ... ");
@@ -516,8 +542,12 @@ bool PhoneFormat::save( Calendar *calendar)
int procCount = 0;
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();
while ( ev1 ) {
@@ -526,4 +556,6 @@ bool PhoneFormat::save( Calendar *calendar)
afterSave( ev );
ev->setID(mProfileName, ev1->getID(mProfileName) );
+ //qDebug("Event found on phone for %s ", ev->summary().latin1());
+
break;
}
@@ -539,4 +571,5 @@ bool PhoneFormat::save( Calendar *calendar)
}
//algo 6 compare todo
+ tl = calendar->rawTodos();
to = tl.first();
procCount = 0;
@@ -548,5 +581,9 @@ bool PhoneFormat::save( Calendar *calendar)
status.setText ( message + QString::number ( ++procCount ) );
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();
while ( to1 ) {