author | zautrix <zautrix> | 2005-04-13 23:54:32 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-13 23:54:32 (UTC) |
commit | 5ea16ef9058a21016402dd5affc0a7f82857e606 (patch) (unidiff) | |
tree | 3c147e24c3bd51208a8055a94e4a487a1708d337 /libkdepim | |
parent | 93b536533e1c908085adb61553907615c31786c0 (diff) | |
download | kdepimpi-5ea16ef9058a21016402dd5affc0a7f82857e606.zip kdepimpi-5ea16ef9058a21016402dd5affc0a7f82857e606.tar.gz kdepimpi-5ea16ef9058a21016402dd5affc0a7f82857e606.tar.bz2 |
fix
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 11 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 5 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.h | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index d62d9f9..759b29d 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -56,128 +56,139 @@ $Id$ | |||
56 | #include <qlabel.h> | 56 | #include <qlabel.h> |
57 | #include <qfile.h> | 57 | #include <qfile.h> |
58 | 58 | ||
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | #include <kdebug.h> | 60 | #include <kdebug.h> |
61 | #include <kdialog.h> | 61 | #include <kdialog.h> |
62 | #include <klistview.h> | 62 | #include <klistview.h> |
63 | #include <klocale.h> | 63 | #include <klocale.h> |
64 | #include <kglobal.h> | 64 | #include <kglobal.h> |
65 | #include <kmessagebox.h> | 65 | #include <kmessagebox.h> |
66 | #include <kstandarddirs.h> | 66 | #include <kstandarddirs.h> |
67 | 67 | ||
68 | #ifndef KAB_EMBEDDED | 68 | #ifndef KAB_EMBEDDED |
69 | #include <ktrader.h> | 69 | #include <ktrader.h> |
70 | #else // KAB_EMBEDDED | 70 | #else // KAB_EMBEDDED |
71 | #include <mergewidget.h> | 71 | #include <mergewidget.h> |
72 | #include <distributionlistwidget.h> | 72 | #include <distributionlistwidget.h> |
73 | #endif // KAB_EMBEDDED | 73 | #endif // KAB_EMBEDDED |
74 | 74 | ||
75 | #include "addresseewidget.h" | 75 | #include "addresseewidget.h" |
76 | #include "extensionconfigdialog.h" | 76 | #include "extensionconfigdialog.h" |
77 | #include "extensionwidget.h" | 77 | #include "extensionwidget.h" |
78 | */ | 78 | */ |
79 | 79 | ||
80 | #include "qapplication.h" | 80 | #include "qapplication.h" |
81 | 81 | ||
82 | #include "kpimglobalprefs.h" | 82 | #include "kpimglobalprefs.h" |
83 | 83 | ||
84 | #include "kdepimconfigwidget.h" | 84 | #include "kdepimconfigwidget.h" |
85 | #include <kprefs.h> | 85 | #include <kprefs.h> |
86 | #include <kmessagebox.h> | 86 | #include <kmessagebox.h> |
87 | 87 | ||
88 | 88 | ||
89 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 89 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
90 | : KPrefsWidget(prefs, parent, name ) | 90 | : KPrefsWidget(prefs, parent, name ) |
91 | { | 91 | { |
92 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 92 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
93 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 93 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
94 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 94 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
95 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 95 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
96 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 96 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
97 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 97 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
98 | 98 | ||
99 | 99 | ||
100 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 100 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
101 | KDialog::spacingHint() ); | 101 | KDialog::spacingHint() ); |
102 | 102 | ||
103 | tabWidget = new QTabWidget( this ); | 103 | tabWidget = new QTabWidget( this ); |
104 | topLayout->addWidget( tabWidget ); | 104 | topLayout->addWidget( tabWidget ); |
105 | 105 | ||
106 | 106 | ||
107 | setupLocaleTab(); | 107 | setupLocaleTab(); |
108 | setupLocaleDateTab(); | 108 | setupLocaleDateTab(); |
109 | setupTimeZoneTab(); | 109 | setupTimeZoneTab(); |
110 | setupExternalAppTab(); | 110 | setupExternalAppTab(); |
111 | setupStoreTab(); | 111 | setupStoreTab(); |
112 | 112 | ||
113 | } | 113 | } |
114 | void KDEPIMConfigWidget::showTimeZoneTab() | 114 | void KDEPIMConfigWidget::showTimeZoneTab() |
115 | { | 115 | { |
116 | tabWidget->setCurrentPage ( 3 ) ; | 116 | tabWidget->setCurrentPage ( 3 ) ; |
117 | } | 117 | } |
118 | void KDEPIMConfigWidget::setupStoreTab() | 118 | void KDEPIMConfigWidget::setupStoreTab() |
119 | { | 119 | { |
120 | QVBox *colorPage = new QVBox( this ); | ||
121 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); | ||
122 | QWidget* cw = new QWidget( colorPage ); | ||
123 | KPrefsWidColor *holidayColor = | ||
124 | addWidColor(i18n("Alternate background"), | ||
125 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); | ||
126 | QHBoxLayout *topLayout = new QHBoxLayout(cw); | ||
127 | topLayout->addWidget(holidayColor->label()); | ||
128 | topLayout->addWidget( (QWidget* )holidayColor->button()); | ||
129 | |||
130 | |||
120 | QVBox *storePage = new QVBox( this ); | 131 | QVBox *storePage = new QVBox( this ); |
121 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); | 132 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); |
122 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 133 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
123 | mStoreUrl = new KURLRequester( storePage ); | 134 | mStoreUrl = new KURLRequester( storePage ); |
124 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 135 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
125 | #ifdef DESKTOP_VERSION | 136 | #ifdef DESKTOP_VERSION |
126 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | 137 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; |
127 | QFileInfo fi ( confFile ); | 138 | QFileInfo fi ( confFile ); |
128 | if ( fi.exists() ) { | 139 | if ( fi.exists() ) { |
129 | KConfig cfg ( confFile ); | 140 | KConfig cfg ( confFile ); |
130 | cfg.setGroup("Global"); | 141 | cfg.setGroup("Global"); |
131 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); | 142 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); |
132 | if ( localKdeDir != "x_x_x" ) { | 143 | if ( localKdeDir != "x_x_x" ) { |
133 | mStoreUrl->setURL( localKdeDir ); | 144 | mStoreUrl->setURL( localKdeDir ); |
134 | qDebug("Reading config from %s ", confFile.latin1()); | 145 | qDebug("Reading config from %s ", confFile.latin1()); |
135 | } | 146 | } |
136 | } | 147 | } |
137 | 148 | ||
138 | #endif | 149 | #endif |
139 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 150 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
140 | QHBox *bb = new QHBox( storePage ); | 151 | QHBox *bb = new QHBox( storePage ); |
141 | QPushButton * pb; | 152 | QPushButton * pb; |
142 | if ( QApplication::desktop()->width() < 640 ) | 153 | if ( QApplication::desktop()->width() < 640 ) |
143 | pb = new QPushButton ( i18n("Save"), bb ); | 154 | pb = new QPushButton ( i18n("Save"), bb ); |
144 | else | 155 | else |
145 | pb = new QPushButton ( i18n("Save settings"), bb ); | 156 | pb = new QPushButton ( i18n("Save settings"), bb ); |
146 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 157 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
147 | pb = new QPushButton ( i18n("Save standard"), bb ); | 158 | pb = new QPushButton ( i18n("Save standard"), bb ); |
148 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 159 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
149 | #ifdef DESKTOP_VERSION | 160 | #ifdef DESKTOP_VERSION |
150 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); | 161 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); |
151 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); | 162 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); |
152 | #endif | 163 | #endif |
153 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 164 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
154 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 165 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
155 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 166 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
156 | } | 167 | } |
157 | void KDEPIMConfigWidget::setLocalStore() | 168 | void KDEPIMConfigWidget::setLocalStore() |
158 | { | 169 | { |
159 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); | 170 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); |
160 | saveStoreSettings(); | 171 | saveStoreSettings(); |
161 | QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); | 172 | QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); |
162 | KMessageBox::information( this, message); | 173 | KMessageBox::information( this, message); |
163 | } | 174 | } |
164 | void KDEPIMConfigWidget::setStandardStore() | 175 | void KDEPIMConfigWidget::setStandardStore() |
165 | { | 176 | { |
166 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 177 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
167 | saveStoreSettings(); | 178 | saveStoreSettings(); |
168 | } | 179 | } |
169 | void KDEPIMConfigWidget::saveStoreSettings() | 180 | void KDEPIMConfigWidget::saveStoreSettings() |
170 | { | 181 | { |
171 | if ( !mStoreUrl->url().isEmpty() ) { | 182 | if ( !mStoreUrl->url().isEmpty() ) { |
172 | QString path = QDir::homeDirPath(); | 183 | QString path = QDir::homeDirPath(); |
173 | QString url = mStoreUrl->url(); | 184 | QString url = mStoreUrl->url(); |
174 | #ifdef DESKTOP_VERSION | 185 | #ifdef DESKTOP_VERSION |
175 | if ( url.startsWith( "LOCAL:" ) ) { | 186 | if ( url.startsWith( "LOCAL:" ) ) { |
176 | path = qApp->applicationDirPath () ; | 187 | path = qApp->applicationDirPath () ; |
177 | } | 188 | } |
178 | #endif | 189 | #endif |
179 | KConfig cfg ( path + "/.microkdehome" ); | 190 | KConfig cfg ( path + "/.microkdehome" ); |
180 | cfg.setGroup("Global"); | 191 | cfg.setGroup("Global"); |
181 | cfg.writeEntry( "MICROKDEHOME", url ); | 192 | cfg.writeEntry( "MICROKDEHOME", url ); |
182 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); | 193 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
183 | cfg.sync(); | 194 | cfg.sync(); |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index a09b278..873f0eb 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -1,211 +1,216 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kglobalsettings.h> | 35 | #include <kglobalsettings.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | 37 | ||
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #include "kpimglobalprefs.h" | 43 | #include "kpimglobalprefs.h" |
44 | 44 | ||
45 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; | 45 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; |
46 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; | 46 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; |
47 | 47 | ||
48 | 48 | ||
49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
50 | : KPrefs("microkdeglobalrc") | 50 | : KPrefs("microkdeglobalrc") |
51 | { | 51 | { |
52 | mLocaleDict = 0; | 52 | mLocaleDict = 0; |
53 | KPrefs::setCurrentGroup("Fonts"); | 53 | KPrefs::setCurrentGroup("Fonts"); |
54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); | 54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); |
55 | KPrefs::setCurrentGroup("Locale"); | 55 | KPrefs::setCurrentGroup("Locale"); |
56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
57 | addItemInt("PreferredTime",&mPreferredTime,0); | 57 | addItemInt("PreferredTime",&mPreferredTime,0); |
58 | addItemInt("PreferredDate",&mPreferredDate,0); | 58 | addItemInt("PreferredDate",&mPreferredDate,0); |
59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); | 60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); |
61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
62 | 62 | ||
63 | KPrefs::setCurrentGroup("Colors"); | ||
64 | addItemColor("AlternateBGcolor",&mAlternateColor,KGlobalSettings::alternateBackgroundColor()); | ||
65 | |||
66 | |||
63 | KPrefs::setCurrentGroup("Time & Date"); | 67 | KPrefs::setCurrentGroup("Time & Date"); |
64 | 68 | ||
65 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); | 69 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); |
66 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 70 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
67 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); | 71 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); |
68 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 72 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
69 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 73 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
70 | 74 | ||
71 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 75 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
72 | 76 | ||
73 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); | 77 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
74 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 78 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
75 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 79 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
76 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 80 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
77 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); | 81 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); |
78 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); | 82 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); |
79 | 83 | ||
80 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); | 84 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); |
81 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); | 85 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); |
82 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); | 86 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); |
83 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); | 87 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); |
84 | 88 | ||
85 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); | 89 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); |
86 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); | 90 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); |
87 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); | 91 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); |
88 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 92 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
89 | 93 | ||
90 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 94 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
91 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 95 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
92 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 96 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
93 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 97 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
94 | 98 | ||
95 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 99 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
96 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 100 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
97 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 101 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
98 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 102 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
99 | 103 | ||
100 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); | 104 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); |
101 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); | 105 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); |
102 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); | 106 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); |
103 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); | 107 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); |
104 | 108 | ||
105 | KPrefs::setCurrentGroup( "PhoneAccess" ); | 109 | KPrefs::setCurrentGroup( "PhoneAccess" ); |
106 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | 110 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); |
107 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | 111 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); |
108 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | 112 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |
109 | 113 | ||
110 | } | 114 | } |
111 | 115 | ||
112 | void KPimGlobalPrefs::setGlobalConfig() | 116 | void KPimGlobalPrefs::setGlobalConfig() |
113 | { | 117 | { |
114 | if ( mLocaleDict == 0 ) { | 118 | if ( mLocaleDict == 0 ) { |
115 | QString fileName ; | 119 | QString fileName ; |
116 | QString name = KGlobal::getAppName() +"/"; | 120 | QString name = KGlobal::getAppName() +"/"; |
117 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
118 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; | 122 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; |
119 | #else | 123 | #else |
120 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; | 124 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; |
121 | #endif | 125 | #endif |
122 | mLocaleDict = 0; | 126 | mLocaleDict = 0; |
123 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | 127 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { |
124 | 128 | ||
125 | if ( mPreferredLanguage == 1 ) | 129 | if ( mPreferredLanguage == 1 ) |
126 | fileName = fileName+"germantranslation.txt"; | 130 | fileName = fileName+"germantranslation.txt"; |
127 | else if ( mPreferredLanguage == 4 ) | 131 | else if ( mPreferredLanguage == 4 ) |
128 | fileName = fileName+"usertranslation.txt"; | 132 | fileName = fileName+"usertranslation.txt"; |
129 | else if ( mPreferredLanguage == 2 ) | 133 | else if ( mPreferredLanguage == 2 ) |
130 | fileName = fileName+"frenchtranslation.txt"; | 134 | fileName = fileName+"frenchtranslation.txt"; |
131 | else if ( mPreferredLanguage == 3 ) | 135 | else if ( mPreferredLanguage == 3 ) |
132 | fileName = fileName+"italiantranslation.txt"; | 136 | fileName = fileName+"italiantranslation.txt"; |
133 | QFile file( fileName ); | 137 | QFile file( fileName ); |
134 | if (file.open( IO_ReadOnly ) ) { | 138 | if (file.open( IO_ReadOnly ) ) { |
135 | QTextStream ts( &file ); | 139 | QTextStream ts( &file ); |
136 | ts.setEncoding( QTextStream::Latin1 ); | 140 | ts.setEncoding( QTextStream::Latin1 ); |
137 | //ts.setCodec( QTextCodec::latin1 ); | 141 | //ts.setCodec( QTextCodec::latin1 ); |
138 | QString text = ts.read(); | 142 | QString text = ts.read(); |
139 | file.close(); | 143 | file.close(); |
140 | text.replace( QRegExp("\\\\n"), "\n" ); | 144 | text.replace( QRegExp("\\\\n"), "\n" ); |
141 | QString line; | 145 | QString line; |
142 | QString we; | 146 | QString we; |
143 | QString wt; | 147 | QString wt; |
144 | int br = 0; | 148 | int br = 0; |
145 | int nbr; | 149 | int nbr; |
146 | nbr = text.find ( "},", br ); | 150 | nbr = text.find ( "},", br ); |
147 | line = text.mid( br, nbr - br ); | 151 | line = text.mid( br, nbr - br ); |
148 | br = nbr+1; | 152 | br = nbr+1; |
149 | int se, ee, st, et; | 153 | int se, ee, st, et; |
150 | mLocaleDict = new QDict<QString>; | 154 | mLocaleDict = new QDict<QString>; |
151 | mLocaleDict->setAutoDelete( true ); | 155 | mLocaleDict->setAutoDelete( true ); |
152 | QString end = "{ \"\",\"\" }"; | 156 | QString end = "{ \"\",\"\" }"; |
153 | while ( (line != end) && (br > 1) ) { | 157 | while ( (line != end) && (br > 1) ) { |
154 | //qDebug("%d *%s* ", br, line.latin1()); | 158 | //qDebug("%d *%s* ", br, line.latin1()); |
155 | se = line.find("\"")+1; | 159 | se = line.find("\"")+1; |
156 | et = line.findRev("\"",-1); | 160 | et = line.findRev("\"",-1); |
157 | ee = line.find("\",\""); | 161 | ee = line.find("\",\""); |
158 | st = ee+3; | 162 | st = ee+3; |
159 | we = line.mid( se, ee-se ); | 163 | we = line.mid( se, ee-se ); |
160 | if ( mPreferredLanguage == 4 ) | 164 | if ( mPreferredLanguage == 4 ) |
161 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); | 165 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); |
162 | else | 166 | else |
163 | wt = line.mid( st, et-st ); | 167 | wt = line.mid( st, et-st ); |
164 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | 168 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); |
165 | mLocaleDict->insert( we, new QString (wt) ); | 169 | mLocaleDict->insert( we, new QString (wt) ); |
166 | nbr = text.find ( "}", br ); | 170 | nbr = text.find ( "}", br ); |
167 | line = text.mid( br, nbr - br ); | 171 | line = text.mid( br, nbr - br ); |
168 | br = nbr+1; | 172 | br = nbr+1; |
169 | } | 173 | } |
170 | //qDebug("end *%s* ", end.latin1()); | 174 | //qDebug("end *%s* ", end.latin1()); |
171 | 175 | ||
172 | setLocaleDict( mLocaleDict ); | 176 | setLocaleDict( mLocaleDict ); |
173 | } else { | 177 | } else { |
174 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | 178 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); |
175 | } | 179 | } |
176 | } | 180 | } |
177 | } | 181 | } |
178 | 182 | ||
179 | KGlobal::locale()->setHore24Format( !mPreferredTime ); | 183 | KGlobal::locale()->setHore24Format( !mPreferredTime ); |
180 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); | 184 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); |
181 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); | 185 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); |
182 | KGlobal::locale()->setLanguage( mPreferredLanguage ); | 186 | KGlobal::locale()->setLanguage( mPreferredLanguage ); |
183 | QString dummy = mUserDateFormatLong; | 187 | QString dummy = mUserDateFormatLong; |
184 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 188 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
185 | dummy = mUserDateFormatShort; | 189 | dummy = mUserDateFormatShort; |
186 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 190 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
187 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, | 191 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, |
188 | mDaylightsavingStart, | 192 | mDaylightsavingStart, |
189 | mDaylightsavingEnd ); | 193 | mDaylightsavingEnd ); |
190 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); | 194 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); |
195 | KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); | ||
191 | 196 | ||
192 | } | 197 | } |
193 | KPimGlobalPrefs::~KPimGlobalPrefs() | 198 | KPimGlobalPrefs::~KPimGlobalPrefs() |
194 | { | 199 | { |
195 | if (sInstance == this) | 200 | if (sInstance == this) |
196 | sInstance = staticDeleterGP.setObject(0); | 201 | sInstance = staticDeleterGP.setObject(0); |
197 | else | 202 | else |
198 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); | 203 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); |
199 | if ( mLocaleDict ) | 204 | if ( mLocaleDict ) |
200 | delete mLocaleDict; | 205 | delete mLocaleDict; |
201 | } | 206 | } |
202 | 207 | ||
203 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 208 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
204 | { | 209 | { |
205 | if ( !sInstance ) { | 210 | if ( !sInstance ) { |
206 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); | 211 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); |
207 | sInstance->readConfig(); | 212 | sInstance->readConfig(); |
208 | } | 213 | } |
209 | 214 | ||
210 | return sInstance; | 215 | return sInstance; |
211 | } | 216 | } |
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h index bf17338..36cc25a 100644 --- a/libkdepim/kpimglobalprefs.h +++ b/libkdepim/kpimglobalprefs.h | |||
@@ -41,104 +41,105 @@ class KPimGlobalPrefs : public KPrefs | |||
41 | void setGlobalConfig(); | 41 | void setGlobalConfig(); |
42 | static KPimGlobalPrefs *instance(); | 42 | static KPimGlobalPrefs *instance(); |
43 | 43 | ||
44 | 44 | ||
45 | virtual ~KPimGlobalPrefs(); | 45 | virtual ~KPimGlobalPrefs(); |
46 | 46 | ||
47 | 47 | ||
48 | enum EMailClients { | 48 | enum EMailClients { |
49 | NONE_EMC = 0, | 49 | NONE_EMC = 0, |
50 | OTHER_EMC = 1, | 50 | OTHER_EMC = 1, |
51 | OMPI_EMC = 2, | 51 | OMPI_EMC = 2, |
52 | QTOPIA_EMC = 3, | 52 | QTOPIA_EMC = 3, |
53 | OPIE_EMC = 4, | 53 | OPIE_EMC = 4, |
54 | OPIE_MAILIT_EMC = 5 | 54 | OPIE_MAILIT_EMC = 5 |
55 | }; | 55 | }; |
56 | 56 | ||
57 | enum PhoneClients { | 57 | enum PhoneClients { |
58 | NONE_PHC = 0, | 58 | NONE_PHC = 0, |
59 | OTHER_PHC = 1, | 59 | OTHER_PHC = 1, |
60 | KPPI_PHC = 2 | 60 | KPPI_PHC = 2 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | enum FaxClients { | 63 | enum FaxClients { |
64 | NONE_FAC = 0, | 64 | NONE_FAC = 0, |
65 | OTHER_FAC = 1 | 65 | OTHER_FAC = 1 |
66 | }; | 66 | }; |
67 | 67 | ||
68 | enum SMSClients { | 68 | enum SMSClients { |
69 | NONE_SMC = 0, | 69 | NONE_SMC = 0, |
70 | OTHER_SMC = 1 | 70 | OTHER_SMC = 1 |
71 | }; | 71 | }; |
72 | 72 | ||
73 | enum PagerClients { | 73 | enum PagerClients { |
74 | NONE_PAC = 0, | 74 | NONE_PAC = 0, |
75 | OTHER_PAC = 1 | 75 | OTHER_PAC = 1 |
76 | }; | 76 | }; |
77 | 77 | ||
78 | enum SIPClients { | 78 | enum SIPClients { |
79 | NONE_SIC = 0, | 79 | NONE_SIC = 0, |
80 | OTHER_SIC = 1, | 80 | OTHER_SIC = 1, |
81 | KPPI_SIC = 2 | 81 | KPPI_SIC = 2 |
82 | }; | 82 | }; |
83 | 83 | ||
84 | private: | 84 | private: |
85 | KPimGlobalPrefs( const QString &name = QString::null ); | 85 | KPimGlobalPrefs( const QString &name = QString::null ); |
86 | 86 | ||
87 | static KPimGlobalPrefs *sInstance; | 87 | static KPimGlobalPrefs *sInstance; |
88 | QDict<QString> *mLocaleDict; | 88 | QDict<QString> *mLocaleDict; |
89 | 89 | ||
90 | 90 | ||
91 | public: | 91 | public: |
92 | //US I copied the following "locale" settings from KOPrefs | 92 | //US I copied the following "locale" settings from KOPrefs |
93 | int mPreferredDate; | 93 | int mPreferredDate; |
94 | QString mUserDateFormatLong; | 94 | QString mUserDateFormatLong; |
95 | QString mUserDateFormatShort; | 95 | QString mUserDateFormatShort; |
96 | int mPreferredLanguage; | 96 | int mPreferredLanguage; |
97 | int mPreferredTime; | 97 | int mPreferredTime; |
98 | bool mWeekStartsOnSunday; | 98 | bool mWeekStartsOnSunday; |
99 | QString mTimeZoneId; | 99 | QString mTimeZoneId; |
100 | bool mUseDaylightsaving; | 100 | bool mUseDaylightsaving; |
101 | int mDaylightsavingStart; | 101 | int mDaylightsavingStart; |
102 | int mDaylightsavingEnd; | 102 | int mDaylightsavingEnd; |
103 | bool mTimeZoneAdd30min; | 103 | bool mTimeZoneAdd30min; |
104 | QFont mApplicationFont; | 104 | QFont mApplicationFont; |
105 | QColor mAlternateColor; | ||
105 | 106 | ||
106 | int mEmailClient; | 107 | int mEmailClient; |
107 | QString mEmailOtherChannel; | 108 | QString mEmailOtherChannel; |
108 | QString mEmailOtherMessage; | 109 | QString mEmailOtherMessage; |
109 | QString mEmailOtherMessageParameters; | 110 | QString mEmailOtherMessageParameters; |
110 | QString mEmailOtherMessage2; | 111 | QString mEmailOtherMessage2; |
111 | QString mEmailOtherMessageParameters2; | 112 | QString mEmailOtherMessageParameters2; |
112 | 113 | ||
113 | int mPhoneClient; | 114 | int mPhoneClient; |
114 | QString mPhoneOtherChannel; | 115 | QString mPhoneOtherChannel; |
115 | QString mPhoneOtherMessage; | 116 | QString mPhoneOtherMessage; |
116 | QString mPhoneOtherMessageParameters; | 117 | QString mPhoneOtherMessageParameters; |
117 | 118 | ||
118 | int mFaxClient; | 119 | int mFaxClient; |
119 | QString mFaxOtherChannel; | 120 | QString mFaxOtherChannel; |
120 | QString mFaxOtherMessage; | 121 | QString mFaxOtherMessage; |
121 | QString mFaxOtherMessageParameters; | 122 | QString mFaxOtherMessageParameters; |
122 | 123 | ||
123 | int mSMSClient; | 124 | int mSMSClient; |
124 | QString mSMSOtherChannel; | 125 | QString mSMSOtherChannel; |
125 | QString mSMSOtherMessage; | 126 | QString mSMSOtherMessage; |
126 | QString mSMSOtherMessageParameters; | 127 | QString mSMSOtherMessageParameters; |
127 | 128 | ||
128 | int mPagerClient; | 129 | int mPagerClient; |
129 | QString mPagerOtherChannel; | 130 | QString mPagerOtherChannel; |
130 | QString mPagerOtherMessage; | 131 | QString mPagerOtherMessage; |
131 | QString mPagerOtherMessageParameters; | 132 | QString mPagerOtherMessageParameters; |
132 | 133 | ||
133 | int mSipClient; | 134 | int mSipClient; |
134 | QString mSipOtherChannel; | 135 | QString mSipOtherChannel; |
135 | QString mSipOtherMessage; | 136 | QString mSipOtherMessage; |
136 | QString mSipOtherMessageParameters; | 137 | QString mSipOtherMessageParameters; |
137 | 138 | ||
138 | QString mEx2PhoneDevice; | 139 | QString mEx2PhoneDevice; |
139 | QString mEx2PhoneConnection; | 140 | QString mEx2PhoneConnection; |
140 | QString mEx2PhoneModel; | 141 | QString mEx2PhoneModel; |
141 | 142 | ||
142 | }; | 143 | }; |
143 | 144 | ||
144 | #endif | 145 | #endif |