-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 28 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 6 | ||||
-rw-r--r-- | libkdepim/kpimprefs.cpp | 3 | ||||
-rw-r--r-- | libkdepim/kpimprefs.h | 1 |
4 files changed, 32 insertions, 6 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index fbfbc45..93538ec 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,947 +1,963 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KdePim/Pi. | 2 | This file is part of KdePim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
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 <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qgroupbox.h> | 34 | #include <qgroupbox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qbuttongroup.h> | 37 | #include <qbuttongroup.h> |
38 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qvbox.h> | 40 | #include <qvbox.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | 44 | ||
45 | #include <kdialog.h> | 45 | #include <kdialog.h> |
46 | #include <kprefsdialog.h> | 46 | #include <kprefsdialog.h> |
47 | #include <klocale.h> | 47 | #include <klocale.h> |
48 | #include <kglobalsettings.h> | 48 | #include <kglobalsettings.h> |
49 | #include <kdateedit.h> | 49 | #include <kdateedit.h> |
50 | #include <kglobal.h> | 50 | #include <kglobal.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | 52 | ||
53 | /*US | 53 | /*US |
54 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
55 | #include <qframe.h> | 55 | #include <qframe.h> |
56 | #include <qpushbutton.h> | 56 | #include <qpushbutton.h> |
57 | #include <qcombobox.h> | 57 | #include <qcombobox.h> |
58 | #include <qlineedit.h> | 58 | #include <qlineedit.h> |
59 | #include <qlabel.h> | 59 | #include <qlabel.h> |
60 | #include <qfile.h> | 60 | #include <qfile.h> |
61 | 61 | ||
62 | #include <kconfig.h> | 62 | #include <kconfig.h> |
63 | #include <kdebug.h> | 63 | #include <kdebug.h> |
64 | #include <kdialog.h> | 64 | #include <kdialog.h> |
65 | #include <klistview.h> | 65 | #include <klistview.h> |
66 | #include <klocale.h> | 66 | #include <klocale.h> |
67 | #include <kglobal.h> | 67 | #include <kglobal.h> |
68 | #include <kmessagebox.h> | 68 | #include <kmessagebox.h> |
69 | #include <kstandarddirs.h> | 69 | #include <kstandarddirs.h> |
70 | 70 | ||
71 | #ifndef KAB_EMBEDDED | 71 | #ifndef KAB_EMBEDDED |
72 | #include <ktrader.h> | 72 | #include <ktrader.h> |
73 | #else // KAB_EMBEDDED | 73 | #else // KAB_EMBEDDED |
74 | #include <mergewidget.h> | 74 | #include <mergewidget.h> |
75 | #include <distributionlistwidget.h> | 75 | #include <distributionlistwidget.h> |
76 | #endif // KAB_EMBEDDED | 76 | #endif // KAB_EMBEDDED |
77 | 77 | ||
78 | #include "addresseewidget.h" | 78 | #include "addresseewidget.h" |
79 | #include "extensionconfigdialog.h" | 79 | #include "extensionconfigdialog.h" |
80 | #include "extensionwidget.h" | 80 | #include "extensionwidget.h" |
81 | */ | 81 | */ |
82 | 82 | ||
83 | #include "qapplication.h" | 83 | #include "qapplication.h" |
84 | 84 | ||
85 | #include "kpimglobalprefs.h" | 85 | #include "kpimglobalprefs.h" |
86 | 86 | ||
87 | #include "kdepimconfigwidget.h" | 87 | #include "kdepimconfigwidget.h" |
88 | #include <kprefs.h> | 88 | #include <kprefs.h> |
89 | #include <kmessagebox.h> | 89 | #include <kmessagebox.h> |
90 | 90 | ||
91 | 91 | ||
92 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 92 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
93 | : KPrefsWidget(prefs, parent, name ) | 93 | : KPrefsWidget(prefs, parent, name ) |
94 | { | 94 | { |
95 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 95 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
96 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 96 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
97 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 97 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
98 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 98 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
99 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 99 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
100 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 100 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
101 | 101 | ||
102 | 102 | ||
103 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 103 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
104 | KDialog::spacingHint() ); | 104 | KDialog::spacingHint() ); |
105 | 105 | ||
106 | tabWidget = new QTabWidget( this ); | 106 | tabWidget = new QTabWidget( this ); |
107 | topLayout->addWidget( tabWidget ); | 107 | topLayout->addWidget( tabWidget ); |
108 | 108 | ||
109 | 109 | ||
110 | setupLocaleTab(); | 110 | setupLocaleTab(); |
111 | setupLocaleDateTab(); | 111 | setupLocaleDateTab(); |
112 | setupTimeZoneTab(); | 112 | setupTimeZoneTab(); |
113 | setupExternalAppTab(); | 113 | setupExternalAppTab(); |
114 | setupStoreTab(); | 114 | setupStoreTab(); |
115 | setupBackupTab(); | 115 | setupBackupTab(); |
116 | } | 116 | } |
117 | void KDEPIMConfigWidget::showTimeZoneTab() | 117 | void KDEPIMConfigWidget::showTimeZoneTab() |
118 | { | 118 | { |
119 | tabWidget->setCurrentPage ( 3 ) ; | 119 | tabWidget->setCurrentPage ( 3 ) ; |
120 | } | 120 | } |
121 | void KDEPIMConfigWidget::setupBackupTab() | 121 | void KDEPIMConfigWidget::setupBackupTab() |
122 | { | 122 | { |
123 | QVBox *colorPage = new QVBox( this ); | 123 | QVBox *colorPage = new QVBox( this ); |
124 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); | 124 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); |
125 | QWidget* topFrame = new QWidget( colorPage ); | 125 | QWidget* topFrame = new QWidget( colorPage ); |
126 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 126 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
127 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), | 127 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), |
128 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); | 128 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); |
129 | topLayout->addWidget((QWidget*)sb->checkBox()); | 129 | topLayout->addWidget((QWidget*)sb->checkBox()); |
130 | QWidget* bupFrame = new QWidget( topFrame ); | 130 | QWidget* bupFrame = new QWidget( topFrame ); |
131 | topLayout->addWidget((bupFrame)); | 131 | topLayout->addWidget((bupFrame)); |
132 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); | 132 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); |
133 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); | 133 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); |
134 | sb = addWidBool(i18n("Use standard backup dir"), | 134 | sb = addWidBool(i18n("Use standard backup dir"), |
135 | &(KPimGlobalPrefs::instance()->mBackupEnabled),bupFrame); | 135 | &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); |
136 | bupLayout->addWidget((QWidget*)sb->checkBox()); | 136 | bupLayout->addWidget((QWidget*)sb->checkBox()); |
137 | mBackupUrl = new KURLRequester( bupFrame ); | 137 | mBackupUrl = new KURLRequester( bupFrame ); |
138 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | 138 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); |
139 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); | 139 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); |
140 | bupLayout->addWidget( mBackupUrl ); | 140 | bupLayout->addWidget( mBackupUrl ); |
141 | 141 | ||
142 | 142 | mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); | |
143 | bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); | ||
143 | QHBox *dummy = new QHBox(bupFrame); | 144 | QHBox *dummy = new QHBox(bupFrame); |
144 | new QLabel(i18n("Number of Backups:"),dummy); | 145 | new QLabel(i18n("Number of Backups:"),dummy); |
145 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); | 146 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); |
146 | new QLabel(i18n(" "),dummy); | 147 | new QLabel(i18n(" "),dummy); |
147 | bupLayout->addWidget( dummy ); | 148 | bupLayout->addWidget( dummy ); |
148 | 149 | ||
149 | dummy = new QHBox(bupFrame); | 150 | dummy = new QHBox(bupFrame); |
150 | new QLabel(i18n("Make backup every "),dummy); | 151 | new QLabel(i18n("Make backup every "),dummy); |
151 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); | 152 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); |
152 | new QLabel(i18n(" days"),dummy); | 153 | new QLabel(i18n(" days"),dummy); |
153 | new QLabel(i18n(" "),dummy); | 154 | new QLabel(i18n(" "),dummy); |
154 | bupLayout->addWidget( dummy ); | 155 | bupLayout->addWidget( dummy ); |
156 | QString localKdeDir; | ||
157 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); | ||
158 | if ( ! localKdeDir.isEmpty() ) { | ||
159 | sb->checkBox()->setEnabled( false ); | ||
160 | sb->checkBox()->setChecked( true ); | ||
161 | mBackupUrl->setEnabled( false ); | ||
162 | KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; | ||
163 | } | ||
155 | 164 | ||
156 | } | 165 | } |
157 | void KDEPIMConfigWidget::setupStoreTab() | 166 | void KDEPIMConfigWidget::setupStoreTab() |
158 | { | 167 | { |
159 | QVBox *colorPage = new QVBox( this ); | 168 | QVBox *colorPage = new QVBox( this ); |
160 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); | 169 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); |
161 | QWidget* cw = new QWidget( colorPage ); | 170 | QWidget* cw = new QWidget( colorPage ); |
162 | KPrefsWidColor *holidayColor = | 171 | KPrefsWidColor *holidayColor = |
163 | addWidColor(i18n("Alternating background of list views"), | 172 | addWidColor(i18n("Alternating background of list views"), |
164 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); | 173 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); |
165 | QHBoxLayout *topLayout = new QHBoxLayout(cw); | 174 | QHBoxLayout *topLayout = new QHBoxLayout(cw); |
166 | topLayout->addWidget(holidayColor->label()); | 175 | topLayout->addWidget(holidayColor->label()); |
167 | topLayout->addWidget( (QWidget* )holidayColor->button()); | 176 | topLayout->addWidget( (QWidget* )holidayColor->button()); |
168 | 177 | ||
169 | 178 | ||
170 | QVBox *storePage = new QVBox( this ); | 179 | QVBox *storePage = new QVBox( this ); |
171 | 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 ); | 180 | 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 ); |
172 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 181 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
173 | mStoreUrl = new KURLRequester( storePage ); | 182 | mStoreUrl = new KURLRequester( storePage ); |
174 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 183 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
175 | #ifdef DESKTOP_VERSION | 184 | #ifdef DESKTOP_VERSION |
176 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | 185 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; |
177 | QFileInfo fi ( confFile ); | 186 | QFileInfo fi ( confFile ); |
178 | if ( fi.exists() ) { | 187 | if ( fi.exists() ) { |
179 | KConfig cfg ( confFile ); | 188 | KConfig cfg ( confFile ); |
180 | cfg.setGroup("Global"); | 189 | cfg.setGroup("Global"); |
181 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); | 190 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); |
182 | if ( localKdeDir != "x_x_x" ) { | 191 | if ( localKdeDir != "x_x_x" ) { |
183 | mStoreUrl->setURL( localKdeDir ); | 192 | mStoreUrl->setURL( localKdeDir ); |
184 | qDebug("Reading config from %s ", confFile.latin1()); | 193 | qDebug("Reading config from %s ", confFile.latin1()); |
185 | } | 194 | } |
186 | } | 195 | } |
187 | 196 | ||
188 | #endif | 197 | #endif |
189 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 198 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
190 | QHBox *bb = new QHBox( storePage ); | 199 | QHBox *bb = new QHBox( storePage ); |
191 | QPushButton * pb; | 200 | QPushButton * pb; |
192 | if ( QApplication::desktop()->width() < 640 ) | 201 | if ( QApplication::desktop()->width() < 640 ) |
193 | pb = new QPushButton ( i18n("Save"), bb ); | 202 | pb = new QPushButton ( i18n("Save"), bb ); |
194 | else | 203 | else |
195 | pb = new QPushButton ( i18n("Save settings"), bb ); | 204 | pb = new QPushButton ( i18n("Save settings"), bb ); |
196 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 205 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
197 | pb = new QPushButton ( i18n("Save standard"), bb ); | 206 | pb = new QPushButton ( i18n("Save standard"), bb ); |
198 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 207 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
199 | #ifdef DESKTOP_VERSION | 208 | #ifdef DESKTOP_VERSION |
200 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); | 209 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); |
201 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); | 210 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); |
202 | #endif | 211 | #endif |
203 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 212 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
204 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 213 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
205 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 214 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
206 | } | 215 | } |
207 | void KDEPIMConfigWidget::setLocalStore() | 216 | void KDEPIMConfigWidget::setLocalStore() |
208 | { | 217 | { |
209 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); | 218 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); |
210 | saveStoreSettings(); | 219 | saveStoreSettings(); |
211 | 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."); | 220 | 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."); |
212 | KMessageBox::information( this, message); | 221 | KMessageBox::information( this, message); |
213 | } | 222 | } |
214 | void KDEPIMConfigWidget::setStandardStore() | 223 | void KDEPIMConfigWidget::setStandardStore() |
215 | { | 224 | { |
216 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 225 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
217 | saveStoreSettings(); | 226 | saveStoreSettings(); |
218 | } | 227 | } |
219 | void KDEPIMConfigWidget::saveStoreSettings() | 228 | void KDEPIMConfigWidget::saveStoreSettings() |
220 | { | 229 | { |
221 | if ( !mStoreUrl->url().isEmpty() ) { | 230 | if ( !mStoreUrl->url().isEmpty() ) { |
222 | QString path = QDir::homeDirPath(); | 231 | QString path = QDir::homeDirPath(); |
223 | QString url = mStoreUrl->url(); | 232 | QString url = mStoreUrl->url(); |
224 | #ifdef DESKTOP_VERSION | 233 | #ifdef DESKTOP_VERSION |
225 | if ( url.startsWith( "LOCAL:" ) ) { | 234 | if ( url.startsWith( "LOCAL:" ) ) { |
226 | path = qApp->applicationDirPath () ; | 235 | path = qApp->applicationDirPath () ; |
227 | } | 236 | } |
228 | #endif | 237 | #endif |
229 | KConfig cfg ( path + "/.microkdehome" ); | 238 | KConfig cfg ( path + "/.microkdehome" ); |
230 | cfg.setGroup("Global"); | 239 | cfg.setGroup("Global"); |
231 | cfg.writeEntry( "MICROKDEHOME", url ); | 240 | cfg.writeEntry( "MICROKDEHOME", url ); |
232 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); | 241 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
233 | cfg.sync(); | 242 | cfg.sync(); |
234 | } else { | 243 | } else { |
235 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 244 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
236 | saveStoreSettings(); | 245 | saveStoreSettings(); |
237 | } | 246 | } |
238 | } | 247 | } |
239 | void KDEPIMConfigWidget::setupExternalAppTab() | 248 | void KDEPIMConfigWidget::setupExternalAppTab() |
240 | { | 249 | { |
241 | QWidget *externalAppsPage = new QWidget( this ); | 250 | QWidget *externalAppsPage = new QWidget( this ); |
242 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 251 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
243 | KDialog::spacingHintSmall() ); | 252 | KDialog::spacingHintSmall() ); |
244 | 253 | ||
245 | mExternalApps = new QComboBox( externalAppsPage ); | 254 | mExternalApps = new QComboBox( externalAppsPage ); |
246 | 255 | ||
247 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 256 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
248 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 257 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
249 | mExternalApps->insertItem( it.data(), it.key() ); | 258 | mExternalApps->insertItem( it.data(), it.key() ); |
250 | 259 | ||
251 | layout->addWidget( mExternalApps ); | 260 | layout->addWidget( mExternalApps ); |
252 | 261 | ||
253 | connect( mExternalApps, SIGNAL( activated( int ) ), | 262 | connect( mExternalApps, SIGNAL( activated( int ) ), |
254 | this, SLOT (externalapp_changed( int ) ) ); | 263 | this, SLOT (externalapp_changed( int ) ) ); |
255 | 264 | ||
256 | 265 | ||
257 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 266 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
258 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 267 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
259 | mExternalAppGroupBox->layout()->setMargin(4); | 268 | mExternalAppGroupBox->layout()->setMargin(4); |
260 | 269 | ||
261 | mClient = new QComboBox( mExternalAppGroupBox ); | 270 | mClient = new QComboBox( mExternalAppGroupBox ); |
262 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 271 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
263 | 272 | ||
264 | connect( mClient, SIGNAL( activated( int ) ), | 273 | connect( mClient, SIGNAL( activated( int ) ), |
265 | this, SLOT (client_changed( int ) ) ); | 274 | this, SLOT (client_changed( int ) ) ); |
266 | 275 | ||
267 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 276 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
268 | boxLayout->addWidget( lab, 1, 0 ); | 277 | boxLayout->addWidget( lab, 1, 0 ); |
269 | mChannel = new QLineEdit(mExternalAppGroupBox); | 278 | mChannel = new QLineEdit(mExternalAppGroupBox); |
270 | mChannel->setReadOnly(true); | 279 | mChannel->setReadOnly(true); |
271 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 280 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
272 | 281 | ||
273 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 282 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
274 | boxLayout->addWidget( lab, 3, 0 ); | 283 | boxLayout->addWidget( lab, 3, 0 ); |
275 | mMessage = new QLineEdit(mExternalAppGroupBox); | 284 | mMessage = new QLineEdit(mExternalAppGroupBox); |
276 | mMessage->setReadOnly(true); | 285 | mMessage->setReadOnly(true); |
277 | boxLayout->addWidget( mMessage , 4, 0); | 286 | boxLayout->addWidget( mMessage , 4, 0); |
278 | 287 | ||
279 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 288 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
280 | boxLayout->addWidget( lab, 3, 1 ); | 289 | boxLayout->addWidget( lab, 3, 1 ); |
281 | mParameters = new QLineEdit(mExternalAppGroupBox); | 290 | mParameters = new QLineEdit(mExternalAppGroupBox); |
282 | mParameters->setReadOnly(true); | 291 | mParameters->setReadOnly(true); |
283 | boxLayout->addWidget( mParameters, 4, 1 ); | 292 | boxLayout->addWidget( mParameters, 4, 1 ); |
284 | 293 | ||
285 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 294 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
286 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 295 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
287 | 296 | ||
288 | 297 | ||
289 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 298 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
290 | boxLayout->addWidget( lab, 6, 0 ); | 299 | boxLayout->addWidget( lab, 6, 0 ); |
291 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 300 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
292 | mMessage2->setReadOnly(true); | 301 | mMessage2->setReadOnly(true); |
293 | boxLayout->addWidget( mMessage2 , 7, 0); | 302 | boxLayout->addWidget( mMessage2 , 7, 0); |
294 | 303 | ||
295 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 304 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
296 | boxLayout->addWidget( lab, 6, 1 ); | 305 | boxLayout->addWidget( lab, 6, 1 ); |
297 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 306 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
298 | mParameters2->setReadOnly(true); | 307 | mParameters2->setReadOnly(true); |
299 | boxLayout->addWidget( mParameters2, 7, 1 ); | 308 | boxLayout->addWidget( mParameters2, 7, 1 ); |
300 | 309 | ||
301 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 310 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
302 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 311 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
303 | 312 | ||
304 | 313 | ||
305 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 314 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
306 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 315 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
307 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 316 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
308 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 317 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
309 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 318 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
310 | 319 | ||
311 | 320 | ||
312 | layout->addWidget( mExternalAppGroupBox ); | 321 | layout->addWidget( mExternalAppGroupBox ); |
313 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 322 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
314 | 323 | ||
315 | } | 324 | } |
316 | 325 | ||
317 | 326 | ||
318 | void KDEPIMConfigWidget::setupLocaleDateTab() | 327 | void KDEPIMConfigWidget::setupLocaleDateTab() |
319 | { | 328 | { |
320 | QWidget *topFrame = new QWidget( this ); | 329 | QWidget *topFrame = new QWidget( this ); |
321 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | 330 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); |
322 | 331 | ||
323 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 332 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
324 | topLayout->setMargin(KDialog::marginHintSmall()); | 333 | topLayout->setMargin(KDialog::marginHintSmall()); |
325 | int iii = 0; | 334 | int iii = 0; |
326 | 335 | ||
327 | 336 | ||
328 | KPrefsWidRadios *syncPrefsGroup = | 337 | KPrefsWidRadios *syncPrefsGroup = |
329 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | 338 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); |
330 | QString format; | 339 | QString format; |
331 | if ( QApplication::desktop()->width() < 480 ) | 340 | if ( QApplication::desktop()->width() < 480 ) |
332 | format = "(%d.%m.%Y)"; | 341 | format = "(%d.%m.%Y)"; |
333 | else | 342 | else |
334 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 343 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
335 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 344 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
336 | if ( QApplication::desktop()->width() < 480 ) | 345 | if ( QApplication::desktop()->width() < 480 ) |
337 | format = "(%m.%d.%Y)"; | 346 | format = "(%m.%d.%Y)"; |
338 | else | 347 | else |
339 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 348 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
340 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 349 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
341 | if ( QApplication::desktop()->width() < 480 ) | 350 | if ( QApplication::desktop()->width() < 480 ) |
342 | format = "(%Y-%m-%d)"; | 351 | format = "(%Y-%m-%d)"; |
343 | else | 352 | else |
344 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 353 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
345 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 354 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
346 | syncPrefsGroup->addRadio(i18n("User defined")); | 355 | syncPrefsGroup->addRadio(i18n("User defined")); |
347 | if ( QApplication::desktop()->width() < 480 ) { | 356 | if ( QApplication::desktop()->width() < 480 ) { |
348 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 357 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
349 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 358 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
350 | } | 359 | } |
351 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 360 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
352 | ++iii; | 361 | ++iii; |
353 | ++iii; | 362 | ++iii; |
354 | QLabel * lab; | 363 | QLabel * lab; |
355 | mUserDateFormatLong = new QLineEdit(topFrame); | 364 | mUserDateFormatLong = new QLineEdit(topFrame); |
356 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 365 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
357 | topLayout->addWidget(lab ,iii,0); | 366 | topLayout->addWidget(lab ,iii,0); |
358 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 367 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
359 | ++iii; | 368 | ++iii; |
360 | mUserDateFormatShort = new QLineEdit(topFrame); | 369 | mUserDateFormatShort = new QLineEdit(topFrame); |
361 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 370 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
362 | topLayout->addWidget(lab ,iii,0); | 371 | topLayout->addWidget(lab ,iii,0); |
363 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 372 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
364 | ++iii; | 373 | ++iii; |
365 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 374 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
366 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 375 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
367 | ++iii; | 376 | ++iii; |
368 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 377 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
369 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 378 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
370 | ++iii; | 379 | ++iii; |
371 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 380 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
372 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 381 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
373 | ++iii; | 382 | ++iii; |
374 | 383 | ||
375 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 384 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
376 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 385 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
377 | 386 | ||
378 | 387 | ||
379 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | 388 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); |
380 | } | 389 | } |
381 | 390 | ||
382 | void KDEPIMConfigWidget::setupLocaleTab() | 391 | void KDEPIMConfigWidget::setupLocaleTab() |
383 | { | 392 | { |
384 | 393 | ||
385 | QWidget *topFrame = new QWidget( this ); | 394 | QWidget *topFrame = new QWidget( this ); |
386 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 395 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
387 | 396 | ||
388 | topLayout->setSpacing(KDialog::spacingHint()); | 397 | topLayout->setSpacing(KDialog::spacingHint()); |
389 | topLayout->setMargin(KDialog::marginHint()); | 398 | topLayout->setMargin(KDialog::marginHint()); |
390 | int iii = 0; | 399 | int iii = 0; |
391 | KPrefsWidRadios *syncPrefsGroup = | 400 | KPrefsWidRadios *syncPrefsGroup = |
392 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | 401 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); |
393 | syncPrefsGroup->addRadio(i18n("English")); | 402 | syncPrefsGroup->addRadio(i18n("English")); |
394 | syncPrefsGroup->addRadio(i18n("German")); | 403 | syncPrefsGroup->addRadio(i18n("German")); |
395 | syncPrefsGroup->addRadio(i18n("French")); | 404 | syncPrefsGroup->addRadio(i18n("French")); |
396 | syncPrefsGroup->addRadio(i18n("Italian")); | 405 | syncPrefsGroup->addRadio(i18n("Italian")); |
397 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 406 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
398 | if ( QApplication::desktop()->width() < 300 ) { | 407 | if ( QApplication::desktop()->width() < 300 ) { |
399 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 408 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
400 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 409 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
401 | } | 410 | } |
402 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 411 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
403 | ++iii; | 412 | ++iii; |
404 | 413 | ||
405 | 414 | ||
406 | tabWidget->addTab( topFrame, i18n( "Language" ) ); | 415 | tabWidget->addTab( topFrame, i18n( "Language" ) ); |
407 | topFrame = new QWidget( this ); | 416 | topFrame = new QWidget( this ); |
408 | topLayout = new QGridLayout(topFrame,4,2); | 417 | topLayout = new QGridLayout(topFrame,4,2); |
409 | 418 | ||
410 | topLayout->setSpacing(KDialog::spacingHint()); | 419 | topLayout->setSpacing(KDialog::spacingHint()); |
411 | topLayout->setMargin(KDialog::marginHint()); | 420 | topLayout->setMargin(KDialog::marginHint()); |
412 | iii = 0; | 421 | iii = 0; |
413 | syncPrefsGroup = | 422 | syncPrefsGroup = |
414 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | 423 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); |
415 | if ( QApplication::desktop()->width() > 300 ) | 424 | if ( QApplication::desktop()->width() > 300 ) |
416 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 425 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
417 | syncPrefsGroup->addRadio(i18n("24:00")); | 426 | syncPrefsGroup->addRadio(i18n("24:00")); |
418 | syncPrefsGroup->addRadio(i18n("12:00am")); | 427 | syncPrefsGroup->addRadio(i18n("12:00am")); |
419 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 428 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
420 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 429 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
421 | ++iii; | 430 | ++iii; |
422 | 431 | ||
423 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | 432 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), |
424 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | 433 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); |
425 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 434 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
426 | ++iii; | 435 | ++iii; |
427 | 436 | ||
428 | 437 | ||
429 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); | 438 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); |
430 | 439 | ||
431 | } | 440 | } |
432 | 441 | ||
433 | 442 | ||
434 | void KDEPIMConfigWidget::setupTimeZoneTab() | 443 | void KDEPIMConfigWidget::setupTimeZoneTab() |
435 | { | 444 | { |
436 | QWidget *topFrame; | 445 | QWidget *topFrame; |
437 | QGridLayout *topLayout ; | 446 | QGridLayout *topLayout ; |
438 | 447 | ||
439 | 448 | ||
440 | 449 | ||
441 | 450 | ||
442 | 451 | ||
443 | 452 | ||
444 | topFrame = new QWidget( this ); | 453 | topFrame = new QWidget( this ); |
445 | topLayout = new QGridLayout( topFrame, 5, 2); | 454 | topLayout = new QGridLayout( topFrame, 5, 2); |
446 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 455 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
447 | topLayout->setMargin(KDialog::marginHintSmall()); | 456 | topLayout->setMargin(KDialog::marginHintSmall()); |
448 | 457 | ||
449 | QHBox *timeZoneBox = new QHBox( topFrame ); | 458 | QHBox *timeZoneBox = new QHBox( topFrame ); |
450 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 459 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
451 | 460 | ||
452 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 461 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
453 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 462 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
454 | if ( QApplication::desktop()->width() < 300 ) { | 463 | if ( QApplication::desktop()->width() < 300 ) { |
455 | mTimeZoneCombo->setMaximumWidth(150); | 464 | mTimeZoneCombo->setMaximumWidth(150); |
456 | } | 465 | } |
457 | 466 | ||
458 | QStringList list; | 467 | QStringList list; |
459 | list = KGlobal::locale()->timeZoneList(); | 468 | list = KGlobal::locale()->timeZoneList(); |
460 | mTimeZoneCombo->insertStringList(list); | 469 | mTimeZoneCombo->insertStringList(list); |
461 | 470 | ||
462 | // find the currently set time zone and select it | 471 | // find the currently set time zone and select it |
463 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | 472 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; |
464 | int nCurrentlySet = 11; | 473 | int nCurrentlySet = 11; |
465 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 474 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
466 | { | 475 | { |
467 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 476 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
468 | { | 477 | { |
469 | nCurrentlySet = i; | 478 | nCurrentlySet = i; |
470 | break; | 479 | break; |
471 | } | 480 | } |
472 | } | 481 | } |
473 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 482 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
474 | int iii = 1; | 483 | int iii = 1; |
475 | KPrefsWidBool *sb = | 484 | KPrefsWidBool *sb = |
476 | addWidBool(i18n("Add 30 min to selected Timezone"), | 485 | addWidBool(i18n("Add 30 min to selected Timezone"), |
477 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); | 486 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); |
478 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 487 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
479 | ++iii; | 488 | ++iii; |
480 | sb = | 489 | sb = |
481 | addWidBool(i18n("Timezone has daylight saving"), | 490 | addWidBool(i18n("Timezone has daylight saving"), |
482 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | 491 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); |
483 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 492 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
484 | ++iii; | 493 | ++iii; |
485 | QLabel* lab; | 494 | QLabel* lab; |
486 | 495 | ||
487 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 496 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
488 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 497 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
489 | ++iii; | 498 | ++iii; |
490 | 499 | ||
491 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 500 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
492 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 501 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
493 | ++iii; | 502 | ++iii; |
494 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 503 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
495 | topLayout->addWidget(lab, iii,0); | 504 | topLayout->addWidget(lab, iii,0); |
496 | mStartDateSavingEdit = new KDateEdit(topFrame); | 505 | mStartDateSavingEdit = new KDateEdit(topFrame); |
497 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 506 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
498 | ++iii; | 507 | ++iii; |
499 | 508 | ||
500 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 509 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
501 | topLayout->addWidget(lab, iii,0); | 510 | topLayout->addWidget(lab, iii,0); |
502 | mEndDateSavingEdit = new KDateEdit(topFrame); | 511 | mEndDateSavingEdit = new KDateEdit(topFrame); |
503 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 512 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
504 | ++iii; | 513 | ++iii; |
505 | QDate current ( 2001, 1,1); | 514 | QDate current ( 2001, 1,1); |
506 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | 515 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); |
507 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | 516 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); |
508 | 517 | ||
509 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 518 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
510 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 519 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
511 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | 520 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); |
512 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | 521 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); |
513 | 522 | ||
514 | 523 | ||
515 | topFrame = new QWidget( this ); | 524 | topFrame = new QWidget( this ); |
516 | topLayout = new QGridLayout( topFrame, 3, 2); | 525 | topLayout = new QGridLayout( topFrame, 3, 2); |
517 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 526 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
518 | topLayout->setMargin(KDialog::marginHintSmall()); | 527 | topLayout->setMargin(KDialog::marginHintSmall()); |
519 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); | 528 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); |
520 | 529 | ||
521 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); | 530 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); |
522 | topLayout->addMultiCellWidget(labb,0,0,0,2); | 531 | topLayout->addMultiCellWidget(labb,0,0,0,2); |
523 | int i = 1; | 532 | int i = 1; |
524 | KPrefsWidFont *timeLabelsFont = | 533 | KPrefsWidFont *timeLabelsFont = |
525 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), | 534 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), |
526 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); | 535 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); |
527 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 536 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
528 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 537 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
529 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 538 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
530 | } | 539 | } |
531 | 540 | ||
532 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 541 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
533 | { | 542 | { |
534 | // first store the current data | 543 | // first store the current data |
535 | saveEditFieldSettings(); | 544 | saveEditFieldSettings(); |
536 | 545 | ||
537 | // set mCurrentApp | 546 | // set mCurrentApp |
538 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 547 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
539 | 548 | ||
540 | // set mCurrentClient | 549 | // set mCurrentClient |
541 | switch(mCurrentApp) | 550 | switch(mCurrentApp) |
542 | { | 551 | { |
543 | case(ExternalAppHandler::EMAIL): | 552 | case(ExternalAppHandler::EMAIL): |
544 | mCurrentClient = mEmailClient; | 553 | mCurrentClient = mEmailClient; |
545 | break; | 554 | break; |
546 | case(ExternalAppHandler::PHONE): | 555 | case(ExternalAppHandler::PHONE): |
547 | mCurrentClient = mPhoneClient; | 556 | mCurrentClient = mPhoneClient; |
548 | break; | 557 | break; |
549 | case(ExternalAppHandler::SMS): | 558 | case(ExternalAppHandler::SMS): |
550 | mCurrentClient = mSMSClient; | 559 | mCurrentClient = mSMSClient; |
551 | break; | 560 | break; |
552 | case(ExternalAppHandler::FAX): | 561 | case(ExternalAppHandler::FAX): |
553 | mCurrentClient = mFaxClient; | 562 | mCurrentClient = mFaxClient; |
554 | break; | 563 | break; |
555 | case(ExternalAppHandler::PAGER): | 564 | case(ExternalAppHandler::PAGER): |
556 | mCurrentClient = mPagerClient; | 565 | mCurrentClient = mPagerClient; |
557 | break; | 566 | break; |
558 | case(ExternalAppHandler::SIP): | 567 | case(ExternalAppHandler::SIP): |
559 | mCurrentClient = mSipClient; | 568 | mCurrentClient = mSipClient; |
560 | break; | 569 | break; |
561 | default: | 570 | default: |
562 | return; | 571 | return; |
563 | } | 572 | } |
564 | 573 | ||
565 | // and at last update the widgets | 574 | // and at last update the widgets |
566 | updateClientWidgets(); | 575 | updateClientWidgets(); |
567 | } | 576 | } |
568 | 577 | ||
569 | 578 | ||
570 | 579 | ||
571 | void KDEPIMConfigWidget::client_changed( int newClient ) | 580 | void KDEPIMConfigWidget::client_changed( int newClient ) |
572 | { | 581 | { |
573 | if (newClient == mCurrentClient) | 582 | if (newClient == mCurrentClient) |
574 | return; | 583 | return; |
575 | 584 | ||
576 | // first store the current data | 585 | // first store the current data |
577 | saveEditFieldSettings(); | 586 | saveEditFieldSettings(); |
578 | 587 | ||
579 | 588 | ||
580 | //then reset the clientvariable | 589 | //then reset the clientvariable |
581 | mCurrentClient = newClient; | 590 | mCurrentClient = newClient; |
582 | 591 | ||
583 | // and at last update the widgets | 592 | // and at last update the widgets |
584 | updateClientWidgets(); | 593 | updateClientWidgets(); |
585 | 594 | ||
586 | KPrefsWidget::modified(); | 595 | KPrefsWidget::modified(); |
587 | } | 596 | } |
588 | 597 | ||
589 | void KDEPIMConfigWidget::saveEditFieldSettings() | 598 | void KDEPIMConfigWidget::saveEditFieldSettings() |
590 | { | 599 | { |
591 | 600 | ||
592 | switch(mCurrentApp) | 601 | switch(mCurrentApp) |
593 | { | 602 | { |
594 | case(ExternalAppHandler::EMAIL): | 603 | case(ExternalAppHandler::EMAIL): |
595 | mEmailClient = mClient->currentItem(); | 604 | mEmailClient = mClient->currentItem(); |
596 | break; | 605 | break; |
597 | case(ExternalAppHandler::PHONE): | 606 | case(ExternalAppHandler::PHONE): |
598 | mPhoneClient= mClient->currentItem(); | 607 | mPhoneClient= mClient->currentItem(); |
599 | break; | 608 | break; |
600 | case(ExternalAppHandler::SMS): | 609 | case(ExternalAppHandler::SMS): |
601 | mSMSClient = mClient->currentItem(); | 610 | mSMSClient = mClient->currentItem(); |
602 | break; | 611 | break; |
603 | case(ExternalAppHandler::FAX): | 612 | case(ExternalAppHandler::FAX): |
604 | mFaxClient = mClient->currentItem(); | 613 | mFaxClient = mClient->currentItem(); |
605 | break; | 614 | break; |
606 | case(ExternalAppHandler::PAGER): | 615 | case(ExternalAppHandler::PAGER): |
607 | mPagerClient = mClient->currentItem(); | 616 | mPagerClient = mClient->currentItem(); |
608 | break; | 617 | break; |
609 | case(ExternalAppHandler::SIP): | 618 | case(ExternalAppHandler::SIP): |
610 | mSipClient = mClient->currentItem(); | 619 | mSipClient = mClient->currentItem(); |
611 | break; | 620 | break; |
612 | default: | 621 | default: |
613 | return; | 622 | return; |
614 | } | 623 | } |
615 | 624 | ||
616 | //store the current data back to the apropriate membervariables if we had set it to "other" | 625 | //store the current data back to the apropriate membervariables if we had set it to "other" |
617 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 626 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
618 | { | 627 | { |
619 | mEmailOtherChannel = mChannel->text(); | 628 | mEmailOtherChannel = mChannel->text(); |
620 | mEmailOtherMessage = mMessage->text(); | 629 | mEmailOtherMessage = mMessage->text(); |
621 | mEmailOtherMessageParameters = mParameters->text(); | 630 | mEmailOtherMessageParameters = mParameters->text(); |
622 | mEmailOtherMessage2 = mMessage2->text(); | 631 | mEmailOtherMessage2 = mMessage2->text(); |
623 | mEmailOtherMessageParameters2 = mParameters2->text(); | 632 | mEmailOtherMessageParameters2 = mParameters2->text(); |
624 | } | 633 | } |
625 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 634 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
626 | { | 635 | { |
627 | mPhoneOtherChannel = mChannel->text(); | 636 | mPhoneOtherChannel = mChannel->text(); |
628 | mPhoneOtherMessage = mMessage->text(); | 637 | mPhoneOtherMessage = mMessage->text(); |
629 | mPhoneOtherMessageParameters = mParameters->text(); | 638 | mPhoneOtherMessageParameters = mParameters->text(); |
630 | } | 639 | } |
631 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 640 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
632 | { | 641 | { |
633 | mSMSOtherChannel = mChannel->text(); | 642 | mSMSOtherChannel = mChannel->text(); |
634 | mSMSOtherMessage = mMessage->text(); | 643 | mSMSOtherMessage = mMessage->text(); |
635 | mSMSOtherMessageParameters = mParameters->text(); | 644 | mSMSOtherMessageParameters = mParameters->text(); |
636 | } | 645 | } |
637 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 646 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
638 | { | 647 | { |
639 | mFaxOtherChannel = mChannel->text(); | 648 | mFaxOtherChannel = mChannel->text(); |
640 | mFaxOtherMessage = mMessage->text(); | 649 | mFaxOtherMessage = mMessage->text(); |
641 | mFaxOtherMessageParameters = mParameters->text(); | 650 | mFaxOtherMessageParameters = mParameters->text(); |
642 | } | 651 | } |
643 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 652 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
644 | { | 653 | { |
645 | mPagerOtherChannel = mChannel->text(); | 654 | mPagerOtherChannel = mChannel->text(); |
646 | mPagerOtherMessage = mMessage->text(); | 655 | mPagerOtherMessage = mMessage->text(); |
647 | mPagerOtherMessageParameters = mParameters->text(); | 656 | mPagerOtherMessageParameters = mParameters->text(); |
648 | } | 657 | } |
649 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 658 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
650 | { | 659 | { |
651 | mSipOtherChannel = mChannel->text(); | 660 | mSipOtherChannel = mChannel->text(); |
652 | mSipOtherMessage = mMessage->text(); | 661 | mSipOtherMessage = mMessage->text(); |
653 | mSipOtherMessageParameters = mParameters->text(); | 662 | mSipOtherMessageParameters = mParameters->text(); |
654 | } | 663 | } |
655 | 664 | ||
656 | 665 | ||
657 | } | 666 | } |
658 | 667 | ||
659 | void KDEPIMConfigWidget::updateClientWidgets() | 668 | void KDEPIMConfigWidget::updateClientWidgets() |
660 | { | 669 | { |
661 | bool blocked = signalsBlocked(); | 670 | bool blocked = signalsBlocked(); |
662 | blockSignals( true ); | 671 | blockSignals( true ); |
663 | 672 | ||
664 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 673 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
665 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 674 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
666 | if (it == mExternalAppsMap.end()) | 675 | if (it == mExternalAppsMap.end()) |
667 | return; | 676 | return; |
668 | 677 | ||
669 | // update group box | 678 | // update group box |
670 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 679 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
671 | 680 | ||
672 | //update the entries in the client combobox | 681 | //update the entries in the client combobox |
673 | mClient->clear(); | 682 | mClient->clear(); |
674 | 683 | ||
675 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 684 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
676 | DefaultAppItem* dai; | 685 | DefaultAppItem* dai; |
677 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 686 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
678 | { | 687 | { |
679 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 688 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
680 | 689 | ||
681 | if (dai->_id == mCurrentClient) | 690 | if (dai->_id == mCurrentClient) |
682 | { | 691 | { |
683 | //restore the edit fields with the data of the local membervariables if we had set it to "other". | 692 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
684 | //Otherwise take the default data from externalapphandler. | 693 | //Otherwise take the default data from externalapphandler. |
685 | mChannel->setText(dai->_channel); | 694 | mChannel->setText(dai->_channel); |
686 | mMessage->setText(dai->_message); | 695 | mMessage->setText(dai->_message); |
687 | mParameters->setText(dai->_parameters); | 696 | mParameters->setText(dai->_parameters); |
688 | mMessage2->setText(dai->_message2); | 697 | mMessage2->setText(dai->_message2); |
689 | mParameters2->setText(dai->_parameters2); | 698 | mParameters2->setText(dai->_parameters2); |
690 | 699 | ||
691 | 700 | ||
692 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 701 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
693 | { | 702 | { |
694 | mChannel->setText(mEmailOtherChannel); | 703 | mChannel->setText(mEmailOtherChannel); |
695 | mMessage->setText(mEmailOtherMessage); | 704 | mMessage->setText(mEmailOtherMessage); |
696 | mParameters->setText(mEmailOtherMessageParameters); | 705 | mParameters->setText(mEmailOtherMessageParameters); |
697 | mMessage2->setText(mEmailOtherMessage2); | 706 | mMessage2->setText(mEmailOtherMessage2); |
698 | mParameters2->setText(mEmailOtherMessageParameters2); | 707 | mParameters2->setText(mEmailOtherMessageParameters2); |
699 | } | 708 | } |
700 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 709 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
701 | { | 710 | { |
702 | mChannel->setText(mPhoneOtherChannel); | 711 | mChannel->setText(mPhoneOtherChannel); |
703 | mMessage->setText(mPhoneOtherMessage); | 712 | mMessage->setText(mPhoneOtherMessage); |
704 | mParameters->setText(mPhoneOtherMessageParameters); | 713 | mParameters->setText(mPhoneOtherMessageParameters); |
705 | } | 714 | } |
706 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 715 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
707 | { | 716 | { |
708 | mChannel->setText(mSMSOtherChannel); | 717 | mChannel->setText(mSMSOtherChannel); |
709 | mMessage->setText(mSMSOtherMessage); | 718 | mMessage->setText(mSMSOtherMessage); |
710 | mParameters->setText(mSMSOtherMessageParameters); | 719 | mParameters->setText(mSMSOtherMessageParameters); |
711 | } | 720 | } |
712 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 721 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
713 | { | 722 | { |
714 | mChannel->setText(mFaxOtherChannel); | 723 | mChannel->setText(mFaxOtherChannel); |
715 | mMessage->setText(mFaxOtherMessage); | 724 | mMessage->setText(mFaxOtherMessage); |
716 | mParameters->setText(mFaxOtherMessageParameters); | 725 | mParameters->setText(mFaxOtherMessageParameters); |
717 | } | 726 | } |
718 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 727 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
719 | { | 728 | { |
720 | mChannel->setText(mPagerOtherChannel); | 729 | mChannel->setText(mPagerOtherChannel); |
721 | mMessage->setText(mPagerOtherMessage); | 730 | mMessage->setText(mPagerOtherMessage); |
722 | mParameters->setText(mPagerOtherMessageParameters); | 731 | mParameters->setText(mPagerOtherMessageParameters); |
723 | } | 732 | } |
724 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 733 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
725 | { | 734 | { |
726 | mChannel->setText(mSipOtherChannel); | 735 | mChannel->setText(mSipOtherChannel); |
727 | mMessage->setText(mSipOtherMessage); | 736 | mMessage->setText(mSipOtherMessage); |
728 | mParameters->setText(mSipOtherMessageParameters); | 737 | mParameters->setText(mSipOtherMessageParameters); |
729 | } | 738 | } |
730 | } | 739 | } |
731 | 740 | ||
732 | } | 741 | } |
733 | 742 | ||
734 | bool readonly; | 743 | bool readonly; |
735 | bool enabled; | 744 | bool enabled; |
736 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 745 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
737 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 746 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
738 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 747 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
739 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 748 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
740 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 749 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
741 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) | 750 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) |
742 | { | 751 | { |
743 | readonly = false; | 752 | readonly = false; |
744 | } | 753 | } |
745 | else | 754 | else |
746 | { | 755 | { |
747 | readonly = true; | 756 | readonly = true; |
748 | } | 757 | } |
749 | 758 | ||
750 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) | 759 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) |
751 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) | 760 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) |
752 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) | 761 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) |
753 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) | 762 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) |
754 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) | 763 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) |
755 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) | 764 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) |
756 | { | 765 | { |
757 | enabled = false; | 766 | enabled = false; |
758 | } | 767 | } |
759 | else | 768 | else |
760 | { | 769 | { |
761 | enabled = true; | 770 | enabled = true; |
762 | } | 771 | } |
763 | 772 | ||
764 | 773 | ||
765 | mChannel->setReadOnly(readonly); | 774 | mChannel->setReadOnly(readonly); |
766 | mMessage->setReadOnly(readonly); | 775 | mMessage->setReadOnly(readonly); |
767 | mParameters->setReadOnly(readonly); | 776 | mParameters->setReadOnly(readonly); |
768 | mMessage2->setReadOnly(readonly); | 777 | mMessage2->setReadOnly(readonly); |
769 | mParameters2->setReadOnly(readonly); | 778 | mParameters2->setReadOnly(readonly); |
770 | 779 | ||
771 | mChannel->setEnabled(enabled); | 780 | mChannel->setEnabled(enabled); |
772 | mMessage->setEnabled(enabled); | 781 | mMessage->setEnabled(enabled); |
773 | mParameters->setEnabled(enabled); | 782 | mParameters->setEnabled(enabled); |
774 | mMessage2->setEnabled(enabled); | 783 | mMessage2->setEnabled(enabled); |
775 | mParameters2->setEnabled(enabled); | 784 | mParameters2->setEnabled(enabled); |
776 | 785 | ||
777 | 786 | ||
778 | 787 | ||
779 | mClient->setCurrentItem(mCurrentClient); | 788 | mClient->setCurrentItem(mCurrentClient); |
780 | 789 | ||
781 | 790 | ||
782 | // enable/disable the extra message/parameter field | 791 | // enable/disable the extra message/parameter field |
783 | if (mCurrentApp == ExternalAppHandler::EMAIL) | 792 | if (mCurrentApp == ExternalAppHandler::EMAIL) |
784 | { | 793 | { |
785 | } | 794 | } |
786 | else | 795 | else |
787 | { | 796 | { |
788 | mMessage2->setText( "" ); | 797 | mMessage2->setText( "" ); |
789 | mParameters2->setText( "" ); | 798 | mParameters2->setText( "" ); |
790 | } | 799 | } |
791 | 800 | ||
792 | if (enabled == true) { | 801 | if (enabled == true) { |
793 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 802 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
794 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 803 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
795 | } | 804 | } |
796 | 805 | ||
797 | 806 | ||
798 | blockSignals( blocked ); | 807 | blockSignals( blocked ); |
799 | 808 | ||
800 | } | 809 | } |
801 | 810 | ||
802 | void KDEPIMConfigWidget::usrReadConfig() | 811 | void KDEPIMConfigWidget::usrReadConfig() |
803 | { | 812 | { |
804 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 813 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
805 | 814 | ||
806 | bool blocked = signalsBlocked(); | 815 | bool blocked = signalsBlocked(); |
807 | blockSignals( true ); | 816 | blockSignals( true ); |
808 | 817 | ||
818 | if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) | ||
819 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | ||
820 | else | ||
821 | mBackupUrl->setURL(prefs->mBackupDatadir); | ||
822 | mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); | ||
823 | mBackupDayCountSpin->setValue( prefs->mBackupDayCount); | ||
824 | |||
809 | QString dummy = prefs->mUserDateFormatLong; | 825 | QString dummy = prefs->mUserDateFormatLong; |
810 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 826 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
811 | dummy = prefs->mUserDateFormatShort; | 827 | dummy = prefs->mUserDateFormatShort; |
812 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 828 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
813 | 829 | ||
814 | QDate current ( 2001, 1,1); | 830 | QDate current ( 2001, 1,1); |
815 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); | 831 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); |
816 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); | 832 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); |
817 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); | 833 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); |
818 | 834 | ||
819 | |||
820 | |||
821 | |||
822 | mEmailClient = prefs->mEmailClient; | 835 | mEmailClient = prefs->mEmailClient; |
823 | mEmailOtherChannel = prefs->mEmailOtherChannel; | 836 | mEmailOtherChannel = prefs->mEmailOtherChannel; |
824 | mEmailOtherMessage = prefs->mEmailOtherMessage; | 837 | mEmailOtherMessage = prefs->mEmailOtherMessage; |
825 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; | 838 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; |
826 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; | 839 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; |
827 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; | 840 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; |
828 | 841 | ||
829 | mPhoneClient = prefs->mPhoneClient; | 842 | mPhoneClient = prefs->mPhoneClient; |
830 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; | 843 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; |
831 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; | 844 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; |
832 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; | 845 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; |
833 | 846 | ||
834 | mFaxClient = prefs->mFaxClient; | 847 | mFaxClient = prefs->mFaxClient; |
835 | mFaxOtherChannel = prefs->mFaxOtherChannel; | 848 | mFaxOtherChannel = prefs->mFaxOtherChannel; |
836 | mFaxOtherMessage = prefs->mFaxOtherMessage; | 849 | mFaxOtherMessage = prefs->mFaxOtherMessage; |
837 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; | 850 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; |
838 | 851 | ||
839 | mSMSClient = prefs->mSMSClient; | 852 | mSMSClient = prefs->mSMSClient; |
840 | mSMSOtherChannel = prefs->mSMSOtherChannel; | 853 | mSMSOtherChannel = prefs->mSMSOtherChannel; |
841 | mSMSOtherMessage = prefs->mSMSOtherMessage; | 854 | mSMSOtherMessage = prefs->mSMSOtherMessage; |
842 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; | 855 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; |
843 | 856 | ||
844 | mPagerClient = prefs->mPagerClient; | 857 | mPagerClient = prefs->mPagerClient; |
845 | mPagerOtherChannel = prefs->mPagerOtherChannel; | 858 | mPagerOtherChannel = prefs->mPagerOtherChannel; |
846 | mPagerOtherMessage = prefs->mPagerOtherMessage; | 859 | mPagerOtherMessage = prefs->mPagerOtherMessage; |
847 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; | 860 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; |
848 | 861 | ||
849 | mSipClient = prefs->mSipClient; | 862 | mSipClient = prefs->mSipClient; |
850 | mSipOtherChannel = prefs->mSipOtherChannel; | 863 | mSipOtherChannel = prefs->mSipOtherChannel; |
851 | mSipOtherMessage = prefs->mSipOtherMessage; | 864 | mSipOtherMessage = prefs->mSipOtherMessage; |
852 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; | 865 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; |
853 | 866 | ||
854 | mCurrentApp = ExternalAppHandler::EMAIL; | 867 | mCurrentApp = ExternalAppHandler::EMAIL; |
855 | mCurrentClient = mEmailClient; | 868 | mCurrentClient = mEmailClient; |
856 | 869 | ||
857 | updateClientWidgets(); | 870 | updateClientWidgets(); |
858 | 871 | ||
859 | blockSignals( blocked ); | 872 | blockSignals( blocked ); |
860 | 873 | ||
861 | } | 874 | } |
862 | 875 | ||
863 | void KDEPIMConfigWidget::usrWriteConfig() | 876 | void KDEPIMConfigWidget::usrWriteConfig() |
864 | { | 877 | { |
865 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 878 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
866 | 879 | ||
867 | saveEditFieldSettings(); | 880 | saveEditFieldSettings(); |
868 | 881 | ||
882 | prefs->mBackupNumbers = mBackupNumbersSpin->value(); | ||
883 | prefs->mBackupDayCount = mBackupDayCountSpin->value(); | ||
884 | prefs->mBackupDatadir = mBackupUrl->url(); | ||
869 | 885 | ||
870 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 886 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
871 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 887 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
872 | 888 | ||
873 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); | 889 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); |
874 | QDate date; | 890 | QDate date; |
875 | date = mStartDateSavingEdit->date(); | 891 | date = mStartDateSavingEdit->date(); |
876 | int sub = 0; | 892 | int sub = 0; |
877 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 893 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
878 | sub = 1; | 894 | sub = 1; |
879 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; | 895 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; |
880 | date = mEndDateSavingEdit->date(); | 896 | date = mEndDateSavingEdit->date(); |
881 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 897 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
882 | sub = 1; | 898 | sub = 1; |
883 | else | 899 | else |
884 | sub = 0; | 900 | sub = 0; |
885 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; | 901 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; |
886 | 902 | ||
887 | 903 | ||
888 | prefs->mEmailClient = mEmailClient; | 904 | prefs->mEmailClient = mEmailClient; |
889 | prefs->mEmailOtherChannel = mEmailOtherChannel; | 905 | prefs->mEmailOtherChannel = mEmailOtherChannel; |
890 | prefs->mEmailOtherMessage = mEmailOtherMessage; | 906 | prefs->mEmailOtherMessage = mEmailOtherMessage; |
891 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; | 907 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; |
892 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; | 908 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; |
893 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; | 909 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; |
894 | 910 | ||
895 | prefs->mPhoneClient = mPhoneClient; | 911 | prefs->mPhoneClient = mPhoneClient; |
896 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; | 912 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; |
897 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; | 913 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; |
898 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; | 914 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; |
899 | 915 | ||
900 | prefs->mFaxClient = mFaxClient; | 916 | prefs->mFaxClient = mFaxClient; |
901 | prefs->mFaxOtherChannel = mFaxOtherChannel; | 917 | prefs->mFaxOtherChannel = mFaxOtherChannel; |
902 | prefs->mFaxOtherMessage = mFaxOtherMessage; | 918 | prefs->mFaxOtherMessage = mFaxOtherMessage; |
903 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; | 919 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; |
904 | 920 | ||
905 | prefs->mSMSClient = mSMSClient; | 921 | prefs->mSMSClient = mSMSClient; |
906 | prefs->mSMSOtherChannel = mSMSOtherChannel; | 922 | prefs->mSMSOtherChannel = mSMSOtherChannel; |
907 | prefs->mSMSOtherMessage = mSMSOtherMessage; | 923 | prefs->mSMSOtherMessage = mSMSOtherMessage; |
908 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; | 924 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; |
909 | 925 | ||
910 | prefs->mPagerClient = mPagerClient; | 926 | prefs->mPagerClient = mPagerClient; |
911 | prefs->mPagerOtherChannel = mPagerOtherChannel; | 927 | prefs->mPagerOtherChannel = mPagerOtherChannel; |
912 | prefs->mPagerOtherMessage = mPagerOtherMessage; | 928 | prefs->mPagerOtherMessage = mPagerOtherMessage; |
913 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; | 929 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; |
914 | 930 | ||
915 | 931 | ||
916 | prefs->mSipClient = mSipClient; | 932 | prefs->mSipClient = mSipClient; |
917 | prefs->mSipOtherChannel = mSipOtherChannel; | 933 | prefs->mSipOtherChannel = mSipOtherChannel; |
918 | prefs->mSipOtherMessage = mSipOtherMessage; | 934 | prefs->mSipOtherMessage = mSipOtherMessage; |
919 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; | 935 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; |
920 | 936 | ||
921 | //release the cache that other views can access the changed values instantanious | 937 | //release the cache that other views can access the changed values instantanious |
922 | ExternalAppHandler::instance()->loadConfig(); | 938 | ExternalAppHandler::instance()->loadConfig(); |
923 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 939 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
924 | } | 940 | } |
925 | 941 | ||
926 | 942 | ||
927 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, | 943 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, |
928 | const QStringList *tags) | 944 | const QStringList *tags) |
929 | { | 945 | { |
930 | if (tags) { | 946 | if (tags) { |
931 | int i = tags->findIndex(text); | 947 | int i = tags->findIndex(text); |
932 | if (i > 0) combo->setCurrentItem(i); | 948 | if (i > 0) combo->setCurrentItem(i); |
933 | } else { | 949 | } else { |
934 | for(int i=0;i<combo->count();++i) { | 950 | for(int i=0;i<combo->count();++i) { |
935 | if (combo->text(i) == text) { | 951 | if (combo->text(i) == text) { |
936 | combo->setCurrentItem(i); | 952 | combo->setCurrentItem(i); |
937 | break; | 953 | break; |
938 | } | 954 | } |
939 | } | 955 | } |
940 | } | 956 | } |
941 | } | 957 | } |
942 | 958 | ||
943 | 959 | ||
944 | void KDEPIMConfigWidget::textChanged( const QString& text ) | 960 | void KDEPIMConfigWidget::textChanged( const QString& text ) |
945 | { | 961 | { |
946 | emit changed( true ); | 962 | emit changed( true ); |
947 | } | 963 | } |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 90321b2..9c28425 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -1,223 +1,229 @@ | |||
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"); | 63 | KPrefs::setCurrentGroup("Colors"); |
64 | addItemColor("AlternateBGcolor",&mAlternateColor,KGlobalSettings::alternateBackgroundColor()); | 64 | addItemColor("AlternateBGcolor",&mAlternateColor,KGlobalSettings::alternateBackgroundColor()); |
65 | 65 | ||
66 | 66 | ||
67 | KPrefs::setCurrentGroup("Time & Date"); | 67 | KPrefs::setCurrentGroup("Time & Date"); |
68 | 68 | ||
69 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); | 69 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); |
70 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 70 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
71 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); | 71 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); |
72 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 72 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
73 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 73 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
74 | 74 | ||
75 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 75 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
76 | 76 | ||
77 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); | 77 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
78 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 78 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
79 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 79 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
80 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 80 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
81 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); | 81 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); |
82 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); | 82 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); |
83 | 83 | ||
84 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); | 84 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); |
85 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); | 85 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); |
86 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); | 86 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); |
87 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); | 87 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); |
88 | 88 | ||
89 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); | 89 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); |
90 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); | 90 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); |
91 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); | 91 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); |
92 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 92 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
93 | 93 | ||
94 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 94 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
95 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 95 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
96 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 96 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
97 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 97 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
98 | 98 | ||
99 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 99 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
100 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 100 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
101 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 101 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
102 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 102 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
103 | 103 | ||
104 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); | 104 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); |
105 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); | 105 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); |
106 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); | 106 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); |
107 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); | 107 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); |
108 | 108 | ||
109 | KPrefs::setCurrentGroup( "PhoneAccess" ); | 109 | KPrefs::setCurrentGroup( "PhoneAccess" ); |
110 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | 110 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); |
111 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | 111 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); |
112 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | 112 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |
113 | 113 | ||
114 | KPrefs::setCurrentGroup( "BackupSettings" ); | 114 | KPrefs::setCurrentGroup( "BackupSettings" ); |
115 | addItemString("BackupDatadir",&mBackupDatadir,KGlobalSettings::backupDataDir()); | 115 | addItemString("BackupDatadir",&mBackupDatadir,KGlobalSettings::backupDataDir()); |
116 | addItemInt( "BackupNumbers", &mBackupNumbers, 3 ); | 116 | addItemInt( "BackupNumbers", &mBackupNumbers, 3 ); |
117 | addItemInt( "BackupDayCount", &mBackupDayCount, 2 ); | 117 | addItemInt( "BackupDayCount", &mBackupDayCount, 2 ); |
118 | addItemBool( "BackupUseDefaultDir",&mBackupUseDefaultDir, true ); | 118 | addItemBool( "BackupUseDefaultDir",&mBackupUseDefaultDir, true ); |
119 | addItemBool( "BackupEnabled",&mBackupEnabled, false ); | 119 | addItemBool( "BackupEnabled",&mBackupEnabled, false ); |
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | void KPimGlobalPrefs::setGlobalConfig() | 123 | void KPimGlobalPrefs::setGlobalConfig() |
124 | { | 124 | { |
125 | if ( mLocaleDict == 0 ) { | 125 | if ( mLocaleDict == 0 ) { |
126 | QString fileName ; | 126 | QString fileName ; |
127 | QString name = KGlobal::getAppName() +"/"; | 127 | QString name = KGlobal::getAppName() +"/"; |
128 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
129 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; | 129 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; |
130 | #else | 130 | #else |
131 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; | 131 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; |
132 | #endif | 132 | #endif |
133 | mLocaleDict = 0; | 133 | mLocaleDict = 0; |
134 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | 134 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { |
135 | 135 | ||
136 | if ( mPreferredLanguage == 1 ) | 136 | if ( mPreferredLanguage == 1 ) |
137 | fileName = fileName+"germantranslation.txt"; | 137 | fileName = fileName+"germantranslation.txt"; |
138 | else if ( mPreferredLanguage == 4 ) | 138 | else if ( mPreferredLanguage == 4 ) |
139 | fileName = fileName+"usertranslation.txt"; | 139 | fileName = fileName+"usertranslation.txt"; |
140 | else if ( mPreferredLanguage == 2 ) | 140 | else if ( mPreferredLanguage == 2 ) |
141 | fileName = fileName+"frenchtranslation.txt"; | 141 | fileName = fileName+"frenchtranslation.txt"; |
142 | else if ( mPreferredLanguage == 3 ) | 142 | else if ( mPreferredLanguage == 3 ) |
143 | fileName = fileName+"italiantranslation.txt"; | 143 | fileName = fileName+"italiantranslation.txt"; |
144 | QFile file( fileName ); | 144 | QFile file( fileName ); |
145 | if (file.open( IO_ReadOnly ) ) { | 145 | if (file.open( IO_ReadOnly ) ) { |
146 | QTextStream ts( &file ); | 146 | QTextStream ts( &file ); |
147 | ts.setEncoding( QTextStream::Latin1 ); | 147 | ts.setEncoding( QTextStream::Latin1 ); |
148 | //ts.setCodec( QTextCodec::latin1 ); | 148 | //ts.setCodec( QTextCodec::latin1 ); |
149 | QString text = ts.read(); | 149 | QString text = ts.read(); |
150 | file.close(); | 150 | file.close(); |
151 | text.replace( QRegExp("\\\\n"), "\n" ); | 151 | text.replace( QRegExp("\\\\n"), "\n" ); |
152 | QString line; | 152 | QString line; |
153 | QString we; | 153 | QString we; |
154 | QString wt; | 154 | QString wt; |
155 | int br = 0; | 155 | int br = 0; |
156 | int nbr; | 156 | int nbr; |
157 | nbr = text.find ( "},", br ); | 157 | nbr = text.find ( "},", br ); |
158 | line = text.mid( br, nbr - br ); | 158 | line = text.mid( br, nbr - br ); |
159 | br = nbr+1; | 159 | br = nbr+1; |
160 | int se, ee, st, et; | 160 | int se, ee, st, et; |
161 | mLocaleDict = new QDict<QString>; | 161 | mLocaleDict = new QDict<QString>; |
162 | mLocaleDict->setAutoDelete( true ); | 162 | mLocaleDict->setAutoDelete( true ); |
163 | QString end = "{ \"\",\"\" }"; | 163 | QString end = "{ \"\",\"\" }"; |
164 | while ( (line != end) && (br > 1) ) { | 164 | while ( (line != end) && (br > 1) ) { |
165 | //qDebug("%d *%s* ", br, line.latin1()); | 165 | //qDebug("%d *%s* ", br, line.latin1()); |
166 | se = line.find("\"")+1; | 166 | se = line.find("\"")+1; |
167 | et = line.findRev("\"",-1); | 167 | et = line.findRev("\"",-1); |
168 | ee = line.find("\",\""); | 168 | ee = line.find("\",\""); |
169 | st = ee+3; | 169 | st = ee+3; |
170 | we = line.mid( se, ee-se ); | 170 | we = line.mid( se, ee-se ); |
171 | if ( mPreferredLanguage == 4 ) | 171 | if ( mPreferredLanguage == 4 ) |
172 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); | 172 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); |
173 | else | 173 | else |
174 | wt = line.mid( st, et-st ); | 174 | wt = line.mid( st, et-st ); |
175 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | 175 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); |
176 | mLocaleDict->insert( we, new QString (wt) ); | 176 | mLocaleDict->insert( we, new QString (wt) ); |
177 | nbr = text.find ( "}", br ); | 177 | nbr = text.find ( "}", br ); |
178 | line = text.mid( br, nbr - br ); | 178 | line = text.mid( br, nbr - br ); |
179 | br = nbr+1; | 179 | br = nbr+1; |
180 | } | 180 | } |
181 | //qDebug("end *%s* ", end.latin1()); | 181 | //qDebug("end *%s* ", end.latin1()); |
182 | 182 | ||
183 | setLocaleDict( mLocaleDict ); | 183 | setLocaleDict( mLocaleDict ); |
184 | } else { | 184 | } else { |
185 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | 185 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | KGlobal::locale()->setHore24Format( !mPreferredTime ); | 190 | KGlobal::locale()->setHore24Format( !mPreferredTime ); |
191 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); | 191 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); |
192 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); | 192 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); |
193 | KGlobal::locale()->setLanguage( mPreferredLanguage ); | 193 | KGlobal::locale()->setLanguage( mPreferredLanguage ); |
194 | QString dummy = mUserDateFormatLong; | 194 | QString dummy = mUserDateFormatLong; |
195 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 195 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
196 | dummy = mUserDateFormatShort; | 196 | dummy = mUserDateFormatShort; |
197 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 197 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
198 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, | 198 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, |
199 | mDaylightsavingStart, | 199 | mDaylightsavingStart, |
200 | mDaylightsavingEnd ); | 200 | mDaylightsavingEnd ); |
201 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); | 201 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); |
202 | KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); | 202 | KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); |
203 | QString localKdeDir; | ||
204 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); | ||
205 | if ( ! localKdeDir.isEmpty() ) { | ||
206 | mBackupUseDefaultDir = true; | ||
207 | mBackupDatadir = KGlobalSettings::backupDataDir(); | ||
208 | } | ||
203 | 209 | ||
204 | } | 210 | } |
205 | KPimGlobalPrefs::~KPimGlobalPrefs() | 211 | KPimGlobalPrefs::~KPimGlobalPrefs() |
206 | { | 212 | { |
207 | if (sInstance == this) | 213 | if (sInstance == this) |
208 | sInstance = staticDeleterGP.setObject(0); | 214 | sInstance = staticDeleterGP.setObject(0); |
209 | else | 215 | else |
210 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); | 216 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); |
211 | if ( mLocaleDict ) | 217 | if ( mLocaleDict ) |
212 | delete mLocaleDict; | 218 | delete mLocaleDict; |
213 | } | 219 | } |
214 | 220 | ||
215 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 221 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
216 | { | 222 | { |
217 | if ( !sInstance ) { | 223 | if ( !sInstance ) { |
218 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); | 224 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); |
219 | sInstance->readConfig(); | 225 | sInstance->readConfig(); |
220 | } | 226 | } |
221 | 227 | ||
222 | return sInstance; | 228 | return sInstance; |
223 | } | 229 | } |
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp index d68ccb6..714d1b7 100644 --- a/libkdepim/kpimprefs.cpp +++ b/libkdepim/kpimprefs.cpp | |||
@@ -1,82 +1,85 @@ | |||
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 | 35 | ||
36 | #include "kpimprefs.h" | 36 | #include "kpimprefs.h" |
37 | 37 | ||
38 | KPimPrefs::KPimPrefs( const QString &name ) : | 38 | KPimPrefs::KPimPrefs( const QString &name ) : |
39 | KPrefs( name ) | 39 | KPrefs( name ) |
40 | { | 40 | { |
41 | #ifdef _WIN32_ | 41 | #ifdef _WIN32_ |
42 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 42 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
43 | #else | 43 | #else |
44 | QString hdp= locateLocal("data","korganizer")+"/"; | 44 | QString hdp= locateLocal("data","korganizer")+"/"; |
45 | #endif | 45 | #endif |
46 | setCurrentGroup("SyncOptions"); | 46 | setCurrentGroup("SyncOptions"); |
47 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); | 47 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); |
48 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); | 48 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); |
49 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 49 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
50 | addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false ); | 50 | addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false ); |
51 | addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false ); | 51 | addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false ); |
52 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 52 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
53 | |||
54 | setCurrentGroup("BackupDate"); | ||
55 | addItemInt("LastBackupDate",&mLastBackupDate,0); | ||
53 | } | 56 | } |
54 | 57 | ||
55 | KPimPrefs::~KPimPrefs() | 58 | KPimPrefs::~KPimPrefs() |
56 | { | 59 | { |
57 | } | 60 | } |
58 | 61 | ||
59 | void KPimPrefs::usrSetDefaults() | 62 | void KPimPrefs::usrSetDefaults() |
60 | { | 63 | { |
61 | setCategoryDefaults(); | 64 | setCategoryDefaults(); |
62 | } | 65 | } |
63 | 66 | ||
64 | void KPimPrefs::usrReadConfig() | 67 | void KPimPrefs::usrReadConfig() |
65 | { | 68 | { |
66 | config()->setGroup("General"); | 69 | config()->setGroup("General"); |
67 | mCustomCategories = config()->readListEntry("Custom Categories"); | 70 | mCustomCategories = config()->readListEntry("Custom Categories"); |
68 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 71 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
69 | } | 72 | } |
70 | 73 | ||
71 | 74 | ||
72 | void KPimPrefs::usrWriteConfig() | 75 | void KPimPrefs::usrWriteConfig() |
73 | { | 76 | { |
74 | config()->setGroup("General"); | 77 | config()->setGroup("General"); |
75 | config()->writeEntry("Custom Categories",mCustomCategories); | 78 | config()->writeEntry("Custom Categories",mCustomCategories); |
76 | } | 79 | } |
77 | 80 | ||
78 | void KPimPrefs::setCategoryDefaults() | 81 | void KPimPrefs::setCategoryDefaults() |
79 | { | 82 | { |
80 | // empty implementation | 83 | // empty implementation |
81 | } | 84 | } |
82 | 85 | ||
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h index c177bd6..bf80042 100644 --- a/libkdepim/kpimprefs.h +++ b/libkdepim/kpimprefs.h | |||
@@ -1,73 +1,74 @@ | |||
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 | #ifndef KPIMPREFS_H | 31 | #ifndef KPIMPREFS_H |
32 | #define KPIMPREFS_H | 32 | #define KPIMPREFS_H |
33 | 33 | ||
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | 35 | ||
36 | #include "kprefs.h" | 36 | #include "kprefs.h" |
37 | 37 | ||
38 | class KPimPrefs : public KPrefs | 38 | class KPimPrefs : public KPrefs |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | 41 | ||
42 | KPimPrefs( const QString &name = QString::null ); | 42 | KPimPrefs( const QString &name = QString::null ); |
43 | 43 | ||
44 | virtual ~KPimPrefs(); | 44 | virtual ~KPimPrefs(); |
45 | 45 | ||
46 | /** Set preferences to default values */ | 46 | /** Set preferences to default values */ |
47 | void usrSetDefaults(); | 47 | void usrSetDefaults(); |
48 | 48 | ||
49 | /** Read preferences from config file */ | 49 | /** Read preferences from config file */ |
50 | void usrReadConfig(); | 50 | void usrReadConfig(); |
51 | 51 | ||
52 | /** Write preferences to config file */ | 52 | /** Write preferences to config file */ |
53 | void usrWriteConfig(); | 53 | void usrWriteConfig(); |
54 | 54 | ||
55 | 55 | ||
56 | public: | 56 | public: |
57 | QStringList mCustomCategories; | 57 | QStringList mCustomCategories; |
58 | QString mPassiveSyncPort; | 58 | QString mPassiveSyncPort; |
59 | QString mPassiveSyncPw; | 59 | QString mPassiveSyncPw; |
60 | bool mPassiveSyncWithDesktop; | 60 | bool mPassiveSyncWithDesktop; |
61 | bool mPassiveSyncAutoStart; | 61 | bool mPassiveSyncAutoStart; |
62 | int mRingSyncAlgoPrefs; | 62 | int mRingSyncAlgoPrefs; |
63 | QString mLastSyncedLocalFile; | 63 | QString mLastSyncedLocalFile; |
64 | int mLastBackupDate; | ||
64 | 65 | ||
65 | 66 | ||
66 | protected: | 67 | protected: |
67 | virtual void setCategoryDefaults(); | 68 | virtual void setCategoryDefaults(); |
68 | 69 | ||
69 | 70 | ||
70 | 71 | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | #endif | 74 | #endif |