From 39f1119563e038a029fd23c4b3af03eda02fe308 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 17 Aug 2005 19:50:38 +0000 Subject: kopi save error warning --- (limited to 'korganizer') diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 316826a..ca071b2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -835,7 +835,7 @@ void CalendarView::checkFiles() } if ( !message.isEmpty() ) { message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); - KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); + KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); } static bool firstTime = true; if ( firstTime ) { @@ -2531,7 +2531,9 @@ bool CalendarView::saveCalendars() KopiCalendarFile * cal = calendars.first(); mCalendar->setDefaultCalendar( 1 ); mCalendar->setDefaultCalendarEnabledOnly(); - saveCalendar( MainWindow::defaultFileName() ); + QString saveError; + if ( !saveCalendar( MainWindow::defaultFileName() ) ) + saveError = cal->mName +"\n"; cal = calendars.next(); while ( cal ) { if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { @@ -2539,10 +2541,18 @@ bool CalendarView::saveCalendars() mCalendar->setDefaultCalendarEnabledOnly(); if ( saveCalendar( cal->mFileName ) ) cal->mLoadDt = QDateTime::currentDateTime(); + else + saveError += cal->mName + "\n"; } cal = calendars.next(); } restoreCalendarSettings(); + + if ( !saveError.isEmpty() ) { + saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError; + KMessageBox::error(this, saveError, i18n("Error saving data")); + return false; + } return true; } bool CalendarView::saveCalendar( QString filename ) diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 94bc4c1..9c55e9f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -506,6 +506,10 @@ void MainWindow::closeEvent( QCloseEvent* ce ) if ( ! KOPrefs::instance()->mAskForQuit ) { saveOnClose(); + if ( mCalendarModifiedFlag ) { + ce->ignore(); + return; + } mClosed = true; ce->accept(); return; @@ -518,6 +522,10 @@ void MainWindow::closeEvent( QCloseEvent* ce ) 0, 0 ) ) { case 0: saveOnClose(); + if ( mCalendarModifiedFlag ) { + ce->ignore(); + return; + } mClosed = true; ce->accept(); break; @@ -2002,8 +2010,8 @@ void MainWindow::save() if ( !isMinimized () ) setCaption(i18n("KO/Pi:Saving Data to File ..." )); qDebug("KO: Start saving data to file!"); - mView->saveCalendars(); - mCalendarModifiedFlag = false; + if ( mView->saveCalendars() ) + mCalendarModifiedFlag = false; int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Needed %d ms for saving.",msNeeded ); QString savemes; -- cgit v0.9.0.2