author | zautrix <zautrix> | 2005-06-15 14:00:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-15 14:00:35 (UTC) |
commit | 40fa3e374fd96c0cb8925a1c3c46d40e1ea2b111 (patch) (side-by-side diff) | |
tree | d28170ea94bbf7f1c7e90ef1fe7cf3807a847fed /korganizer/calendarview.cpp | |
parent | 13c00953a9d521873b03f861e54e83e33b30bc96 (diff) | |
download | kdepimpi-40fa3e374fd96c0cb8925a1c3c46d40e1ea2b111.zip kdepimpi-40fa3e374fd96c0cb8925a1c3c46d40e1ea2b111.tar.gz kdepimpi-40fa3e374fd96c0cb8925a1c3c46d40e1ea2b111.tar.bz2 |
fixes
-rw-r--r-- | korganizer/calendarview.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1338224..377a66f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1846,42 +1846,42 @@ void CalendarView::setSyncEventsReadOnly() bool CalendarView::loadCalendars() { QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); mCalendar->setDefaultCalendar( 1 ); openCalendar( MainWindow::defaultFileName(), false ); cal = calendars.next(); while ( cal ) { addCalendar( cal ); cal = calendars.next(); } restoreCalendarSettings(); - mCalendar->reInitAlarmSettings(); - setSyncEventsReadOnly(); - updateUnmanagedViews(); - updateView(); return true; } bool CalendarView::restoreCalendarSettings() { QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); while ( cal ) { mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); if ( cal->isStandard ) mCalendar->setDefaultCalendar( cal->mCalNumber ); cal = calendars.next(); } + setSyncEventsReadOnly(); + mCalendar->reInitAlarmSettings(); + updateUnmanagedViews(); + updateView(); return true; } void CalendarView::addCalendarId( int id ) { KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); addCalendar( cal ); } bool CalendarView::addCalendar( KopiCalendarFile * cal ) { cal->mErrorOnLoad = false; if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { cal->mLoadDt = QDateTime::currentDateTime(); @@ -1986,53 +1986,56 @@ void CalendarView::watchSavedFile() //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); return; } loadedFileVersion = dt; } bool CalendarView::checkAllFileVersions() { QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); mCalendar->setDefaultCalendar( 1 ); mCalendar->setDefaultCalendarEnabledOnly(); - if ( !checkFileVersion(MainWindow::defaultFileName())) - return false; + if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { + if ( !checkFileVersion(MainWindow::defaultFileName())) { + restoreCalendarSettings(); + return false; + } + } cal = calendars.next(); QDateTime storeTemp = loadedFileVersion; while ( cal ) { - if ( !cal->mErrorOnLoad ) { + if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { mCalendar->setDefaultCalendar( cal->mCalNumber ); mCalendar->setDefaultCalendarEnabledOnly(); loadedFileVersion = cal->mLoadDt.addSecs( 15 ); if ( !checkFileVersion(cal->mFileName )) { loadedFileVersion = storeTemp; - updateView(); + restoreCalendarSettings(); return false; } } cal = calendars.next(); } loadedFileVersion = storeTemp; - updateView(); return true; } bool CalendarView::checkFileVersion(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); - //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); - //qDebug("file on disk version %s",dt.toString().latin1()); + qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); + qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); if ( dt <= loadedFileVersion ) return true; int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , i18n("KO/Pi Warning"),i18n("Overwrite"), i18n("Sync+save")); if ( km == KMessageBox::Cancel ) return false; if ( km == KMessageBox::Yes ) return true; setSyncDevice("deleteaftersync" ); |