summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-12 15:24:11 (UTC)
committer zautrix <zautrix>2004-09-12 15:24:11 (UTC)
commita222c2f7369eeefd19454c973c0cc48300f72bec (patch) (side-by-side diff)
tree6f01a5922ea622add6960f3fad703e8e8f099caa
parentb2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26 (diff)
downloadkdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.zip
kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.gz
kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.bz2
many phone sync fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c4
-rw-r--r--gammu/emb/gammu/gammu.c6
-rw-r--r--libkcal/phoneformat.cpp42
3 files changed, 36 insertions, 16 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index ddf9790..0ea8e06 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -473,14 +473,14 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
ToDo->EntriesNum++;
}
if (ReadVCALText(Line, "PRIORITY", Buff)) {
if (ToDoVer == SonyEricsson_VToDo) {
- ToDo->Priority = GSM_Priority_Low;
+ ToDo->Priority = GSM_Priority_Medium;
if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low;
if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High;
dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff));
} else if (ToDoVer == Nokia_VToDo) {
- ToDo->Priority = GSM_Priority_Low;
+ ToDo->Priority = GSM_Priority_Medium;
if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low;
if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High;
}
}
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c
index a3b93a8..997485a 100644
--- a/gammu/emb/gammu/gammu.c
+++ b/gammu/emb/gammu/gammu.c
@@ -4626,8 +4626,9 @@ static void Restore(int argc, char *argv[])
}
}
DoRestore = false;
if (Backup.Calendar[0] != NULL) {
+ DoRestore = true;
/* N6110 doesn't support getting calendar status */
error = Phone->GetNextCalendar(&s,&Calendar,true);
if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) {
max = 0;
@@ -4677,18 +4678,22 @@ static void Restore(int argc, char *argv[])
DoRestore = false;
if (Backup.ToDo[0] != NULL) {
error = Phone->GetToDoStatus(&s,&ToDoStatus);
if (error == ERR_NONE) {
+ error == ERR_NOTSUPPORTED;
+ DoRestore = true;
max = 0;
while (Backup.ToDo[max]!=NULL) max++;
printmsgerr("%i entries in backup file\n",max);
/*if (answer_yes("Restore ToDo")) */DoRestore = true;
}
}
if (DoRestore) {
+ if ( max > 0 ) {
ToDo = *Backup.ToDo[0];
error = Phone->SetToDo(&s,&ToDo);
+ }
}
if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) {
printmsgerr("Deleting old ToDo: ");
error=Phone->DeleteAllToDo(&s);
@@ -8373,9 +8378,8 @@ int main(int argc, char *argv[])
con->Connection = strdup(tempC);
con->DefaultConnection = false;
}
#endif
- argc = argc-3;
/* Do we have enough parameters? */
if (argc == 1 + start) {
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 6df639f..ef69bce 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -128,9 +128,12 @@ ulong PhoneFormat::getCsumTodo( Todo* todo )
QString completedString = "no";
if ( todo->isCompleted() )
completedString = "yes";
attList << completedString;
- attList << QString::number( todo->priority() );
+ int prio = todo->priority();
+ if( prio == 2 ) prio = 1;
+ if (prio == 4 ) prio = 5 ;
+ attList << QString::number( prio );
QString alarmString = "na";
Alarm *alarm;
if ( todo->alarms().count() > 0 ) {
alarm = todo->alarms().first();
@@ -253,28 +256,32 @@ ulong PhoneFormat::getCsumEvent( Event* event )
return PhoneFormat::getCsum(attList );
}
ulong PhoneFormat::getCsum( const QStringList & attList)
{
- int max = attList.count() -1;
+ int max = attList.count();
ulong cSum = 0;
int j,k,i;
int add;
- for ( i = 1; i < max ; ++i ) {
+ for ( i = 0; i < max ; ++i ) {
QString s = attList[i];
if ( ! s.isEmpty() ){
j = s.length();
for ( k = 0; k < j; ++k ) {
int mul = k +1;
add = s[k].unicode ();
if ( k < 16 )
mul = mul * mul;
- add = add * mul *i*i*i;
+ int ii = i+1;
+ add = add * mul *ii*ii*ii;
cSum += add;
}
}
+ if ( i == 0 )
+ qDebug("csum: i == 0 %d ", cSum);
+
}
- //QString dump = attList.join(",");
- //qDebug("csum: %s", dump.latin1());
+ QString dump = attList.join(",");
+ qDebug("csum: %d %s", cSum,dump.latin1());
return cSum;
}
@@ -289,10 +296,9 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs";
#else
fileName = "/tmp/kdepimtemp.vcs";
#endif
- QString command ="./kammu --backup " + fileName + " -yes -C" +
- mConnection +" -D" + mDevice +" -M" + mModel;
+ QString command ="./kammu --backup " + fileName + " -yes" ;
int ret = system ( command.latin1() );
if ( ret != 0 ) {
qDebug("Error::command returned %d", ret);
return false;
@@ -343,8 +349,10 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
int id = ev->pilotId();
Todo *event;
event = existingCal->todo( mProfileName ,QString::number( id ) );
if ( event ) {
+ qDebug("copy todo %s ", event->summary().latin1());
+
event = (Todo*)event->clone();
copyTodo( event, ev );
calendar->deleteTodo( ev );
calendar->addTodo( event);
@@ -374,9 +382,10 @@ void PhoneFormat::copyEvent( Event* to, Event* from )
if ( !from->summary().isEmpty() )
to->setSummary( from->summary() );
QPtrListIterator<Alarm> it( from->alarms() );
- to->clearAlarms();
+ if ( it.current() )
+ to->clearAlarms();
const Alarm *a;
while( (a = it.current()) ) {
Alarm *b = new Alarm( *a );
b->setParent( to );
@@ -413,9 +422,10 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
if ( !from->summary().isEmpty() )
to->setSummary( from->summary() );
QPtrListIterator<Alarm> it( from->alarms() );
- to->clearAlarms();
+ if ( it.current() )
+ to->clearAlarms();
const Alarm *a;
while( (a = it.current()) ) {
Alarm *b = new Alarm( *a );
b->setParent( to );
@@ -442,22 +452,29 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
// set percentcomplete only, if to->isCompleted()
if ( to->isCompleted() )
to->setPercentComplete(from->percentComplete());
}
- to->setPriority(from->priority());
+ if( to->priority() == 2 && from->priority() == 1 )
+ ; //skip
+ else if (to->priority() == 4 && from->priority() == 5 )
+ ;
+ else
+ to->setPriority(from->priority());
}
#include <qcstring.h>
void PhoneFormat::afterSave( Incidence* inc)
{
uint csum;
inc->removeID( mProfileName );
+#if 0
if ( inc->type() == "Event")
csum = PhoneFormat::getCsumEvent( (Event*) inc );
else
csum = PhoneFormat::getCsumTodo( (Todo*) inc );
inc->setCsum( mProfileName, QString::number( csum ));
+#endif
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
}
bool PhoneFormat::save( Calendar *calendar)
@@ -505,10 +522,9 @@ bool PhoneFormat::save( Calendar *calendar)
vfsave.setLocalTime ( true );
if ( ! vfsave.save( calendar, fileName ) )
return false;
// 4 call kammu
- QString command ="./kammu --restore " + fileName + " -C" +
- mConnection +" -D" + mDevice +" -M" + mModel;
+ QString command ="./kammu --restore " + fileName ;
int ret;
while ( (ret = system ( command.latin1())) != 0 ) {
qDebug("Error S::command returned %d. asking users", ret);
int retval = KMessageBox::warningContinueCancel(0,