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) (unidiff)
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
@@ -458,8 +458,12 @@ void CalendarView::init()
458 //leftFrameLayout->addWidget( mDateNavigator ); 458 //leftFrameLayout->addWidget( mDateNavigator );
459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
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 );
463#if 0 467#if 0
464 if ( QApplication::desktop()->width() < 480 ) { 468 if ( QApplication::desktop()->width() < 480 ) {
465 leftFrameLayout->addWidget(mFilterView); 469 leftFrameLayout->addWidget(mFilterView);
@@ -1833,8 +1837,48 @@ void CalendarView::setSyncEventsReadOnly()
1833 ev->setReadOnly( true ); 1837 ev->setReadOnly( true );
1834 ev = eL.next(); 1838 ev = eL.next();
1835 } 1839 }
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)
1838{ 1882{
1839 1883
1840 if (filename.isEmpty()) { 1884 if (filename.isEmpty()) {
@@ -1963,9 +2007,26 @@ bool CalendarView::checkFileVersion(QString fn)
1963 deleteEvent ( e ); 2007 deleteEvent ( e );
1964 updateView(); 2008 updateView();
1965 return true; 2009 return true;
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 )
1969{ 2030{
1970 2031
1971 // Store back all unsaved data into calendar object 2032 // 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 @@
43 43
44#include <korganizer/calendarviewbase.h> 44#include <korganizer/calendarviewbase.h>
45 45
46#include <ksyncmanager.h> 46#include <ksyncmanager.h>
47//#include <koprefs.h>
47 48
48class QWidgetStack; 49class QWidgetStack;
49class QSplitter; 50class QSplitter;
50 51class KopiCalendarFile;
51class CalPrinter; 52class CalPrinter;
52class KOFilterView; 53class KOFilterView;
53class KOCalEditView; 54class KOCalEditView;
54class KOViewManager; 55class KOViewManager;
@@ -221,8 +222,12 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
221 calendar into existing one, if it is false, clear calendar, before 222 calendar into existing one, if it is false, clear calendar, before
222 loading. Return true, if calendar could be successfully loaded. 223 loading. Return true, if calendar could be successfully loaded.
223 */ 224 */
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 );
226 231
227 /** 232 /**
228 Save calendar data to file. Return true if calendar could be 233 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
65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
66 lay->addWidget( cancel ); 66 lay->addWidget( cancel );
67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
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 }
71 71
72 QString calName() { return nameE->text(); } 72 QString calName() { return nameE->text(); }
73 QString calFileName() { return url->url(); } 73 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) :
307 newFile = true; 307 newFile = true;
308 } 308 }
309 309
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() );
313 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 313 qDebug("KO: Calendar loading time: %d ms",msNeeded );
314 314
315 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 315 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
@@ -1856,9 +1856,9 @@ void MainWindow::save()
1856 } 1856 }
1857 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1857 QTime neededSaveTime = QDateTime::currentDateTime().time();
1858 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1858 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
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;
1862 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1862 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1863 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1863 qDebug("KO: Needed %d ms for saving.",msNeeded );
1864 QString savemes; 1864 QString savemes;