From 4f3ff02932b39bf16b9692c3cb69c101a28b4616 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 13 Jun 2005 10:51:47 +0000 Subject: fixx --- (limited to 'korganizer/calendarview.cpp') diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b3686aa..07ec459 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -459,6 +459,10 @@ void CalendarView::init() mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); + connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); + connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); + connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); + connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); mTodoList->setNavigator( mNavigator ); #if 0 if ( QApplication::desktop()->width() < 480 ) { @@ -1834,6 +1838,46 @@ void CalendarView::setSyncEventsReadOnly() ev = eL.next(); } } + +bool CalendarView::loadCalendars() +{ + QPtrList 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(); +} +bool CalendarView::restoreCalendarSettings() +{ + QPtrList 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(); + } +} +bool CalendarView::addCalendar( KopiCalendarFile * cal ) +{ + + if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) + 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)); + return false; +} bool CalendarView::openCalendar(QString filename, bool merge) { @@ -1964,7 +2008,24 @@ bool CalendarView::checkFileVersion(QString fn) updateView(); return true; } - +bool CalendarView::saveCalendars() +{ + QPtrList calendars = KOPrefs::instance()->mCalendars; + KopiCalendarFile * cal = calendars.first(); + mCalendar->setDefaultCalendar( 1 ); + mCalendar->setDefaultCalendarEnabledOnly(); + saveCalendar( MainWindow::defaultFileName() ); + cal = calendars.next(); + while ( cal ) { + if ( !cal->isReadOnly ) { + mCalendar->setDefaultCalendar( cal->mCalNumber ); + mCalendar->setDefaultCalendarEnabledOnly(); + saveCalendar( cal->mFileName ); + } + cal = calendars.next(); + } + restoreCalendarSettings(); +} bool CalendarView::saveCalendar( QString filename ) { -- cgit v0.9.0.2