author | zautrix <zautrix> | 2005-06-13 10:51:47 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-13 10:51:47 (UTC) |
commit | 4f3ff02932b39bf16b9692c3cb69c101a28b4616 (patch) (side-by-side diff) | |
tree | bae36a7e654c788a0994bb353f3997b495e2459c /korganizer | |
parent | 2be8214908c52298ba79c8058d340edca5a8b417 (diff) | |
download | kdepimpi-4f3ff02932b39bf16b9692c3cb69c101a28b4616.zip kdepimpi-4f3ff02932b39bf16b9692c3cb69c101a28b4616.tar.gz kdepimpi-4f3ff02932b39bf16b9692c3cb69c101a28b4616.tar.bz2 |
fixx
-rw-r--r-- | korganizer/calendarview.cpp | 63 | ||||
-rw-r--r-- | korganizer/calendarview.h | 7 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
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 @@ -458,8 +458,12 @@ void CalendarView::init() //leftFrameLayout->addWidget( mDateNavigator ); 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 ) { leftFrameLayout->addWidget(mFilterView); @@ -1833,8 +1837,48 @@ void CalendarView::setSyncEventsReadOnly() 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(); +} +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(); + } +} +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) { if (filename.isEmpty()) { @@ -1963,9 +2007,26 @@ bool CalendarView::checkFileVersion(QString fn) deleteEvent ( e ); updateView(); 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 ) { + mCalendar->setDefaultCalendar( cal->mCalNumber ); + mCalendar->setDefaultCalendarEnabledOnly(); + saveCalendar( cal->mFileName ); + } + cal = calendars.next(); + } + restoreCalendarSettings(); +} bool CalendarView::saveCalendar( QString filename ) { // Store back all unsaved data into calendar object diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index cdce072..0144ba4 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -43,12 +43,13 @@ #include <korganizer/calendarviewbase.h> #include <ksyncmanager.h> +//#include <koprefs.h> class QWidgetStack; class QSplitter; - +class KopiCalendarFile; class CalPrinter; class KOFilterView; class KOCalEditView; class KOViewManager; @@ -221,8 +222,12 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser calendar into existing one, if it is false, clear calendar, before loading. Return true, if calendar could be successfully loaded. */ bool openCalendar(QString filename, bool merge=false); + bool loadCalendars(); + bool saveCalendars(); + bool restoreCalendarSettings(); + bool addCalendar( KopiCalendarFile * ); bool syncCalendar(QString filename,int mode = 0 ); /** Save calendar data to file. Return true if calendar could be diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 2dd4567..29a4393 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -65,9 +65,9 @@ class KONewCalPrefs : public QDialog QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); lay->addWidget( cancel ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); - resize( 200, 200 ); + //resize( 200, 200 ); } QString calName() { return nameE->text(); } QString calFileName() { return url->url(); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 95e1607..f05ada5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -307,9 +307,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : newFile = true; } QTime neededSaveTime = QDateTime::currentDateTime().time(); - mView->openCalendar( defaultFileName() ); + mView->loadCalendars(); int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Calendar loading time: %d ms",msNeeded ); if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { @@ -1856,9 +1856,9 @@ void MainWindow::save() } QTime neededSaveTime = QDateTime::currentDateTime().time(); setCaption(i18n("KO/Pi:Saving Data to File ..." )); qDebug("KO: Start saving data to file!"); - mView->saveCalendar( defaultFileName() ); + mView->saveCalendars(); mCalendarModifiedFlag = false; int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Needed %d ms for saving.",msNeeded ); QString savemes; |