-rw-r--r-- | korganizer/calendarview.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b0be340..dd4ea41 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1829,77 +1829,79 @@ bool CalendarView::importQtopia( const QString &categories, #endif } void CalendarView::setSyncEventsReadOnly() { Event * ev; QPtrList<Event> eL = mCalendar->rawEvents(); ev = eL.first(); while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) ev->setReadOnly( true ); ev = eL.next(); } } 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(); } + 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(); return true; } qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); cal->mErrorOnLoad = true; return false; } bool CalendarView::openCalendar(QString filename, bool merge) { if (filename.isEmpty()) { return false; } if (!QFile::exists(filename)) { KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); return false; } globalFlagBlockAgenda = 1; clearAllViews(); @@ -2033,64 +2035,65 @@ bool CalendarView::checkFileVersion(QString fn) return true; setSyncDevice("deleteaftersync" ); mSyncManager->mAskForPreferences = true; mSyncManager->mSyncAlgoPrefs = 3; mSyncManager->mWriteBackFile = false; mSyncManager->mWriteBackExistingOnly = false; mSyncManager->mShowSyncSummary = false; syncCalendar( fn, 3 ); Event * e = getLastSyncEvent(); if ( e ) mCalendar->deleteEvent( e ); return true; } bool CalendarView::saveCalendars() { QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); mCalendar->setDefaultCalendar( 1 ); mCalendar->setDefaultCalendarEnabledOnly(); saveCalendar( MainWindow::defaultFileName() ); cal = calendars.next(); while ( cal ) { if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { mCalendar->setDefaultCalendar( cal->mCalNumber ); mCalendar->setDefaultCalendarEnabledOnly(); if ( saveCalendar( cal->mFileName ) ) cal->mLoadDt = QDateTime::currentDateTime(); } cal = calendars.next(); } restoreCalendarSettings(); + return true; } bool CalendarView::saveCalendar( QString filename ) { // Store back all unsaved data into calendar object // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); if ( mViewManager->currentView() ) mViewManager->currentView()->flushView(); QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); mStorage->setSaveFormat( new ICalFormat() ); mStorage->setFileName( filename ); bool success; success = mStorage->save(); if ( !success ) { return false; } if ( filename == MainWindow::defaultFileName() ) { setLoadedFileVersion( lfv ); watchSavedFile(); } return true; } void CalendarView::closeCalendar() { // child windows no longer valid clearAllViews(); emit closingDown(); |