-rw-r--r-- | korganizer/koprefs.cpp | 33 | ||||
-rw-r--r-- | korganizer/koprefs.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
3 files changed, 29 insertions, 14 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 9366c11..8f37793 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -327,69 +327,80 @@ void KOPrefs::usrSetDefaults() void KOPrefs::fillMailDefaults() { if (mName.isEmpty()) mName = i18n("Anonymous"); if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); } void KOPrefs::setTimeZoneIdDefault() { ; } +void KOPrefs::setAllDefaults() +{ + setCategoryDefaults(); + mEventSummaryUser = getDefaultList() ; + mTodoSummaryUser = getDefaultList() ; + mLocationDefaults = getLocationDefaultList(); +} + void KOPrefs::setCategoryDefaults() { mCustomCategories.clear(); mCustomCategories = getDefaultList(); QStringList::Iterator it; for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { setCategoryColor(*it,mDefaultCategoryColor); } } +QStringList KOPrefs::getLocationDefaultList() +{ + QStringList retval ; + retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") + << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") + << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") + << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; + // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") + retval.sort(); + return retval; +} QStringList KOPrefs::getDefaultList() { QStringList retval ; retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; retval.sort(); - //qDebug("cat %s ", retval.join("-").latin1()); + qDebug("cat %s ", retval.join("-").latin1()); return retval; } void KOPrefs::usrReadConfig() { config()->setGroup("General"); + //qDebug("KOPrefs::usrReadConfig() "); mCustomCategories = config()->readListEntry("Custom Categories"); - if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { - mLocationDefaults.clear(); - mEventSummaryUser.clear(); - mTodoSummaryUser.clear(); - } mOldLoadedLanguage = mOldLanguage ; mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; if (mLocationDefaults.isEmpty()) { - mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") - << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") - << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; - // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") - mLocationDefaults.sort(); + mLocationDefaults = getLocationDefaultList(); } if (mEventSummaryUser.isEmpty()) { mEventSummaryUser = getDefaultList() ; } if (mTodoSummaryUser.isEmpty()) { mTodoSummaryUser = getDefaultList() ; } if (mCustomCategories.isEmpty()) setCategoryDefaults(); config()->setGroup("Personal Settings"); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index dddcdca..fa69d52 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -48,38 +48,40 @@ class KOPrefs : public KPimPrefs instance. */ static KOPrefs *instance(); /** Set preferences to default values */ void usrSetDefaults(); /** Read preferences from config file */ void usrReadConfig(); /** Write preferences to config file */ void usrWriteConfig(); void setCategoryDefaults(); + void setAllDefaults(); protected: void setTimeZoneIdDefault(); /** Fill empty mail fields with default values. */ void fillMailDefaults(); private: /** Constructor disabled for public. Use instance() to create a KOPrefs object. */ KOPrefs(); static KOPrefs *mInstance; QStringList getDefaultList(); + QStringList getLocationDefaultList(); public: // preferences data KConfig* getConfig(); void setFullName(const QString &); QString fullName(); void setEmail(const QString &); QString email(); QString mAdditional; bool mEmailControlCenter; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 1c74307..348dd5e 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -123,66 +123,68 @@ class KOex2phonePrefs : public QDialog public: QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; QCheckBox* mWriteBackFuture; QSpinBox* mWriteBackFutureWeeks; }; int globalFlagBlockStartup; MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : QMainWindow( parent, name ) { + #ifdef DESKTOP_VERSION setFont( QFont("Arial"), 14 ); #endif mClosed = false; //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; QString confFile = locateLocal("config","korganizerrc"); QFileInfo finf ( confFile ); bool showWarning = !finf.exists(); setIcon(SmallIcon( "ko24" ) ); mBlockAtStartup = true; mFlagKeyPressed = false; - setCaption("KOrganizer/Pi"); - KPimGlobalPrefs::instance()->setGlobalConfig(); KOPrefs *p = KOPrefs::instance(); + KPimGlobalPrefs::instance()->setGlobalConfig(); if ( p->mHourSize > 18 ) p->mHourSize = 18; QMainWindow::ToolBarDock tbd; if ( p->mToolBarHor ) { if ( p->mToolBarUp ) tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUp ) tbd = Right; else tbd = Left; } if ( KOPrefs::instance()->mUseAppColors ) QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); globalFlagBlockStartup = 1; iconToolBar = new QPEToolBar( this ); addToolBar (iconToolBar , tbd ); mCalendarModifiedFlag = false; + setCaption("KOrganizer/Pi"); QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); splash->setAlignment ( AlignCenter ); setCentralWidget( splash ); #ifndef DESKTOP_VERSION showMaximized(); #endif + //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); setDefaultPreferences(); mCalendar = new CalendarLocal(); mView = new CalendarView( mCalendar, this,"mCalendar " ); mView->hide(); //mView->resize(splash->size() ); initActions(); mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); mSyncManager->setBlockSave(false); mView->setSyncManager(mSyncManager); #ifndef DESKTOP_VERSION iconToolBar->show(); @@ -222,25 +224,25 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : } } mView->saveCalendar( defaultFileName() ); newFile = true; } QTime neededSaveTime = QDateTime::currentDateTime().time(); mView->openCalendar( defaultFileName() ); int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Calendar loading time: %d ms",msNeeded ); if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { - KOPrefs::instance()->setCategoryDefaults(); + KOPrefs::instance()->setAllDefaults(); int count = mView->addCategories(); } processIncidenceSelection( 0 ); connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processIncidenceSelection( Incidence * ) ) ); connect( mView, SIGNAL( modifiedChanged( bool ) ), SLOT( slotModifiedChanged( bool ) ) ); connect( mView, SIGNAL( tempDisableBR(bool) ), SLOT( disableBR(bool) ) ); connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |