summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp63
-rw-r--r--korganizer/calendarview.h7
-rw-r--r--korganizer/kofilterview.cpp2
-rw-r--r--korganizer/mainwindow.cpp4
4 files changed, 71 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index b3686aa..07ec459 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -461,2 +461,6 @@ void CalendarView::init()
461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
462 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
463 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
462 mTodoList->setNavigator( mNavigator ); 466 mTodoList->setNavigator( mNavigator );
@@ -1836,2 +1840,42 @@ void CalendarView::setSyncEventsReadOnly()
1836} 1840}
1841
1842bool CalendarView::loadCalendars()
1843{
1844 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1845 KopiCalendarFile * cal = calendars.first();
1846 mCalendar->setDefaultCalendar( 1 );
1847 openCalendar( MainWindow::defaultFileName(), false );
1848 cal = calendars.next();
1849 while ( cal ) {
1850 addCalendar( cal );
1851 cal = calendars.next();
1852 }
1853 restoreCalendarSettings();
1854 mCalendar->reInitAlarmSettings();
1855 setSyncEventsReadOnly();
1856 updateUnmanagedViews();
1857 updateView();
1858}
1859bool CalendarView::restoreCalendarSettings()
1860{
1861 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1862 KopiCalendarFile * cal = calendars.first();
1863 while ( cal ) {
1864 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
1865 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
1866 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
1867 if ( cal->isStandard )
1868 mCalendar->setDefaultCalendar( cal->mCalNumber );
1869 cal = calendars.next();
1870 }
1871}
1872bool CalendarView::addCalendar( KopiCalendarFile * cal )
1873{
1874
1875 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber ))
1876 return true;
1877 qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() );
1878 KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName));
1879 return false;
1880}
1837bool CalendarView::openCalendar(QString filename, bool merge) 1881bool CalendarView::openCalendar(QString filename, bool merge)
@@ -1966,3 +2010,20 @@ bool CalendarView::checkFileVersion(QString fn)
1966} 2010}
1967 2011bool CalendarView::saveCalendars()
2012{
2013 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2014 KopiCalendarFile * cal = calendars.first();
2015 mCalendar->setDefaultCalendar( 1 );
2016 mCalendar->setDefaultCalendarEnabledOnly();
2017 saveCalendar( MainWindow::defaultFileName() );
2018 cal = calendars.next();
2019 while ( cal ) {
2020 if ( !cal->isReadOnly ) {
2021 mCalendar->setDefaultCalendar( cal->mCalNumber );
2022 mCalendar->setDefaultCalendarEnabledOnly();
2023 saveCalendar( cal->mFileName );
2024 }
2025 cal = calendars.next();
2026 }
2027 restoreCalendarSettings();
2028}
1968bool CalendarView::saveCalendar( QString filename ) 2029bool CalendarView::saveCalendar( QString filename )
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index cdce072..0144ba4 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -46,2 +46,3 @@
46#include <ksyncmanager.h> 46#include <ksyncmanager.h>
47//#include <koprefs.h>
47 48
@@ -49,3 +50,3 @@ class QWidgetStack;
49class QSplitter; 50class QSplitter;
50 51class KopiCalendarFile;
51class CalPrinter; 52class CalPrinter;
@@ -224,2 +225,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
224 bool openCalendar(QString filename, bool merge=false); 225 bool openCalendar(QString filename, bool merge=false);
226 bool loadCalendars();
227 bool saveCalendars();
228 bool restoreCalendarSettings();
229 bool addCalendar( KopiCalendarFile * );
225 bool syncCalendar(QString filename,int mode = 0 ); 230 bool syncCalendar(QString filename,int mode = 0 );
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 2dd4567..29a4393 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -68,3 +68,3 @@ class KONewCalPrefs : public QDialog
68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
69 resize( 200, 200 ); 69 //resize( 200, 200 );
70 } 70 }
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 95e1607..f05ada5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -310,3 +310,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
310 QTime neededSaveTime = QDateTime::currentDateTime().time(); 310 QTime neededSaveTime = QDateTime::currentDateTime().time();
311 mView->openCalendar( defaultFileName() ); 311 mView->loadCalendars();
312 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 312 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
@@ -1859,3 +1859,3 @@ void MainWindow::save()
1859 qDebug("KO: Start saving data to file!"); 1859 qDebug("KO: Start saving data to file!");
1860 mView->saveCalendar( defaultFileName() ); 1860 mView->saveCalendars();
1861 mCalendarModifiedFlag = false; 1861 mCalendarModifiedFlag = false;