author | zautrix <zautrix> | 2005-02-06 16:21:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 16:21:57 (UTC) |
commit | 5fd7b1cc63dc52c15e0666e023cea60700e9fdcf (patch) (unidiff) | |
tree | b0bf4d7d3054679970e2ff672e50149d1089bcb1 | |
parent | 38898c49275bf27fb8c2df96d145f2a5abb62331 (diff) | |
download | kdepimpi-5fd7b1cc63dc52c15e0666e023cea60700e9fdcf.zip kdepimpi-5fd7b1cc63dc52c15e0666e023cea60700e9fdcf.tar.gz kdepimpi-5fd7b1cc63dc52c15e0666e023cea60700e9fdcf.tar.bz2 |
fix
-rw-r--r-- | korganizer/koprefs.cpp | 65 | ||||
-rw-r--r-- | korganizer/koprefs.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
3 files changed, 45 insertions, 30 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 9366c11..8f37793 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -331,85 +331,96 @@ void KOPrefs::fillMailDefaults() | |||
331 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 331 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
332 | } | 332 | } |
333 | 333 | ||
334 | void KOPrefs::setTimeZoneIdDefault() | 334 | void KOPrefs::setTimeZoneIdDefault() |
335 | { | 335 | { |
336 | ; | 336 | ; |
337 | } | 337 | } |
338 | 338 | ||
339 | void KOPrefs::setAllDefaults() | ||
340 | { | ||
341 | setCategoryDefaults(); | ||
342 | mEventSummaryUser = getDefaultList() ; | ||
343 | mTodoSummaryUser = getDefaultList() ; | ||
344 | mLocationDefaults = getLocationDefaultList(); | ||
345 | } | ||
346 | |||
339 | void KOPrefs::setCategoryDefaults() | 347 | void KOPrefs::setCategoryDefaults() |
340 | { | 348 | { |
341 | mCustomCategories.clear(); | 349 | mCustomCategories.clear(); |
342 | mCustomCategories = getDefaultList(); | 350 | mCustomCategories = getDefaultList(); |
343 | 351 | ||
344 | QStringList::Iterator it; | 352 | QStringList::Iterator it; |
345 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 353 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
346 | setCategoryColor(*it,mDefaultCategoryColor); | 354 | setCategoryColor(*it,mDefaultCategoryColor); |
347 | } | 355 | } |
348 | } | 356 | } |
357 | QStringList KOPrefs::getLocationDefaultList() | ||
358 | { | ||
359 | QStringList retval ; | ||
360 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | ||
361 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | ||
362 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | ||
363 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | ||
364 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | ||
349 | 365 | ||
366 | retval.sort(); | ||
367 | return retval; | ||
368 | } | ||
350 | QStringList KOPrefs::getDefaultList() | 369 | QStringList KOPrefs::getDefaultList() |
351 | { | 370 | { |
352 | QStringList retval ; | 371 | QStringList retval ; |
353 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 372 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
354 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 373 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
355 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 374 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
356 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 375 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
357 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 376 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
358 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 377 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
359 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 378 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
360 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 379 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
361 | retval.sort(); | 380 | retval.sort(); |
362 | //qDebug("cat %s ", retval.join("-").latin1()); | 381 | qDebug("cat %s ", retval.join("-").latin1()); |
363 | return retval; | 382 | return retval; |
364 | } | 383 | } |
365 | 384 | ||
366 | void KOPrefs::usrReadConfig() | 385 | void KOPrefs::usrReadConfig() |
367 | { | 386 | { |
368 | config()->setGroup("General"); | 387 | config()->setGroup("General"); |
369 | 388 | ||
389 | //qDebug("KOPrefs::usrReadConfig() "); | ||
370 | mCustomCategories = config()->readListEntry("Custom Categories"); | 390 | mCustomCategories = config()->readListEntry("Custom Categories"); |
371 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { | ||
372 | mLocationDefaults.clear(); | ||
373 | mEventSummaryUser.clear(); | ||
374 | mTodoSummaryUser.clear(); | ||
375 | } | ||
376 | mOldLoadedLanguage = mOldLanguage ; | 391 | mOldLoadedLanguage = mOldLanguage ; |
377 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 392 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
378 | if (mLocationDefaults.isEmpty()) { | 393 | if (mLocationDefaults.isEmpty()) { |
379 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 394 | mLocationDefaults = getLocationDefaultList(); |
380 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | ||
381 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | ||
382 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | ||
383 | mLocationDefaults.sort(); | ||
384 | } | 395 | } |
385 | 396 | ||
386 | if (mEventSummaryUser.isEmpty()) { | 397 | if (mEventSummaryUser.isEmpty()) { |
387 | mEventSummaryUser = getDefaultList() ; | 398 | mEventSummaryUser = getDefaultList() ; |
388 | } | 399 | } |
389 | if (mTodoSummaryUser.isEmpty()) { | 400 | if (mTodoSummaryUser.isEmpty()) { |
390 | mTodoSummaryUser = getDefaultList() ; | 401 | mTodoSummaryUser = getDefaultList() ; |
391 | } | 402 | } |
392 | 403 | ||
393 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 404 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
394 | 405 | ||
395 | config()->setGroup("Personal Settings"); | 406 | config()->setGroup("Personal Settings"); |
396 | mName = config()->readEntry("user_name",""); | 407 | mName = config()->readEntry("user_name",""); |
397 | mEmail = config()->readEntry("user_email",""); | 408 | mEmail = config()->readEntry("user_email",""); |
398 | fillMailDefaults(); | 409 | fillMailDefaults(); |
399 | 410 | ||
400 | config()->setGroup("Category Colors"); | 411 | config()->setGroup("Category Colors"); |
401 | QStringList::Iterator it; | 412 | QStringList::Iterator it; |
402 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 413 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
403 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 414 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
404 | 415 | ||
405 | } | 416 | } |
406 | 417 | ||
407 | KPimPrefs::usrReadConfig(); | 418 | KPimPrefs::usrReadConfig(); |
408 | } | 419 | } |
409 | 420 | ||
410 | 421 | ||
411 | void KOPrefs::usrWriteConfig() | 422 | void KOPrefs::usrWriteConfig() |
412 | { | 423 | { |
413 | config()->setGroup("General"); | 424 | config()->setGroup("General"); |
414 | config()->writeEntry("Custom Categories",mCustomCategories); | 425 | config()->writeEntry("Custom Categories",mCustomCategories); |
415 | 426 | ||
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index dddcdca..fa69d52 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -52,30 +52,32 @@ class KOPrefs : public KPimPrefs | |||
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | void setAllDefaults(); | ||
60 | 61 | ||
61 | protected: | 62 | protected: |
62 | void setTimeZoneIdDefault(); | 63 | void setTimeZoneIdDefault(); |
63 | 64 | ||
64 | /** Fill empty mail fields with default values. */ | 65 | /** Fill empty mail fields with default values. */ |
65 | void fillMailDefaults(); | 66 | void fillMailDefaults(); |
66 | 67 | ||
67 | private: | 68 | private: |
68 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 69 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
69 | object. */ | 70 | object. */ |
70 | KOPrefs(); | 71 | KOPrefs(); |
71 | 72 | ||
72 | static KOPrefs *mInstance; | 73 | static KOPrefs *mInstance; |
73 | QStringList getDefaultList(); | 74 | QStringList getDefaultList(); |
75 | QStringList getLocationDefaultList(); | ||
74 | public: | 76 | public: |
75 | // preferences data | 77 | // preferences data |
76 | KConfig* getConfig(); | 78 | KConfig* getConfig(); |
77 | void setFullName(const QString &); | 79 | void setFullName(const QString &); |
78 | QString fullName(); | 80 | QString fullName(); |
79 | void setEmail(const QString &); | 81 | void setEmail(const QString &); |
80 | QString email(); | 82 | QString email(); |
81 | 83 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 1c74307..348dd5e 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -127,30 +127,30 @@ public: | |||
127 | QSpinBox* mWriteBackFutureWeeks; | 127 | QSpinBox* mWriteBackFutureWeeks; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | int globalFlagBlockStartup; | 130 | int globalFlagBlockStartup; |
131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
132 | QMainWindow( parent, name ) | 132 | QMainWindow( parent, name ) |
133 | { | 133 | { |
134 | 134 | ||
135 | |||
135 | #ifdef DESKTOP_VERSION | 136 | #ifdef DESKTOP_VERSION |
136 | setFont( QFont("Arial"), 14 ); | 137 | setFont( QFont("Arial"), 14 ); |
137 | #endif | 138 | #endif |
138 | mClosed = false; | 139 | mClosed = false; |
139 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 140 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
140 | QString confFile = locateLocal("config","korganizerrc"); | 141 | QString confFile = locateLocal("config","korganizerrc"); |
141 | QFileInfo finf ( confFile ); | 142 | QFileInfo finf ( confFile ); |
142 | bool showWarning = !finf.exists(); | 143 | bool showWarning = !finf.exists(); |
143 | setIcon(SmallIcon( "ko24" ) ); | 144 | setIcon(SmallIcon( "ko24" ) ); |
144 | mBlockAtStartup = true; | 145 | mBlockAtStartup = true; |
145 | mFlagKeyPressed = false; | 146 | mFlagKeyPressed = false; |
146 | setCaption("KOrganizer/Pi"); | ||
147 | KPimGlobalPrefs::instance()->setGlobalConfig(); | ||
148 | KOPrefs *p = KOPrefs::instance(); | 147 | KOPrefs *p = KOPrefs::instance(); |
148 | KPimGlobalPrefs::instance()->setGlobalConfig(); | ||
149 | if ( p->mHourSize > 18 ) | 149 | if ( p->mHourSize > 18 ) |
150 | p->mHourSize = 18; | 150 | p->mHourSize = 18; |
151 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 154 | tbd = Bottom; |
155 | else | 155 | else |
156 | tbd = Top; | 156 | tbd = Top; |
@@ -163,22 +163,24 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
163 | } | 163 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 164 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
169 | mCalendarModifiedFlag = false; | 169 | mCalendarModifiedFlag = false; |
170 | 170 | ||
171 | setCaption("KOrganizer/Pi"); | ||
171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 172 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
172 | splash->setAlignment ( AlignCenter ); | 173 | splash->setAlignment ( AlignCenter ); |
173 | setCentralWidget( splash ); | 174 | setCentralWidget( splash ); |
174 | #ifndef DESKTOP_VERSION | 175 | #ifndef DESKTOP_VERSION |
175 | showMaximized(); | 176 | showMaximized(); |
176 | #endif | 177 | #endif |
178 | |||
177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 179 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
178 | setDefaultPreferences(); | 180 | setDefaultPreferences(); |
179 | mCalendar = new CalendarLocal(); | 181 | mCalendar = new CalendarLocal(); |
180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 182 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
181 | mView->hide(); | 183 | mView->hide(); |
182 | //mView->resize(splash->size() ); | 184 | //mView->resize(splash->size() ); |
183 | initActions(); | 185 | initActions(); |
184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 186 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
@@ -226,17 +228,17 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
226 | } | 228 | } |
227 | 229 | ||
228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 230 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
229 | mView->openCalendar( defaultFileName() ); | 231 | mView->openCalendar( defaultFileName() ); |
230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 232 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 233 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
232 | 234 | ||
233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 235 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
234 | KOPrefs::instance()->setCategoryDefaults(); | 236 | KOPrefs::instance()->setAllDefaults(); |
235 | int count = mView->addCategories(); | 237 | int count = mView->addCategories(); |
236 | } | 238 | } |
237 | processIncidenceSelection( 0 ); | 239 | processIncidenceSelection( 0 ); |
238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 240 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
239 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 241 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 242 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
241 | SLOT( slotModifiedChanged( bool ) ) ); | 243 | SLOT( slotModifiedChanged( bool ) ) ); |
242 | 244 | ||