summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index cfd9290..d5d31e2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1121,12 +1121,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1121 } 1121 }
1122 } 1122 }
1123 } 1123 }
1124 } 1124 }
1125 inL = el.next(); 1125 inL = el.next();
1126 } 1126 }
1127 int delFut = 0;
1127 if ( KOPrefs::instance()->mWriteBackInFuture ) { 1128 if ( KOPrefs::instance()->mWriteBackInFuture ) {
1128 er = remote->rawIncidences(); 1129 er = remote->rawIncidences();
1129 inR = er.first(); 1130 inR = er.first();
1130 QDateTime dt; 1131 QDateTime dt;
1131 QDateTime cur = QDateTime::currentDateTime(); 1132 QDateTime cur = QDateTime::currentDateTime();
1132 QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 ); 1133 QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 );
@@ -1135,15 +1136,24 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1135 Todo * t = (Todo*)inR; 1136 Todo * t = (Todo*)inR;
1136 if ( t->hasDueDate() ) 1137 if ( t->hasDueDate() )
1137 dt = t->dtDue(); 1138 dt = t->dtDue();
1138 else 1139 else
1139 dt = cur.addSecs( 62 ); 1140 dt = cur.addSecs( 62 );
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();
1145 } 1155 }
1146 } 1156 }
1147 bar.hide(); 1157 bar.hide();
1148 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1158 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1149 eventLSync->setReadOnly( false ); 1159 eventLSync->setReadOnly( false );
@@ -1155,12 +1165,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1155 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1165 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1156 eventLSync->setReadOnly( true ); 1166 eventLSync->setReadOnly( true );
1157 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1167 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1158 remote->addEvent( eventRSync ); 1168 remote->addEvent( eventRSync );
1159 QString mes; 1169 QString mes;
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 ) {
1162 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1177 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1163 } 1178 }
1164 qDebug( mes ); 1179 qDebug( mes );
1165 mCalendar->checkAlarmForIncidence( 0, true ); 1180 mCalendar->checkAlarmForIncidence( 0, true );
1166 return syncOK; 1181 return syncOK;
@@ -1242,18 +1257,16 @@ void CalendarView::syncExternal( int mode )
1242 qApp->processEvents(); 1257 qApp->processEvents();
1243 if ( syncOK ) { 1258 if ( syncOK ) {
1244 if ( KOPrefs::instance()->mWriteBackFile ) 1259 if ( KOPrefs::instance()->mWriteBackFile )
1245 { 1260 {
1246 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1261 QPtrList<Incidence> iL = mCalendar->rawIncidences();
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
1255 if ( sharpFormat ) 1268 if ( sharpFormat )
1256 sharpFormat->save(calendar); 1269 sharpFormat->save(calendar);
1257#endif 1270#endif
1258 if ( phoneFormat ) 1271 if ( phoneFormat )
1259 phoneFormat->save(calendar); 1272 phoneFormat->save(calendar);