summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp23
-rw-r--r--libkcal/alarm.cpp16
-rw-r--r--libkcal/alarm.h2
-rw-r--r--libkcal/phoneformat.cpp58
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
}
+ int delFut = 0;
if ( KOPrefs::instance()->mWriteBackInFuture ) {
@@ -1140,5 +1141,14 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
}
- else dt = inR->dtStart();
- if ( dt < cur || dt > end )
+ else if (inR->type() == "Event" ) {
+ bool ok;
+ dt = inR->getNextOccurence( cur, &ok );
+ if ( !ok )
+ dt = cur.addSecs( -62 );
+ }
+ else
+ dt = inR->dtStart();
+ if ( dt < cur || dt > end ) {
remote->deleteIncidence( inR );
+ ++delFut;
+ }
inR = er.next();
@@ -1160,2 +1170,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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 );
+ QString delmess;
+ if ( delFut ) {
+ 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 );
+ mes += delmess;
+ }
if ( KOPrefs::instance()->mShowSyncSummary ) {
@@ -1247,8 +1262,6 @@ void CalendarView::syncExternal( int mode )
Incidence* inc = iL.first();
- /* obsolete
while ( inc ) {
- inc->setZaurusStat( inc->revision () );
+ inc->removeID(mCurrentSyncDevice);
inc = iL.next();
}
- */
#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)
}
+int Alarm::offset()
+{
+ if ( hasTime() ) {
+ if (mParent->type()=="Todo") {
+ Todo *t = static_cast<Todo*>(mParent);
+ return t->dtDue().secsTo( mAlarmTime ) ;
+ } else
+ return mParent->dtStart().secsTo( mAlarmTime ) ;
+ }
+ else
+ {
+ return mOffset.asSeconds();
+ }
+
+}
+
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
Type type() const;
-
+ int offset();
/** 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 )
if ( alarm->enabled() ) {
- alarmString = QString::number(alarm->startOffset().asSeconds() );
+ alarmString = QString::number(alarm->offset() );
}
@@ -161,3 +161,3 @@ ulong PhoneFormat::getCsumEvent( Event* event )
if ( alarm->enabled() ) {
- alarmString = QString::number( alarm->startOffset().asSeconds() );
+ alarmString = QString::number( alarm->offset() );
}
@@ -279,4 +279,4 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
}
- QString dump = attList.join(",");
- qDebug("csum: %d %s", cSum,dump.latin1());
+ //QString dump = attList.join(",");
+ //qDebug("csum: %d %s", cSum,dump.latin1());
@@ -303,3 +303,2 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
}
- qDebug("Command returned %d", ret);
VCalFormat vfload;
@@ -350,3 +349,3 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
if ( event ) {
- qDebug("copy todo %s ", event->summary().latin1());
+ //qDebug("copy todo %s ", event->summary().latin1());
@@ -382,11 +381,13 @@ void PhoneFormat::copyEvent( Event* to, Event* from )
- QPtrListIterator<Alarm> it( from->alarms() );
- if ( it.current() )
+ if ( from->alarms().count() ) {
to->clearAlarms();
- const Alarm *a;
- while( (a = it.current()) ) {
- Alarm *b = new Alarm( *a );
- b->setParent( to );
- to->addAlarm( b );
- ++it;
+ Alarm *a = from->alarms().first();
+ Alarm *b = to->newAlarm( );
+ b->setEnabled( a->enabled() );
+ if ( a->hasStartOffset() ) {
+ b->setStartOffset( a->startOffset() );
+ }
+ if ( a->hasTime() )
+ b->setTime( a->time() );
+
}
@@ -422,12 +423,13 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
- QPtrListIterator<Alarm> it( from->alarms() );
- if ( it.current() )
+ if ( from->alarms().count() ) {
to->clearAlarms();
- const Alarm *a;
- while( (a = it.current()) ) {
- Alarm *b = new Alarm( *a );
- b->setParent( to );
- to->addAlarm( b );
- ++it;
+ Alarm *a = from->alarms().first();
+ Alarm *b = to->newAlarm( );
+ b->setEnabled( a->enabled() );
+ if ( a->hasStartOffset() )
+ b->setStartOffset( a->startOffset() );
+ if ( a->hasTime() )
+ b->setTime( a->time() );
}
+
QStringList cat = to->categories();
@@ -535,6 +537,3 @@ bool PhoneFormat::save( Calendar *calendar)
}
- if ( ret != 0 ) {
- qDebug("Error S::command returned %d", ret);
- return false;
- }
+
// 5 reread data
@@ -581,3 +580,3 @@ bool PhoneFormat::save( Calendar *calendar)
if ( ! ev1 ) {
- ev->removeID(mProfileName);
+ // ev->removeID(mProfileName);
qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1());
@@ -596,3 +595,2 @@ bool PhoneFormat::save( Calendar *calendar)
while ( to ) {
- qDebug("todo2 %d ", procCount);
status.setText ( message + QString::number ( ++procCount ) );
@@ -603,3 +601,3 @@ bool PhoneFormat::save( Calendar *calendar)
//to->setCsum( mProfileName, cSum );
- qDebug("Todo cSum %s ", cSum.latin1());
+ //qDebug("Todo cSum %s ", cSum.latin1());
Todo* to1 = tl1.first();
@@ -615,3 +613,3 @@ bool PhoneFormat::save( Calendar *calendar)
if ( ! to1 ) {
- to->removeID(mProfileName);
+ //to->removeID(mProfileName);
qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1());