summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-13 20:42:10 (UTC)
committer zautrix <zautrix>2005-06-13 20:42:10 (UTC)
commitfe1114cea0321405b362d642912f1f72257c7cbd (patch) (unidiff)
tree89f5cc1050a86c497fc406ebbea88669b6bea1a6
parent0000f74badd326f62620d818a5e5d9944e55bda0 (diff)
downloadkdepimpi-fe1114cea0321405b362d642912f1f72257c7cbd.zip
kdepimpi-fe1114cea0321405b362d642912f1f72257c7cbd.tar.gz
kdepimpi-fe1114cea0321405b362d642912f1f72257c7cbd.tar.bz2
fixxxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp45
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/kofilterview.cpp18
-rw-r--r--korganizer/koprefs.h3
-rw-r--r--korganizer/mainwindow.cpp12
5 files changed, 68 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 6e60c56..b0be340 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1881,7 +1881,10 @@ bool CalendarView::addCalendar( KopiCalendarFile * cal )
1881{ 1881{
1882 1882 cal->mErrorOnLoad = false;
1883 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) 1883 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) {
1884 cal->mLoadDt = QDateTime::currentDateTime();
1884 return true; 1885 return true;
1886 }
1885 qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); 1887 qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() );
1886 KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); 1888 KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName));
1889 cal->mErrorOnLoad = true;
1887 return false; 1890 return false;
@@ -1985,3 +1988,29 @@ void CalendarView::watchSavedFile()
1985} 1988}
1986 1989bool CalendarView::checkAllFileVersions()
1990{
1991 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1992 KopiCalendarFile * cal = calendars.first();
1993 mCalendar->setDefaultCalendar( 1 );
1994 mCalendar->setDefaultCalendarEnabledOnly();
1995 if ( !checkFileVersion(MainWindow::defaultFileName()))
1996 return false;
1997 cal = calendars.next();
1998 QDateTime storeTemp = loadedFileVersion;
1999 while ( cal ) {
2000 if ( !cal->mErrorOnLoad ) {
2001 mCalendar->setDefaultCalendar( cal->mCalNumber );
2002 mCalendar->setDefaultCalendarEnabledOnly();
2003 loadedFileVersion = cal->mLoadDt.addSecs( 15 );
2004 if ( !checkFileVersion(cal->mFileName )) {
2005 loadedFileVersion = storeTemp;
2006 updateView();
2007 return false;
2008 }
2009 }
2010 cal = calendars.next();
2011 }
2012 loadedFileVersion = storeTemp;
2013 updateView();
2014 return true;
2015}
1987bool CalendarView::checkFileVersion(QString fn) 2016bool CalendarView::checkFileVersion(QString fn)
@@ -1996,3 +2025,3 @@ bool CalendarView::checkFileVersion(QString fn)
1996 return true; 2025 return true;
1997 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 2026 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)) ,
1998 i18n("KO/Pi Warning"),i18n("Overwrite"), 2027 i18n("KO/Pi Warning"),i18n("Overwrite"),
@@ -2014,4 +2043,3 @@ bool CalendarView::checkFileVersion(QString fn)
2014 if ( e ) 2043 if ( e )
2015 deleteEvent ( e ); 2044 mCalendar->deleteEvent( e );
2016 updateView();
2017 return true; 2045 return true;
@@ -2027,6 +2055,7 @@ bool CalendarView::saveCalendars()
2027 while ( cal ) { 2055 while ( cal ) {
2028 if ( !cal->isReadOnly ) { 2056 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2029 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2057 mCalendar->setDefaultCalendar( cal->mCalNumber );
2030 mCalendar->setDefaultCalendarEnabledOnly(); 2058 mCalendar->setDefaultCalendarEnabledOnly();
2031 saveCalendar( cal->mFileName ); 2059 if ( saveCalendar( cal->mFileName ) )
2060 cal->mLoadDt = QDateTime::currentDateTime();
2032 } 2061 }
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index ec5b7ab..d836fee 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -512,2 +512,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
512 bool checkFileVersion(QString fn); 512 bool checkFileVersion(QString fn);
513 bool checkAllFileVersions();
513 bool checkFileChanged(QString fn); 514 bool checkFileChanged(QString fn);
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 361eec8..19d731f 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -233,3 +233,11 @@ void KOCalEditView::infoCal( int id )
233 QString file = KOPrefs::instance()->getCalendar( id )->mFileName; 233 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
234 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 234 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
235 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) {
236 emit calendarAdded( id );
237 readConfig();
238 emit needsUpdate();
239 }
240 }
241 else
242 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
235} 243}
@@ -296,2 +304,4 @@ void KOCalEditView::readConfig()
296 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); 304 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
305 if ( kkf->mErrorOnLoad )
306 cb->setEnabled( false );
297 cb = new KOCalCheckButton( mw ); 307 cb = new KOCalCheckButton( mw );
@@ -300,2 +310,4 @@ void KOCalEditView::readConfig()
300 cb->setNum( kkf->mCalNumber ); 310 cb->setNum( kkf->mCalNumber );
311 if ( kkf->mErrorOnLoad )
312 cb->setEnabled( false );
301 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 313 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
@@ -311,2 +323,4 @@ void KOCalEditView::readConfig()
311 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 323 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
324 if ( kkf->mErrorOnLoad )
325 cb->setEnabled( false );
312 cb = new KOCalCheckButton( mw ); 326 cb = new KOCalCheckButton( mw );
@@ -316,2 +330,4 @@ void KOCalEditView::readConfig()
316 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 330 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
331 if ( kkf->mErrorOnLoad )
332 cb->setEnabled( false );
317 KColorButton *colb = new KColorButton( mw ); 333 KColorButton *colb = new KColorButton( mw );
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index f114d88..463fc33 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -58,2 +58,3 @@ class KopiCalendarFile : public QObject
58 mDefaultColor = Qt::red; 58 mDefaultColor = Qt::red;
59 mErrorOnLoad = false;
59 } 60 }
@@ -63,2 +64,3 @@ class KopiCalendarFile : public QObject
63 bool isReadOnly; 64 bool isReadOnly;
65 bool mErrorOnLoad;
64 QString mName; 66 QString mName;
@@ -67,2 +69,3 @@ class KopiCalendarFile : public QObject
67 QColor mDefaultColor; 69 QColor mDefaultColor;
70 QDateTime mLoadDt;
68}; 71};
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index f05ada5..472a978 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1826,3 +1826,3 @@ void MainWindow::save()
1826 mSyncManager->setBlockSave(true); 1826 mSyncManager->setBlockSave(true);
1827 if ( mView->checkFileVersion( defaultFileName()) ) { 1827 if ( mView->checkAllFileVersions() ) {
1828 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1828 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
@@ -1845,4 +1845,12 @@ void MainWindow::save()
1845 // backup ok 1845 // backup ok
1846 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1847 KopiCalendarFile * cal = calendars.first();
1848 cal = calendars.next();
1849 while ( cal ) {
1850 if ( !cal->mErrorOnLoad ) {
1851 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1852 }
1853 cal = calendars.next();
1854 }
1846 KOPrefs::instance()->mLastBackupDate = daysTo; 1855 KOPrefs::instance()->mLastBackupDate = daysTo;
1847
1848 } else if ( retval == 2 ){ 1856 } else if ( retval == 2 ){