summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-13 10:51:47 (UTC)
committer zautrix <zautrix>2005-06-13 10:51:47 (UTC)
commit4f3ff02932b39bf16b9692c3cb69c101a28b4616 (patch) (side-by-side diff)
treebae36a7e654c788a0994bb353f3997b495e2459c /korganizer
parent2be8214908c52298ba79c8058d340edca5a8b417 (diff)
downloadkdepimpi-4f3ff02932b39bf16b9692c3cb69c101a28b4616.zip
kdepimpi-4f3ff02932b39bf16b9692c3cb69c101a28b4616.tar.gz
kdepimpi-4f3ff02932b39bf16b9692c3cb69c101a28b4616.tar.bz2
fixx
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
@@ -460,4 +460,8 @@ void CalendarView::init()
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
@@ -1835,4 +1839,44 @@ void CalendarView::setSyncEventsReadOnly()
}
}
+
+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)
{
@@ -1965,5 +2009,22 @@ bool CalendarView::checkFileVersion(QString fn)
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 )
{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index cdce072..0144ba4 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -45,8 +45,9 @@
#include <ksyncmanager.h>
+//#include <koprefs.h>
class QWidgetStack;
class QSplitter;
-
+class KopiCalendarFile;
class CalPrinter;
class KOFilterView;
@@ -223,4 +224,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
*/
bool openCalendar(QString filename, bool merge=false);
+ bool loadCalendars();
+ bool saveCalendars();
+ bool restoreCalendarSettings();
+ bool addCalendar( KopiCalendarFile * );
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
@@ -67,5 +67,5 @@ class KONewCalPrefs : public QDialog
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
- resize( 200, 200 );
+ //resize( 200, 200 );
}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 95e1607..f05ada5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -309,5 +309,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 );
@@ -1858,5 +1858,5 @@ void MainWindow::save()
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() );