author | zautrix <zautrix> | 2004-09-12 19:26:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-12 19:26:13 (UTC) |
commit | 5b434dd78f71bcea5e6067fc8ae0faaaea313f9d (patch) (unidiff) | |
tree | ed532e602a3b503b72a46ea18d40e3a5dc97aa3f | |
parent | bc4153a99e205f43d0144e2e910730dd1a14d402 (diff) | |
download | kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.zip kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.tar.gz kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.tar.bz2 |
phone fixes
-rw-r--r-- | korganizer/calendarview.cpp | 23 | ||||
-rw-r--r-- | libkcal/alarm.cpp | 16 | ||||
-rw-r--r-- | libkcal/alarm.h | 2 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 58 |
4 files changed, 63 insertions, 36 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index cfd9290..d5d31e2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1126,2 +1126,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1126 | } | 1126 | } |
1127 | int delFut = 0; | ||
1127 | if ( KOPrefs::instance()->mWriteBackInFuture ) { | 1128 | if ( KOPrefs::instance()->mWriteBackInFuture ) { |
@@ -1140,5 +1141,14 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1140 | } | 1141 | } |
1141 | else dt = inR->dtStart(); | 1142 | else if (inR->type() == "Event" ) { |
1142 | if ( dt < cur || dt > end ) | 1143 | bool ok; |
1144 | dt = inR->getNextOccurence( cur, &ok ); | ||
1145 | if ( !ok ) | ||
1146 | dt = cur.addSecs( -62 ); | ||
1147 | } | ||
1148 | else | ||
1149 | dt = inR->dtStart(); | ||
1150 | if ( dt < cur || dt > end ) { | ||
1143 | remote->deleteIncidence( inR ); | 1151 | remote->deleteIncidence( inR ); |
1152 | ++delFut; | ||
1153 | } | ||
1144 | inR = er.next(); | 1154 | inR = er.next(); |
@@ -1160,2 +1170,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1160 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1170 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1171 | QString delmess; | ||
1172 | if ( delFut ) { | ||
1173 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); | ||
1174 | mes += delmess; | ||
1175 | } | ||
1161 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1176 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
@@ -1247,8 +1262,6 @@ void CalendarView::syncExternal( int mode ) | |||
1247 | Incidence* inc = iL.first(); | 1262 | Incidence* inc = iL.first(); |
1248 | /* obsolete | ||
1249 | while ( inc ) { | 1263 | while ( inc ) { |
1250 | inc->setZaurusStat( inc->revision () ); | 1264 | inc->removeID(mCurrentSyncDevice); |
1251 | inc = iL.next(); | 1265 | inc = iL.next(); |
1252 | } | 1266 | } |
1253 | */ | ||
1254 | #ifndef DESKTOP_VERSION | 1267 | #ifndef DESKTOP_VERSION |
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 07812c2..29e6205 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp | |||
@@ -302,2 +302,18 @@ void Alarm::setTime(const QDateTime &alarmTime) | |||
302 | } | 302 | } |
303 | int Alarm::offset() | ||
304 | { | ||
305 | if ( hasTime() ) { | ||
306 | if (mParent->type()=="Todo") { | ||
307 | Todo *t = static_cast<Todo*>(mParent); | ||
308 | return t->dtDue().secsTo( mAlarmTime ) ; | ||
309 | } else | ||
310 | return mParent->dtStart().secsTo( mAlarmTime ) ; | ||
311 | } | ||
312 | else | ||
313 | { | ||
314 | return mOffset.asSeconds(); | ||
315 | } | ||
316 | |||
317 | } | ||
318 | |||
303 | 319 | ||
diff --git a/libkcal/alarm.h b/libkcal/alarm.h index ae2eca3..682b626 100644 --- a/libkcal/alarm.h +++ b/libkcal/alarm.h | |||
@@ -60,3 +60,3 @@ class Alarm : public CustomProperties | |||
60 | Type type() const; | 60 | Type type() const; |
61 | 61 | int offset(); | |
62 | /** Set the alarm to be a display alarm. | 62 | /** Set the alarm to be a display alarm. |
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 6d0da5c..178a63e 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -140,3 +140,3 @@ ulong PhoneFormat::getCsumTodo( Todo* todo ) | |||
140 | if ( alarm->enabled() ) { | 140 | if ( alarm->enabled() ) { |
141 | alarmString = QString::number(alarm->startOffset().asSeconds() ); | 141 | alarmString = QString::number(alarm->offset() ); |
142 | } | 142 | } |
@@ -161,3 +161,3 @@ ulong PhoneFormat::getCsumEvent( Event* event ) | |||
161 | if ( alarm->enabled() ) { | 161 | if ( alarm->enabled() ) { |
162 | alarmString = QString::number( alarm->startOffset().asSeconds() ); | 162 | alarmString = QString::number( alarm->offset() ); |
163 | } | 163 | } |
@@ -279,4 +279,4 @@ ulong PhoneFormat::getCsum( const QStringList & attList) | |||
279 | } | 279 | } |
280 | QString dump = attList.join(","); | 280 | //QString dump = attList.join(","); |
281 | qDebug("csum: %d %s", cSum,dump.latin1()); | 281 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
282 | 282 | ||
@@ -303,3 +303,2 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
303 | } | 303 | } |
304 | qDebug("Command returned %d", ret); | ||
305 | VCalFormat vfload; | 304 | VCalFormat vfload; |
@@ -350,3 +349,3 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
350 | if ( event ) { | 349 | if ( event ) { |
351 | qDebug("copy todo %s ", event->summary().latin1()); | 350 | //qDebug("copy todo %s ", event->summary().latin1()); |
352 | 351 | ||
@@ -382,11 +381,13 @@ void PhoneFormat::copyEvent( Event* to, Event* from ) | |||
382 | 381 | ||
383 | QPtrListIterator<Alarm> it( from->alarms() ); | 382 | if ( from->alarms().count() ) { |
384 | if ( it.current() ) | ||
385 | to->clearAlarms(); | 383 | to->clearAlarms(); |
386 | const Alarm *a; | 384 | Alarm *a = from->alarms().first(); |
387 | while( (a = it.current()) ) { | 385 | Alarm *b = to->newAlarm( ); |
388 | Alarm *b = new Alarm( *a ); | 386 | b->setEnabled( a->enabled() ); |
389 | b->setParent( to ); | 387 | if ( a->hasStartOffset() ) { |
390 | to->addAlarm( b ); | 388 | b->setStartOffset( a->startOffset() ); |
391 | ++it; | 389 | } |
390 | if ( a->hasTime() ) | ||
391 | b->setTime( a->time() ); | ||
392 | |||
392 | } | 393 | } |
@@ -422,12 +423,13 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from ) | |||
422 | 423 | ||
423 | QPtrListIterator<Alarm> it( from->alarms() ); | 424 | if ( from->alarms().count() ) { |
424 | if ( it.current() ) | ||
425 | to->clearAlarms(); | 425 | to->clearAlarms(); |
426 | const Alarm *a; | 426 | Alarm *a = from->alarms().first(); |
427 | while( (a = it.current()) ) { | 427 | Alarm *b = to->newAlarm( ); |
428 | Alarm *b = new Alarm( *a ); | 428 | b->setEnabled( a->enabled() ); |
429 | b->setParent( to ); | 429 | if ( a->hasStartOffset() ) |
430 | to->addAlarm( b ); | 430 | b->setStartOffset( a->startOffset() ); |
431 | ++it; | 431 | if ( a->hasTime() ) |
432 | b->setTime( a->time() ); | ||
432 | } | 433 | } |
434 | |||
433 | QStringList cat = to->categories(); | 435 | QStringList cat = to->categories(); |
@@ -535,6 +537,3 @@ bool PhoneFormat::save( Calendar *calendar) | |||
535 | } | 537 | } |
536 | if ( ret != 0 ) { | 538 | |
537 | qDebug("Error S::command returned %d", ret); | ||
538 | return false; | ||
539 | } | ||
540 | // 5 reread data | 539 | // 5 reread data |
@@ -581,3 +580,3 @@ bool PhoneFormat::save( Calendar *calendar) | |||
581 | if ( ! ev1 ) { | 580 | if ( ! ev1 ) { |
582 | ev->removeID(mProfileName); | 581 | // ev->removeID(mProfileName); |
583 | qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); | 582 | qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); |
@@ -596,3 +595,2 @@ bool PhoneFormat::save( Calendar *calendar) | |||
596 | while ( to ) { | 595 | while ( to ) { |
597 | qDebug("todo2 %d ", procCount); | ||
598 | status.setText ( message + QString::number ( ++procCount ) ); | 596 | status.setText ( message + QString::number ( ++procCount ) ); |
@@ -603,3 +601,3 @@ bool PhoneFormat::save( Calendar *calendar) | |||
603 | //to->setCsum( mProfileName, cSum ); | 601 | //to->setCsum( mProfileName, cSum ); |
604 | qDebug("Todo cSum %s ", cSum.latin1()); | 602 | //qDebug("Todo cSum %s ", cSum.latin1()); |
605 | Todo* to1 = tl1.first(); | 603 | Todo* to1 = tl1.first(); |
@@ -615,3 +613,3 @@ bool PhoneFormat::save( Calendar *calendar) | |||
615 | if ( ! to1 ) { | 613 | if ( ! to1 ) { |
616 | to->removeID(mProfileName); | 614 | //to->removeID(mProfileName); |
617 | qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1()); | 615 | qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1()); |