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 /korganizer | |
parent | bc4153a99e205f43d0144e2e910730dd1a14d402 (diff) | |
download | kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.zip kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.tar.gz kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.tar.bz2 |
phone fixes
-rw-r--r-- | korganizer/calendarview.cpp | 23 |
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 | |||
@@ -1115,58 +1115,73 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1115 | } else { | 1115 | } else { |
1116 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1116 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1117 | ++addedEventR; | 1117 | ++addedEventR; |
1118 | inL->setLastModified( modifiedCalendar ); | 1118 | inL->setLastModified( modifiedCalendar ); |
1119 | remote->addIncidence( inL->clone() ); | 1119 | remote->addIncidence( inL->clone() ); |
1120 | } | 1120 | } |
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 ); |
1133 | while ( inR ) { | 1134 | while ( inR ) { |
1134 | if ( inR->type() == "Todo" ) { | 1135 | if ( inR->type() == "Todo" ) { |
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 ); |
1150 | eventLSync->setDtStart( mLastCalendarSync ); | 1160 | eventLSync->setDtStart( mLastCalendarSync ); |
1151 | eventRSync->setDtStart( mLastCalendarSync ); | 1161 | eventRSync->setDtStart( mLastCalendarSync ); |
1152 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1162 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1153 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1163 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1154 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1164 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
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; |
1167 | } | 1182 | } |
1168 | 1183 | ||
1169 | void CalendarView::setSyncDevice( QString s ) | 1184 | void CalendarView::setSyncDevice( QString s ) |
1170 | { | 1185 | { |
1171 | mCurrentSyncDevice= s; | 1186 | mCurrentSyncDevice= s; |
1172 | } | 1187 | } |
@@ -1236,30 +1251,28 @@ void CalendarView::syncExternal( int mode ) | |||
1236 | } else | 1251 | } else |
1237 | return; | 1252 | return; |
1238 | if ( loadSuccess ) { | 1253 | if ( loadSuccess ) { |
1239 | getEventViewerDialog()->setSyncMode( true ); | 1254 | getEventViewerDialog()->setSyncMode( true ); |
1240 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1255 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1241 | getEventViewerDialog()->setSyncMode( false ); | 1256 | getEventViewerDialog()->setSyncMode( false ); |
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); |
1260 | iL = calendar->rawIncidences(); | 1273 | iL = calendar->rawIncidences(); |
1261 | inc = iL.first(); | 1274 | inc = iL.first(); |
1262 | Incidence* loc; | 1275 | Incidence* loc; |
1263 | while ( inc ) { | 1276 | while ( inc ) { |
1264 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1277 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1265 | loc = mCalendar->incidence(inc->uid() ); | 1278 | loc = mCalendar->incidence(inc->uid() ); |