author | zautrix <zautrix> | 2004-09-22 01:13:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-22 01:13:09 (UTC) |
commit | ed2feaa9f7e2064e5b26ff678a25eb79ceae599b (patch) (unidiff) | |
tree | bd698d689aa16ce8c52c5060402d9560f95a713e /korganizer | |
parent | 01572248367c63119514d15d7401a5b2b83349a0 (diff) | |
download | kdepimpi-ed2feaa9f7e2064e5b26ff678a25eb79ceae599b.zip kdepimpi-ed2feaa9f7e2064e5b26ff678a25eb79ceae599b.tar.gz kdepimpi-ed2feaa9f7e2064e5b26ff678a25eb79ceae599b.tar.bz2 |
Sync dialog fixes
-rw-r--r-- | korganizer/calendarview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7fae4a9..bc8625d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1106,98 +1106,98 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1106 | ++incCounter; | 1106 | ++incCounter; |
1107 | uid = inL->uid(); | 1107 | uid = inL->uid(); |
1108 | bool skipIncidence = false; | 1108 | bool skipIncidence = false; |
1109 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1109 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1110 | skipIncidence = true; | 1110 | skipIncidence = true; |
1111 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1111 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1112 | skipIncidence = true; | 1112 | skipIncidence = true; |
1113 | if ( !skipIncidence ) { | 1113 | if ( !skipIncidence ) { |
1114 | inR = remote->incidence( uid ); | 1114 | inR = remote->incidence( uid ); |
1115 | if ( ! inR ) { | 1115 | if ( ! inR ) { |
1116 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1116 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1117 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1117 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1118 | checkExternSyncEvent(eventLSyncSharp, inL); | 1118 | checkExternSyncEvent(eventLSyncSharp, inL); |
1119 | local->deleteIncidence( inL ); | 1119 | local->deleteIncidence( inL ); |
1120 | ++deletedEventL; | 1120 | ++deletedEventL; |
1121 | } else { | 1121 | } else { |
1122 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1122 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1123 | inL->removeID(mCurrentSyncDevice ); | 1123 | inL->removeID(mCurrentSyncDevice ); |
1124 | ++addedEventR; | 1124 | ++addedEventR; |
1125 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1125 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1126 | inL->setLastModified( modifiedCalendar ); | 1126 | inL->setLastModified( modifiedCalendar ); |
1127 | inR = inL->clone(); | 1127 | inR = inL->clone(); |
1128 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1128 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1129 | remote->addIncidence( inR ); | 1129 | remote->addIncidence( inR ); |
1130 | } | 1130 | } |
1131 | } | 1131 | } |
1132 | } else { | 1132 | } else { |
1133 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1133 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1134 | checkExternSyncEvent(eventLSyncSharp, inL); | 1134 | checkExternSyncEvent(eventLSyncSharp, inL); |
1135 | local->deleteIncidence( inL ); | 1135 | local->deleteIncidence( inL ); |
1136 | ++deletedEventL; | 1136 | ++deletedEventL; |
1137 | } else { | 1137 | } else { |
1138 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1138 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1139 | ++addedEventR; | 1139 | ++addedEventR; |
1140 | inL->setLastModified( modifiedCalendar ); | 1140 | inL->setLastModified( modifiedCalendar ); |
1141 | remote->addIncidence( inL->clone() ); | 1141 | remote->addIncidence( inL->clone() ); |
1142 | } | 1142 | } |
1143 | } | 1143 | } |
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | inL = el.next(); | 1147 | inL = el.next(); |
1148 | } | 1148 | } |
1149 | int delFut = 0; | 1149 | int delFut = 0; |
1150 | if ( KOPrefs::instance()->mWriteBackInFuture ) { | 1150 | if ( KOPrefs::instance()->mWriteBackInFuture ) { |
1151 | er = remote->rawIncidences(); | 1151 | er = remote->rawIncidences(); |
1152 | inR = er.first(); | 1152 | inR = er.first(); |
1153 | QDateTime dt; | 1153 | QDateTime dt; |
1154 | QDateTime cur = QDateTime::currentDateTime(); | 1154 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1155 | QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 ); | 1155 | QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); |
1156 | while ( inR ) { | 1156 | while ( inR ) { |
1157 | if ( inR->type() == "Todo" ) { | 1157 | if ( inR->type() == "Todo" ) { |
1158 | Todo * t = (Todo*)inR; | 1158 | Todo * t = (Todo*)inR; |
1159 | if ( t->hasDueDate() ) | 1159 | if ( t->hasDueDate() ) |
1160 | dt = t->dtDue(); | 1160 | dt = t->dtDue(); |
1161 | else | 1161 | else |
1162 | dt = cur.addSecs( 62 ); | 1162 | dt = cur.addSecs( 62 ); |
1163 | } | 1163 | } |
1164 | else if (inR->type() == "Event" ) { | 1164 | else if (inR->type() == "Event" ) { |
1165 | bool ok; | 1165 | bool ok; |
1166 | dt = inR->getNextOccurence( cur, &ok ); | 1166 | dt = inR->getNextOccurence( cur, &ok ); |
1167 | if ( !ok ) | 1167 | if ( !ok ) |
1168 | dt = cur.addSecs( -62 ); | 1168 | dt = cur.addSecs( -62 ); |
1169 | } | 1169 | } |
1170 | else | 1170 | else |
1171 | dt = inR->dtStart(); | 1171 | dt = inR->dtStart(); |
1172 | if ( dt < cur || dt > end ) { | 1172 | if ( dt < cur || dt > end ) { |
1173 | remote->deleteIncidence( inR ); | 1173 | remote->deleteIncidence( inR ); |
1174 | ++delFut; | 1174 | ++delFut; |
1175 | } | 1175 | } |
1176 | inR = er.next(); | 1176 | inR = er.next(); |
1177 | } | 1177 | } |
1178 | } | 1178 | } |
1179 | bar.hide(); | 1179 | bar.hide(); |
1180 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1180 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1181 | eventLSync->setReadOnly( false ); | 1181 | eventLSync->setReadOnly( false ); |
1182 | eventLSync->setDtStart( mLastCalendarSync ); | 1182 | eventLSync->setDtStart( mLastCalendarSync ); |
1183 | eventRSync->setDtStart( mLastCalendarSync ); | 1183 | eventRSync->setDtStart( mLastCalendarSync ); |
1184 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1184 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1185 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1185 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1186 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1186 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1187 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1187 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1188 | eventLSync->setReadOnly( true ); | 1188 | eventLSync->setReadOnly( true ); |
1189 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1189 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1190 | remote->addEvent( eventRSync ); | 1190 | remote->addEvent( eventRSync ); |
1191 | QString mes; | 1191 | QString mes; |
1192 | 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 ); | 1192 | 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 ); |
1193 | QString delmess; | 1193 | QString delmess; |
1194 | if ( delFut ) { | 1194 | if ( delFut ) { |
1195 | 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 ); | 1195 | 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 ); |
1196 | mes += delmess; | 1196 | mes += delmess; |
1197 | } | 1197 | } |
1198 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1198 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1199 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1199 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1200 | } | 1200 | } |
1201 | qDebug( mes ); | 1201 | qDebug( mes ); |
1202 | mCalendar->checkAlarmForIncidence( 0, true ); | 1202 | mCalendar->checkAlarmForIncidence( 0, true ); |
1203 | return syncOK; | 1203 | return syncOK; |