summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 6e61351..4667918 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1173,53 +1173,57 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1173 inR = er.next(); 1173 inR = er.next();
1174 } 1174 }
1175 } 1175 }
1176 bar.hide(); 1176 bar.hide();
1177 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1177 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1178 eventLSync->setReadOnly( false ); 1178 eventLSync->setReadOnly( false );
1179 eventLSync->setDtStart( mLastCalendarSync ); 1179 eventLSync->setDtStart( mLastCalendarSync );
1180 eventRSync->setDtStart( mLastCalendarSync ); 1180 eventRSync->setDtStart( mLastCalendarSync );
1181 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1181 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1182 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1182 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1183 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1183 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1184 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1184 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1185 eventLSync->setReadOnly( true ); 1185 eventLSync->setReadOnly( true );
1186 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1186 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1187 remote->addEvent( eventRSync ); 1187 remote->addEvent( eventRSync );
1188 else 1188 else
1189 delete eventRSync; 1189 delete eventRSync;
1190 QString mes; 1190 QString mes;
1191 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 ); 1191 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 QString delmess; 1192 QString delmess;
1193 if ( delFut ) { 1193 if ( delFut ) {
1194 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1194 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1195 mes += delmess; 1195 mes += delmess;
1196 } 1196 }
1197 mCalendar->checkAlarmForIncidence( 0, true );
1198 qDebug( mes );
1197 if ( mSyncManager->mShowSyncSummary ) { 1199 if ( mSyncManager->mShowSyncSummary ) {
1198 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1200 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1201 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1202 qDebug("cancelled ");
1203 return false;
1204 }
1199 } 1205 }
1200 qDebug( mes );
1201 mCalendar->checkAlarmForIncidence( 0, true );
1202 return syncOK; 1206 return syncOK;
1203} 1207}
1204 1208
1205void CalendarView::setSyncDevice( QString s ) 1209void CalendarView::setSyncDevice( QString s )
1206{ 1210{
1207 mCurrentSyncDevice= s; 1211 mCurrentSyncDevice= s;
1208} 1212}
1209void CalendarView::setSyncName( QString s ) 1213void CalendarView::setSyncName( QString s )
1210{ 1214{
1211 mCurrentSyncName= s; 1215 mCurrentSyncName= s;
1212} 1216}
1213bool CalendarView::syncCalendar(QString filename, int mode) 1217bool CalendarView::syncCalendar(QString filename, int mode)
1214{ 1218{
1215 //qDebug("syncCalendar %s ", filename.latin1()); 1219 //qDebug("syncCalendar %s ", filename.latin1());
1216 mGlobalSyncMode = SYNC_MODE_NORMAL; 1220 mGlobalSyncMode = SYNC_MODE_NORMAL;
1217 CalendarLocal* calendar = new CalendarLocal(); 1221 CalendarLocal* calendar = new CalendarLocal();
1218 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1222 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1219 FileStorage* storage = new FileStorage( calendar ); 1223 FileStorage* storage = new FileStorage( calendar );
1220 bool syncOK = false; 1224 bool syncOK = false;
1221 storage->setFileName( filename ); 1225 storage->setFileName( filename );
1222 // qDebug("loading ... "); 1226 // qDebug("loading ... ");
1223 if ( storage->load() ) { 1227 if ( storage->load() ) {
1224 getEventViewerDialog()->setSyncMode( true ); 1228 getEventViewerDialog()->setSyncMode( true );
1225 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1229 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
@@ -1291,48 +1295,50 @@ void CalendarView::syncExternal( int mode )
1291 sharpFormat->save(calendar); 1295 sharpFormat->save(calendar);
1292#endif 1296#endif
1293 if ( phoneFormat ) 1297 if ( phoneFormat )
1294 phoneFormat->save(calendar); 1298 phoneFormat->save(calendar);
1295 iL = calendar->rawIncidences(); 1299 iL = calendar->rawIncidences();
1296 inc = iL.first(); 1300 inc = iL.first();
1297 Incidence* loc; 1301 Incidence* loc;
1298 while ( inc ) { 1302 while ( inc ) {
1299 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1303 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1300 loc = mCalendar->incidence(inc->uid() ); 1304 loc = mCalendar->incidence(inc->uid() );
1301 if ( loc ) { 1305 if ( loc ) {
1302 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1306 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1303 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1307 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1304 } 1308 }
1305 } 1309 }
1306 inc = iL.next(); 1310 inc = iL.next();
1307 } 1311 }
1308 Incidence* lse = getLastSyncEvent(); 1312 Incidence* lse = getLastSyncEvent();
1309 if ( lse ) { 1313 if ( lse ) {
1310 lse->setReadOnly( false ); 1314 lse->setReadOnly( false );
1311 lse->setDescription( "" ); 1315 lse->setDescription( "" );
1312 lse->setReadOnly( true ); 1316 lse->setReadOnly( true );
1313 } 1317 }
1314 } 1318 }
1319 } else {
1320 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1315 } 1321 }
1316 setModified( true ); 1322 setModified( true );
1317 } else { 1323 } else {
1318 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1324 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1319 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1325 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1320 question, i18n("Ok")) ; 1326 question, i18n("Ok")) ;
1321 1327
1322 } 1328 }
1323 delete calendar; 1329 delete calendar;
1324 updateView(); 1330 updateView();
1325 emit tempDisableBR(false); 1331 emit tempDisableBR(false);
1326 return ;//syncOK; 1332 return ;//syncOK;
1327 1333
1328} 1334}
1329 1335
1330bool CalendarView::importBday() 1336bool CalendarView::importBday()
1331{ 1337{
1332#ifndef KORG_NOKABC 1338#ifndef KORG_NOKABC
1333 1339
1334#ifdef DESKTOP_VERSION 1340#ifdef DESKTOP_VERSION
1335 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1341 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1336 KABC::AddressBook::Iterator it; 1342 KABC::AddressBook::Iterator it;
1337 int count = 0; 1343 int count = 0;
1338 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1344 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {