author | zautrix <zautrix> | 2005-04-20 10:43:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-20 10:43:07 (UTC) |
commit | f23afbb9c09b4ee0f00af8f04ee4458181792cd0 (patch) (unidiff) | |
tree | 807bcaf329d257ec2a0c5c6e3a6afc7ab53a6078 /libkdepim | |
parent | 03f7f26ad34f50dd86f335c7c5a25a292d642793 (diff) | |
download | kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.zip kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.tar.gz kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.tar.bz2 |
fixes
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 41 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.h | 4 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 7 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.h | 6 | ||||
-rw-r--r-- | libkdepim/kprefsdialog.cpp | 2 | ||||
-rw-r--r-- | libkdepim/kprefsdialog.h | 7 |
6 files changed, 60 insertions, 7 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 753d90a..fbfbc45 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,908 +1,947 @@ | |||
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 <qfile.h> | 39 | #include <qfile.h> |
39 | #include <qvbox.h> | 40 | #include <qvbox.h> |
40 | #include <qdir.h> | 41 | #include <qdir.h> |
41 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qspinbox.h> | ||
42 | 44 | ||
43 | #include <kdialog.h> | 45 | #include <kdialog.h> |
44 | #include <kprefsdialog.h> | 46 | #include <kprefsdialog.h> |
45 | #include <klocale.h> | 47 | #include <klocale.h> |
48 | #include <kglobalsettings.h> | ||
46 | #include <kdateedit.h> | 49 | #include <kdateedit.h> |
47 | #include <kglobal.h> | 50 | #include <kglobal.h> |
48 | #include <stdlib.h> | 51 | #include <stdlib.h> |
49 | 52 | ||
50 | /*US | 53 | /*US |
51 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
52 | #include <qframe.h> | 55 | #include <qframe.h> |
53 | #include <qpushbutton.h> | 56 | #include <qpushbutton.h> |
54 | #include <qcombobox.h> | 57 | #include <qcombobox.h> |
55 | #include <qlineedit.h> | 58 | #include <qlineedit.h> |
56 | #include <qlabel.h> | 59 | #include <qlabel.h> |
57 | #include <qfile.h> | 60 | #include <qfile.h> |
58 | 61 | ||
59 | #include <kconfig.h> | 62 | #include <kconfig.h> |
60 | #include <kdebug.h> | 63 | #include <kdebug.h> |
61 | #include <kdialog.h> | 64 | #include <kdialog.h> |
62 | #include <klistview.h> | 65 | #include <klistview.h> |
63 | #include <klocale.h> | 66 | #include <klocale.h> |
64 | #include <kglobal.h> | 67 | #include <kglobal.h> |
65 | #include <kmessagebox.h> | 68 | #include <kmessagebox.h> |
66 | #include <kstandarddirs.h> | 69 | #include <kstandarddirs.h> |
67 | 70 | ||
68 | #ifndef KAB_EMBEDDED | 71 | #ifndef KAB_EMBEDDED |
69 | #include <ktrader.h> | 72 | #include <ktrader.h> |
70 | #else // KAB_EMBEDDED | 73 | #else // KAB_EMBEDDED |
71 | #include <mergewidget.h> | 74 | #include <mergewidget.h> |
72 | #include <distributionlistwidget.h> | 75 | #include <distributionlistwidget.h> |
73 | #endif // KAB_EMBEDDED | 76 | #endif // KAB_EMBEDDED |
74 | 77 | ||
75 | #include "addresseewidget.h" | 78 | #include "addresseewidget.h" |
76 | #include "extensionconfigdialog.h" | 79 | #include "extensionconfigdialog.h" |
77 | #include "extensionwidget.h" | 80 | #include "extensionwidget.h" |
78 | */ | 81 | */ |
79 | 82 | ||
80 | #include "qapplication.h" | 83 | #include "qapplication.h" |
81 | 84 | ||
82 | #include "kpimglobalprefs.h" | 85 | #include "kpimglobalprefs.h" |
83 | 86 | ||
84 | #include "kdepimconfigwidget.h" | 87 | #include "kdepimconfigwidget.h" |
85 | #include <kprefs.h> | 88 | #include <kprefs.h> |
86 | #include <kmessagebox.h> | 89 | #include <kmessagebox.h> |
87 | 90 | ||
88 | 91 | ||
89 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 92 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
90 | : KPrefsWidget(prefs, parent, name ) | 93 | : KPrefsWidget(prefs, parent, name ) |
91 | { | 94 | { |
92 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 95 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
93 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 96 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
94 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 97 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
95 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 98 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
96 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 99 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
97 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 100 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
98 | 101 | ||
99 | 102 | ||
100 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 103 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
101 | KDialog::spacingHint() ); | 104 | KDialog::spacingHint() ); |
102 | 105 | ||
103 | tabWidget = new QTabWidget( this ); | 106 | tabWidget = new QTabWidget( this ); |
104 | topLayout->addWidget( tabWidget ); | 107 | topLayout->addWidget( tabWidget ); |
105 | 108 | ||
106 | 109 | ||
107 | setupLocaleTab(); | 110 | setupLocaleTab(); |
108 | setupLocaleDateTab(); | 111 | setupLocaleDateTab(); |
109 | setupTimeZoneTab(); | 112 | setupTimeZoneTab(); |
110 | setupExternalAppTab(); | 113 | setupExternalAppTab(); |
111 | setupStoreTab(); | 114 | setupStoreTab(); |
112 | 115 | setupBackupTab(); | |
113 | } | 116 | } |
114 | void KDEPIMConfigWidget::showTimeZoneTab() | 117 | void KDEPIMConfigWidget::showTimeZoneTab() |
115 | { | 118 | { |
116 | tabWidget->setCurrentPage ( 3 ) ; | 119 | tabWidget->setCurrentPage ( 3 ) ; |
117 | } | 120 | } |
121 | void KDEPIMConfigWidget::setupBackupTab() | ||
122 | { | ||
123 | QVBox *colorPage = new QVBox( this ); | ||
124 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); | ||
125 | QWidget* topFrame = new QWidget( colorPage ); | ||
126 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | ||
127 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), | ||
128 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); | ||
129 | topLayout->addWidget((QWidget*)sb->checkBox()); | ||
130 | QWidget* bupFrame = new QWidget( topFrame ); | ||
131 | topLayout->addWidget((bupFrame)); | ||
132 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); | ||
133 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); | ||
134 | sb = addWidBool(i18n("Use standard backup dir"), | ||
135 | &(KPimGlobalPrefs::instance()->mBackupEnabled),bupFrame); | ||
136 | bupLayout->addWidget((QWidget*)sb->checkBox()); | ||
137 | mBackupUrl = new KURLRequester( bupFrame ); | ||
138 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | ||
139 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); | ||
140 | bupLayout->addWidget( mBackupUrl ); | ||
141 | |||
142 | |||
143 | QHBox *dummy = new QHBox(bupFrame); | ||
144 | new QLabel(i18n("Number of Backups:"),dummy); | ||
145 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); | ||
146 | new QLabel(i18n(" "),dummy); | ||
147 | bupLayout->addWidget( dummy ); | ||
148 | |||
149 | dummy = new QHBox(bupFrame); | ||
150 | new QLabel(i18n("Make backup every "),dummy); | ||
151 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); | ||
152 | new QLabel(i18n(" days"),dummy); | ||
153 | new QLabel(i18n(" "),dummy); | ||
154 | bupLayout->addWidget( dummy ); | ||
155 | |||
156 | } | ||
118 | void KDEPIMConfigWidget::setupStoreTab() | 157 | void KDEPIMConfigWidget::setupStoreTab() |
119 | { | 158 | { |
120 | QVBox *colorPage = new QVBox( this ); | 159 | QVBox *colorPage = new QVBox( this ); |
121 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); | 160 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); |
122 | QWidget* cw = new QWidget( colorPage ); | 161 | QWidget* cw = new QWidget( colorPage ); |
123 | KPrefsWidColor *holidayColor = | 162 | KPrefsWidColor *holidayColor = |
124 | addWidColor(i18n("Alternating background of list views"), | 163 | addWidColor(i18n("Alternating background of list views"), |
125 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); | 164 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); |
126 | QHBoxLayout *topLayout = new QHBoxLayout(cw); | 165 | QHBoxLayout *topLayout = new QHBoxLayout(cw); |
127 | topLayout->addWidget(holidayColor->label()); | 166 | topLayout->addWidget(holidayColor->label()); |
128 | topLayout->addWidget( (QWidget* )holidayColor->button()); | 167 | topLayout->addWidget( (QWidget* )holidayColor->button()); |
129 | 168 | ||
130 | 169 | ||
131 | QVBox *storePage = new QVBox( this ); | 170 | QVBox *storePage = new QVBox( this ); |
132 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); | 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 ); |
133 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 172 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
134 | mStoreUrl = new KURLRequester( storePage ); | 173 | mStoreUrl = new KURLRequester( storePage ); |
135 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 174 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
136 | #ifdef DESKTOP_VERSION | 175 | #ifdef DESKTOP_VERSION |
137 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | 176 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; |
138 | QFileInfo fi ( confFile ); | 177 | QFileInfo fi ( confFile ); |
139 | if ( fi.exists() ) { | 178 | if ( fi.exists() ) { |
140 | KConfig cfg ( confFile ); | 179 | KConfig cfg ( confFile ); |
141 | cfg.setGroup("Global"); | 180 | cfg.setGroup("Global"); |
142 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); | 181 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); |
143 | if ( localKdeDir != "x_x_x" ) { | 182 | if ( localKdeDir != "x_x_x" ) { |
144 | mStoreUrl->setURL( localKdeDir ); | 183 | mStoreUrl->setURL( localKdeDir ); |
145 | qDebug("Reading config from %s ", confFile.latin1()); | 184 | qDebug("Reading config from %s ", confFile.latin1()); |
146 | } | 185 | } |
147 | } | 186 | } |
148 | 187 | ||
149 | #endif | 188 | #endif |
150 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 189 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
151 | QHBox *bb = new QHBox( storePage ); | 190 | QHBox *bb = new QHBox( storePage ); |
152 | QPushButton * pb; | 191 | QPushButton * pb; |
153 | if ( QApplication::desktop()->width() < 640 ) | 192 | if ( QApplication::desktop()->width() < 640 ) |
154 | pb = new QPushButton ( i18n("Save"), bb ); | 193 | pb = new QPushButton ( i18n("Save"), bb ); |
155 | else | 194 | else |
156 | pb = new QPushButton ( i18n("Save settings"), bb ); | 195 | pb = new QPushButton ( i18n("Save settings"), bb ); |
157 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 196 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
158 | pb = new QPushButton ( i18n("Save standard"), bb ); | 197 | pb = new QPushButton ( i18n("Save standard"), bb ); |
159 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 198 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
160 | #ifdef DESKTOP_VERSION | 199 | #ifdef DESKTOP_VERSION |
161 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); | 200 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); |
162 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); | 201 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); |
163 | #endif | 202 | #endif |
164 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 203 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
165 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 204 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
166 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 205 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
167 | } | 206 | } |
168 | void KDEPIMConfigWidget::setLocalStore() | 207 | void KDEPIMConfigWidget::setLocalStore() |
169 | { | 208 | { |
170 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); | 209 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); |
171 | saveStoreSettings(); | 210 | saveStoreSettings(); |
172 | QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); | 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."); |
173 | KMessageBox::information( this, message); | 212 | KMessageBox::information( this, message); |
174 | } | 213 | } |
175 | void KDEPIMConfigWidget::setStandardStore() | 214 | void KDEPIMConfigWidget::setStandardStore() |
176 | { | 215 | { |
177 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 216 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
178 | saveStoreSettings(); | 217 | saveStoreSettings(); |
179 | } | 218 | } |
180 | void KDEPIMConfigWidget::saveStoreSettings() | 219 | void KDEPIMConfigWidget::saveStoreSettings() |
181 | { | 220 | { |
182 | if ( !mStoreUrl->url().isEmpty() ) { | 221 | if ( !mStoreUrl->url().isEmpty() ) { |
183 | QString path = QDir::homeDirPath(); | 222 | QString path = QDir::homeDirPath(); |
184 | QString url = mStoreUrl->url(); | 223 | QString url = mStoreUrl->url(); |
185 | #ifdef DESKTOP_VERSION | 224 | #ifdef DESKTOP_VERSION |
186 | if ( url.startsWith( "LOCAL:" ) ) { | 225 | if ( url.startsWith( "LOCAL:" ) ) { |
187 | path = qApp->applicationDirPath () ; | 226 | path = qApp->applicationDirPath () ; |
188 | } | 227 | } |
189 | #endif | 228 | #endif |
190 | KConfig cfg ( path + "/.microkdehome" ); | 229 | KConfig cfg ( path + "/.microkdehome" ); |
191 | cfg.setGroup("Global"); | 230 | cfg.setGroup("Global"); |
192 | cfg.writeEntry( "MICROKDEHOME", url ); | 231 | cfg.writeEntry( "MICROKDEHOME", url ); |
193 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); | 232 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
194 | cfg.sync(); | 233 | cfg.sync(); |
195 | } else { | 234 | } else { |
196 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 235 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
197 | saveStoreSettings(); | 236 | saveStoreSettings(); |
198 | } | 237 | } |
199 | } | 238 | } |
200 | void KDEPIMConfigWidget::setupExternalAppTab() | 239 | void KDEPIMConfigWidget::setupExternalAppTab() |
201 | { | 240 | { |
202 | QWidget *externalAppsPage = new QWidget( this ); | 241 | QWidget *externalAppsPage = new QWidget( this ); |
203 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 242 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
204 | KDialog::spacingHintSmall() ); | 243 | KDialog::spacingHintSmall() ); |
205 | 244 | ||
206 | mExternalApps = new QComboBox( externalAppsPage ); | 245 | mExternalApps = new QComboBox( externalAppsPage ); |
207 | 246 | ||
208 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 247 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
209 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 248 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
210 | mExternalApps->insertItem( it.data(), it.key() ); | 249 | mExternalApps->insertItem( it.data(), it.key() ); |
211 | 250 | ||
212 | layout->addWidget( mExternalApps ); | 251 | layout->addWidget( mExternalApps ); |
213 | 252 | ||
214 | connect( mExternalApps, SIGNAL( activated( int ) ), | 253 | connect( mExternalApps, SIGNAL( activated( int ) ), |
215 | this, SLOT (externalapp_changed( int ) ) ); | 254 | this, SLOT (externalapp_changed( int ) ) ); |
216 | 255 | ||
217 | 256 | ||
218 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 257 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
219 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 258 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
220 | mExternalAppGroupBox->layout()->setMargin(4); | 259 | mExternalAppGroupBox->layout()->setMargin(4); |
221 | 260 | ||
222 | mClient = new QComboBox( mExternalAppGroupBox ); | 261 | mClient = new QComboBox( mExternalAppGroupBox ); |
223 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 262 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
224 | 263 | ||
225 | connect( mClient, SIGNAL( activated( int ) ), | 264 | connect( mClient, SIGNAL( activated( int ) ), |
226 | this, SLOT (client_changed( int ) ) ); | 265 | this, SLOT (client_changed( int ) ) ); |
227 | 266 | ||
228 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 267 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
229 | boxLayout->addWidget( lab, 1, 0 ); | 268 | boxLayout->addWidget( lab, 1, 0 ); |
230 | mChannel = new QLineEdit(mExternalAppGroupBox); | 269 | mChannel = new QLineEdit(mExternalAppGroupBox); |
231 | mChannel->setReadOnly(true); | 270 | mChannel->setReadOnly(true); |
232 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 271 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
233 | 272 | ||
234 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 273 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
235 | boxLayout->addWidget( lab, 3, 0 ); | 274 | boxLayout->addWidget( lab, 3, 0 ); |
236 | mMessage = new QLineEdit(mExternalAppGroupBox); | 275 | mMessage = new QLineEdit(mExternalAppGroupBox); |
237 | mMessage->setReadOnly(true); | 276 | mMessage->setReadOnly(true); |
238 | boxLayout->addWidget( mMessage , 4, 0); | 277 | boxLayout->addWidget( mMessage , 4, 0); |
239 | 278 | ||
240 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 279 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
241 | boxLayout->addWidget( lab, 3, 1 ); | 280 | boxLayout->addWidget( lab, 3, 1 ); |
242 | mParameters = new QLineEdit(mExternalAppGroupBox); | 281 | mParameters = new QLineEdit(mExternalAppGroupBox); |
243 | mParameters->setReadOnly(true); | 282 | mParameters->setReadOnly(true); |
244 | boxLayout->addWidget( mParameters, 4, 1 ); | 283 | boxLayout->addWidget( mParameters, 4, 1 ); |
245 | 284 | ||
246 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 285 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
247 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 286 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
248 | 287 | ||
249 | 288 | ||
250 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 289 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
251 | boxLayout->addWidget( lab, 6, 0 ); | 290 | boxLayout->addWidget( lab, 6, 0 ); |
252 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 291 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
253 | mMessage2->setReadOnly(true); | 292 | mMessage2->setReadOnly(true); |
254 | boxLayout->addWidget( mMessage2 , 7, 0); | 293 | boxLayout->addWidget( mMessage2 , 7, 0); |
255 | 294 | ||
256 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 295 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
257 | boxLayout->addWidget( lab, 6, 1 ); | 296 | boxLayout->addWidget( lab, 6, 1 ); |
258 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 297 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
259 | mParameters2->setReadOnly(true); | 298 | mParameters2->setReadOnly(true); |
260 | boxLayout->addWidget( mParameters2, 7, 1 ); | 299 | boxLayout->addWidget( mParameters2, 7, 1 ); |
261 | 300 | ||
262 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 301 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
263 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 302 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
264 | 303 | ||
265 | 304 | ||
266 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 305 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
267 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 306 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
268 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 307 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
269 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 308 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
270 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 309 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
271 | 310 | ||
272 | 311 | ||
273 | layout->addWidget( mExternalAppGroupBox ); | 312 | layout->addWidget( mExternalAppGroupBox ); |
274 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 313 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
275 | 314 | ||
276 | } | 315 | } |
277 | 316 | ||
278 | 317 | ||
279 | void KDEPIMConfigWidget::setupLocaleDateTab() | 318 | void KDEPIMConfigWidget::setupLocaleDateTab() |
280 | { | 319 | { |
281 | QWidget *topFrame = new QWidget( this ); | 320 | QWidget *topFrame = new QWidget( this ); |
282 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | 321 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); |
283 | 322 | ||
284 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 323 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
285 | topLayout->setMargin(KDialog::marginHintSmall()); | 324 | topLayout->setMargin(KDialog::marginHintSmall()); |
286 | int iii = 0; | 325 | int iii = 0; |
287 | 326 | ||
288 | 327 | ||
289 | KPrefsWidRadios *syncPrefsGroup = | 328 | KPrefsWidRadios *syncPrefsGroup = |
290 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | 329 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); |
291 | QString format; | 330 | QString format; |
292 | if ( QApplication::desktop()->width() < 480 ) | 331 | if ( QApplication::desktop()->width() < 480 ) |
293 | format = "(%d.%m.%Y)"; | 332 | format = "(%d.%m.%Y)"; |
294 | else | 333 | else |
295 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 334 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
296 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 335 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
297 | if ( QApplication::desktop()->width() < 480 ) | 336 | if ( QApplication::desktop()->width() < 480 ) |
298 | format = "(%m.%d.%Y)"; | 337 | format = "(%m.%d.%Y)"; |
299 | else | 338 | else |
300 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 339 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
301 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 340 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
302 | if ( QApplication::desktop()->width() < 480 ) | 341 | if ( QApplication::desktop()->width() < 480 ) |
303 | format = "(%Y-%m-%d)"; | 342 | format = "(%Y-%m-%d)"; |
304 | else | 343 | else |
305 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 344 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
306 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 345 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
307 | syncPrefsGroup->addRadio(i18n("User defined")); | 346 | syncPrefsGroup->addRadio(i18n("User defined")); |
308 | if ( QApplication::desktop()->width() < 480 ) { | 347 | if ( QApplication::desktop()->width() < 480 ) { |
309 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 348 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
310 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 349 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
311 | } | 350 | } |
312 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 351 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
313 | ++iii; | 352 | ++iii; |
314 | ++iii; | 353 | ++iii; |
315 | QLabel * lab; | 354 | QLabel * lab; |
316 | mUserDateFormatLong = new QLineEdit(topFrame); | 355 | mUserDateFormatLong = new QLineEdit(topFrame); |
317 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 356 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
318 | topLayout->addWidget(lab ,iii,0); | 357 | topLayout->addWidget(lab ,iii,0); |
319 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 358 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
320 | ++iii; | 359 | ++iii; |
321 | mUserDateFormatShort = new QLineEdit(topFrame); | 360 | mUserDateFormatShort = new QLineEdit(topFrame); |
322 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 361 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
323 | topLayout->addWidget(lab ,iii,0); | 362 | topLayout->addWidget(lab ,iii,0); |
324 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 363 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
325 | ++iii; | 364 | ++iii; |
326 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 365 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
327 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 366 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
328 | ++iii; | 367 | ++iii; |
329 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 368 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
330 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 369 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
331 | ++iii; | 370 | ++iii; |
332 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 371 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
333 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 372 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
334 | ++iii; | 373 | ++iii; |
335 | 374 | ||
336 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 375 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
337 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 376 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
338 | 377 | ||
339 | 378 | ||
340 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | 379 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); |
341 | } | 380 | } |
342 | 381 | ||
343 | void KDEPIMConfigWidget::setupLocaleTab() | 382 | void KDEPIMConfigWidget::setupLocaleTab() |
344 | { | 383 | { |
345 | 384 | ||
346 | QWidget *topFrame = new QWidget( this ); | 385 | QWidget *topFrame = new QWidget( this ); |
347 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 386 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
348 | 387 | ||
349 | topLayout->setSpacing(KDialog::spacingHint()); | 388 | topLayout->setSpacing(KDialog::spacingHint()); |
350 | topLayout->setMargin(KDialog::marginHint()); | 389 | topLayout->setMargin(KDialog::marginHint()); |
351 | int iii = 0; | 390 | int iii = 0; |
352 | KPrefsWidRadios *syncPrefsGroup = | 391 | KPrefsWidRadios *syncPrefsGroup = |
353 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | 392 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); |
354 | syncPrefsGroup->addRadio(i18n("English")); | 393 | syncPrefsGroup->addRadio(i18n("English")); |
355 | syncPrefsGroup->addRadio(i18n("German")); | 394 | syncPrefsGroup->addRadio(i18n("German")); |
356 | syncPrefsGroup->addRadio(i18n("French")); | 395 | syncPrefsGroup->addRadio(i18n("French")); |
357 | syncPrefsGroup->addRadio(i18n("Italian")); | 396 | syncPrefsGroup->addRadio(i18n("Italian")); |
358 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 397 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
359 | if ( QApplication::desktop()->width() < 300 ) { | 398 | if ( QApplication::desktop()->width() < 300 ) { |
360 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 399 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
361 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 400 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
362 | } | 401 | } |
363 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 402 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
364 | ++iii; | 403 | ++iii; |
365 | 404 | ||
366 | 405 | ||
367 | tabWidget->addTab( topFrame, i18n( "Language" ) ); | 406 | tabWidget->addTab( topFrame, i18n( "Language" ) ); |
368 | topFrame = new QWidget( this ); | 407 | topFrame = new QWidget( this ); |
369 | topLayout = new QGridLayout(topFrame,4,2); | 408 | topLayout = new QGridLayout(topFrame,4,2); |
370 | 409 | ||
371 | topLayout->setSpacing(KDialog::spacingHint()); | 410 | topLayout->setSpacing(KDialog::spacingHint()); |
372 | topLayout->setMargin(KDialog::marginHint()); | 411 | topLayout->setMargin(KDialog::marginHint()); |
373 | iii = 0; | 412 | iii = 0; |
374 | syncPrefsGroup = | 413 | syncPrefsGroup = |
375 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | 414 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); |
376 | if ( QApplication::desktop()->width() > 300 ) | 415 | if ( QApplication::desktop()->width() > 300 ) |
377 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 416 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
378 | syncPrefsGroup->addRadio(i18n("24:00")); | 417 | syncPrefsGroup->addRadio(i18n("24:00")); |
379 | syncPrefsGroup->addRadio(i18n("12:00am")); | 418 | syncPrefsGroup->addRadio(i18n("12:00am")); |
380 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 419 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
381 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 420 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
382 | ++iii; | 421 | ++iii; |
383 | 422 | ||
384 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | 423 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), |
385 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | 424 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); |
386 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 425 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
387 | ++iii; | 426 | ++iii; |
388 | 427 | ||
389 | 428 | ||
390 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); | 429 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); |
391 | 430 | ||
392 | } | 431 | } |
393 | 432 | ||
394 | 433 | ||
395 | void KDEPIMConfigWidget::setupTimeZoneTab() | 434 | void KDEPIMConfigWidget::setupTimeZoneTab() |
396 | { | 435 | { |
397 | QWidget *topFrame; | 436 | QWidget *topFrame; |
398 | QGridLayout *topLayout ; | 437 | QGridLayout *topLayout ; |
399 | 438 | ||
400 | 439 | ||
401 | 440 | ||
402 | 441 | ||
403 | 442 | ||
404 | 443 | ||
405 | topFrame = new QWidget( this ); | 444 | topFrame = new QWidget( this ); |
406 | topLayout = new QGridLayout( topFrame, 5, 2); | 445 | topLayout = new QGridLayout( topFrame, 5, 2); |
407 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 446 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
408 | topLayout->setMargin(KDialog::marginHintSmall()); | 447 | topLayout->setMargin(KDialog::marginHintSmall()); |
409 | 448 | ||
410 | QHBox *timeZoneBox = new QHBox( topFrame ); | 449 | QHBox *timeZoneBox = new QHBox( topFrame ); |
411 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 450 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
412 | 451 | ||
413 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 452 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
414 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 453 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
415 | if ( QApplication::desktop()->width() < 300 ) { | 454 | if ( QApplication::desktop()->width() < 300 ) { |
416 | mTimeZoneCombo->setMaximumWidth(150); | 455 | mTimeZoneCombo->setMaximumWidth(150); |
417 | } | 456 | } |
418 | 457 | ||
419 | QStringList list; | 458 | QStringList list; |
420 | list = KGlobal::locale()->timeZoneList(); | 459 | list = KGlobal::locale()->timeZoneList(); |
421 | mTimeZoneCombo->insertStringList(list); | 460 | mTimeZoneCombo->insertStringList(list); |
422 | 461 | ||
423 | // find the currently set time zone and select it | 462 | // find the currently set time zone and select it |
424 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | 463 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; |
425 | int nCurrentlySet = 11; | 464 | int nCurrentlySet = 11; |
426 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 465 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
427 | { | 466 | { |
428 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 467 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
429 | { | 468 | { |
430 | nCurrentlySet = i; | 469 | nCurrentlySet = i; |
431 | break; | 470 | break; |
432 | } | 471 | } |
433 | } | 472 | } |
434 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 473 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
435 | int iii = 1; | 474 | int iii = 1; |
436 | KPrefsWidBool *sb = | 475 | KPrefsWidBool *sb = |
437 | addWidBool(i18n("Add 30 min to selected Timezone"), | 476 | addWidBool(i18n("Add 30 min to selected Timezone"), |
438 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); | 477 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); |
439 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 478 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
440 | ++iii; | 479 | ++iii; |
441 | sb = | 480 | sb = |
442 | addWidBool(i18n("Timezone has daylight saving"), | 481 | addWidBool(i18n("Timezone has daylight saving"), |
443 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | 482 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); |
444 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 483 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
445 | ++iii; | 484 | ++iii; |
446 | QLabel* lab; | 485 | QLabel* lab; |
447 | 486 | ||
448 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 487 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
449 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 488 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
450 | ++iii; | 489 | ++iii; |
451 | 490 | ||
452 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 491 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
453 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 492 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
454 | ++iii; | 493 | ++iii; |
455 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 494 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
456 | topLayout->addWidget(lab, iii,0); | 495 | topLayout->addWidget(lab, iii,0); |
457 | mStartDateSavingEdit = new KDateEdit(topFrame); | 496 | mStartDateSavingEdit = new KDateEdit(topFrame); |
458 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 497 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
459 | ++iii; | 498 | ++iii; |
460 | 499 | ||
461 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 500 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
462 | topLayout->addWidget(lab, iii,0); | 501 | topLayout->addWidget(lab, iii,0); |
463 | mEndDateSavingEdit = new KDateEdit(topFrame); | 502 | mEndDateSavingEdit = new KDateEdit(topFrame); |
464 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 503 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
465 | ++iii; | 504 | ++iii; |
466 | QDate current ( 2001, 1,1); | 505 | QDate current ( 2001, 1,1); |
467 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | 506 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); |
468 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | 507 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); |
469 | 508 | ||
470 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 509 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
471 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 510 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
472 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | 511 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); |
473 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | 512 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); |
474 | 513 | ||
475 | 514 | ||
476 | topFrame = new QWidget( this ); | 515 | topFrame = new QWidget( this ); |
477 | topLayout = new QGridLayout( topFrame, 3, 2); | 516 | topLayout = new QGridLayout( topFrame, 3, 2); |
478 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 517 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
479 | topLayout->setMargin(KDialog::marginHintSmall()); | 518 | topLayout->setMargin(KDialog::marginHintSmall()); |
480 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); | 519 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); |
481 | 520 | ||
482 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); | 521 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); |
483 | topLayout->addMultiCellWidget(labb,0,0,0,2); | 522 | topLayout->addMultiCellWidget(labb,0,0,0,2); |
484 | int i = 1; | 523 | int i = 1; |
485 | KPrefsWidFont *timeLabelsFont = | 524 | KPrefsWidFont *timeLabelsFont = |
486 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), | 525 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), |
487 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); | 526 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); |
488 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 527 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
489 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 528 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
490 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 529 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
491 | } | 530 | } |
492 | 531 | ||
493 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 532 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
494 | { | 533 | { |
495 | // first store the current data | 534 | // first store the current data |
496 | saveEditFieldSettings(); | 535 | saveEditFieldSettings(); |
497 | 536 | ||
498 | // set mCurrentApp | 537 | // set mCurrentApp |
499 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 538 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
500 | 539 | ||
501 | // set mCurrentClient | 540 | // set mCurrentClient |
502 | switch(mCurrentApp) | 541 | switch(mCurrentApp) |
503 | { | 542 | { |
504 | case(ExternalAppHandler::EMAIL): | 543 | case(ExternalAppHandler::EMAIL): |
505 | mCurrentClient = mEmailClient; | 544 | mCurrentClient = mEmailClient; |
506 | break; | 545 | break; |
507 | case(ExternalAppHandler::PHONE): | 546 | case(ExternalAppHandler::PHONE): |
508 | mCurrentClient = mPhoneClient; | 547 | mCurrentClient = mPhoneClient; |
509 | break; | 548 | break; |
510 | case(ExternalAppHandler::SMS): | 549 | case(ExternalAppHandler::SMS): |
511 | mCurrentClient = mSMSClient; | 550 | mCurrentClient = mSMSClient; |
512 | break; | 551 | break; |
513 | case(ExternalAppHandler::FAX): | 552 | case(ExternalAppHandler::FAX): |
514 | mCurrentClient = mFaxClient; | 553 | mCurrentClient = mFaxClient; |
515 | break; | 554 | break; |
516 | case(ExternalAppHandler::PAGER): | 555 | case(ExternalAppHandler::PAGER): |
517 | mCurrentClient = mPagerClient; | 556 | mCurrentClient = mPagerClient; |
518 | break; | 557 | break; |
519 | case(ExternalAppHandler::SIP): | 558 | case(ExternalAppHandler::SIP): |
520 | mCurrentClient = mSipClient; | 559 | mCurrentClient = mSipClient; |
521 | break; | 560 | break; |
522 | default: | 561 | default: |
523 | return; | 562 | return; |
524 | } | 563 | } |
525 | 564 | ||
526 | // and at last update the widgets | 565 | // and at last update the widgets |
527 | updateClientWidgets(); | 566 | updateClientWidgets(); |
528 | } | 567 | } |
529 | 568 | ||
530 | 569 | ||
531 | 570 | ||
532 | void KDEPIMConfigWidget::client_changed( int newClient ) | 571 | void KDEPIMConfigWidget::client_changed( int newClient ) |
533 | { | 572 | { |
534 | if (newClient == mCurrentClient) | 573 | if (newClient == mCurrentClient) |
535 | return; | 574 | return; |
536 | 575 | ||
537 | // first store the current data | 576 | // first store the current data |
538 | saveEditFieldSettings(); | 577 | saveEditFieldSettings(); |
539 | 578 | ||
540 | 579 | ||
541 | //then reset the clientvariable | 580 | //then reset the clientvariable |
542 | mCurrentClient = newClient; | 581 | mCurrentClient = newClient; |
543 | 582 | ||
544 | // and at last update the widgets | 583 | // and at last update the widgets |
545 | updateClientWidgets(); | 584 | updateClientWidgets(); |
546 | 585 | ||
547 | KPrefsWidget::modified(); | 586 | KPrefsWidget::modified(); |
548 | } | 587 | } |
549 | 588 | ||
550 | void KDEPIMConfigWidget::saveEditFieldSettings() | 589 | void KDEPIMConfigWidget::saveEditFieldSettings() |
551 | { | 590 | { |
552 | 591 | ||
553 | switch(mCurrentApp) | 592 | switch(mCurrentApp) |
554 | { | 593 | { |
555 | case(ExternalAppHandler::EMAIL): | 594 | case(ExternalAppHandler::EMAIL): |
556 | mEmailClient = mClient->currentItem(); | 595 | mEmailClient = mClient->currentItem(); |
557 | break; | 596 | break; |
558 | case(ExternalAppHandler::PHONE): | 597 | case(ExternalAppHandler::PHONE): |
559 | mPhoneClient= mClient->currentItem(); | 598 | mPhoneClient= mClient->currentItem(); |
560 | break; | 599 | break; |
561 | case(ExternalAppHandler::SMS): | 600 | case(ExternalAppHandler::SMS): |
562 | mSMSClient = mClient->currentItem(); | 601 | mSMSClient = mClient->currentItem(); |
563 | break; | 602 | break; |
564 | case(ExternalAppHandler::FAX): | 603 | case(ExternalAppHandler::FAX): |
565 | mFaxClient = mClient->currentItem(); | 604 | mFaxClient = mClient->currentItem(); |
566 | break; | 605 | break; |
567 | case(ExternalAppHandler::PAGER): | 606 | case(ExternalAppHandler::PAGER): |
568 | mPagerClient = mClient->currentItem(); | 607 | mPagerClient = mClient->currentItem(); |
569 | break; | 608 | break; |
570 | case(ExternalAppHandler::SIP): | 609 | case(ExternalAppHandler::SIP): |
571 | mSipClient = mClient->currentItem(); | 610 | mSipClient = mClient->currentItem(); |
572 | break; | 611 | break; |
573 | default: | 612 | default: |
574 | return; | 613 | return; |
575 | } | 614 | } |
576 | 615 | ||
577 | //store the current data back to the apropriate membervariables if we had set it to "other" | 616 | //store the current data back to the apropriate membervariables if we had set it to "other" |
578 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 617 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
579 | { | 618 | { |
580 | mEmailOtherChannel = mChannel->text(); | 619 | mEmailOtherChannel = mChannel->text(); |
581 | mEmailOtherMessage = mMessage->text(); | 620 | mEmailOtherMessage = mMessage->text(); |
582 | mEmailOtherMessageParameters = mParameters->text(); | 621 | mEmailOtherMessageParameters = mParameters->text(); |
583 | mEmailOtherMessage2 = mMessage2->text(); | 622 | mEmailOtherMessage2 = mMessage2->text(); |
584 | mEmailOtherMessageParameters2 = mParameters2->text(); | 623 | mEmailOtherMessageParameters2 = mParameters2->text(); |
585 | } | 624 | } |
586 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 625 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
587 | { | 626 | { |
588 | mPhoneOtherChannel = mChannel->text(); | 627 | mPhoneOtherChannel = mChannel->text(); |
589 | mPhoneOtherMessage = mMessage->text(); | 628 | mPhoneOtherMessage = mMessage->text(); |
590 | mPhoneOtherMessageParameters = mParameters->text(); | 629 | mPhoneOtherMessageParameters = mParameters->text(); |
591 | } | 630 | } |
592 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 631 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
593 | { | 632 | { |
594 | mSMSOtherChannel = mChannel->text(); | 633 | mSMSOtherChannel = mChannel->text(); |
595 | mSMSOtherMessage = mMessage->text(); | 634 | mSMSOtherMessage = mMessage->text(); |
596 | mSMSOtherMessageParameters = mParameters->text(); | 635 | mSMSOtherMessageParameters = mParameters->text(); |
597 | } | 636 | } |
598 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 637 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
599 | { | 638 | { |
600 | mFaxOtherChannel = mChannel->text(); | 639 | mFaxOtherChannel = mChannel->text(); |
601 | mFaxOtherMessage = mMessage->text(); | 640 | mFaxOtherMessage = mMessage->text(); |
602 | mFaxOtherMessageParameters = mParameters->text(); | 641 | mFaxOtherMessageParameters = mParameters->text(); |
603 | } | 642 | } |
604 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 643 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
605 | { | 644 | { |
606 | mPagerOtherChannel = mChannel->text(); | 645 | mPagerOtherChannel = mChannel->text(); |
607 | mPagerOtherMessage = mMessage->text(); | 646 | mPagerOtherMessage = mMessage->text(); |
608 | mPagerOtherMessageParameters = mParameters->text(); | 647 | mPagerOtherMessageParameters = mParameters->text(); |
609 | } | 648 | } |
610 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 649 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
611 | { | 650 | { |
612 | mSipOtherChannel = mChannel->text(); | 651 | mSipOtherChannel = mChannel->text(); |
613 | mSipOtherMessage = mMessage->text(); | 652 | mSipOtherMessage = mMessage->text(); |
614 | mSipOtherMessageParameters = mParameters->text(); | 653 | mSipOtherMessageParameters = mParameters->text(); |
615 | } | 654 | } |
616 | 655 | ||
617 | 656 | ||
618 | } | 657 | } |
619 | 658 | ||
620 | void KDEPIMConfigWidget::updateClientWidgets() | 659 | void KDEPIMConfigWidget::updateClientWidgets() |
621 | { | 660 | { |
622 | bool blocked = signalsBlocked(); | 661 | bool blocked = signalsBlocked(); |
623 | blockSignals( true ); | 662 | blockSignals( true ); |
624 | 663 | ||
625 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 664 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
626 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 665 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
627 | if (it == mExternalAppsMap.end()) | 666 | if (it == mExternalAppsMap.end()) |
628 | return; | 667 | return; |
629 | 668 | ||
630 | // update group box | 669 | // update group box |
631 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 670 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
632 | 671 | ||
633 | //update the entries in the client combobox | 672 | //update the entries in the client combobox |
634 | mClient->clear(); | 673 | mClient->clear(); |
635 | 674 | ||
636 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 675 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
637 | DefaultAppItem* dai; | 676 | DefaultAppItem* dai; |
638 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 677 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
639 | { | 678 | { |
640 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 679 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
641 | 680 | ||
642 | if (dai->_id == mCurrentClient) | 681 | if (dai->_id == mCurrentClient) |
643 | { | 682 | { |
644 | //restore the edit fields with the data of the local membervariables if we had set it to "other". | 683 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
645 | //Otherwise take the default data from externalapphandler. | 684 | //Otherwise take the default data from externalapphandler. |
646 | mChannel->setText(dai->_channel); | 685 | mChannel->setText(dai->_channel); |
647 | mMessage->setText(dai->_message); | 686 | mMessage->setText(dai->_message); |
648 | mParameters->setText(dai->_parameters); | 687 | mParameters->setText(dai->_parameters); |
649 | mMessage2->setText(dai->_message2); | 688 | mMessage2->setText(dai->_message2); |
650 | mParameters2->setText(dai->_parameters2); | 689 | mParameters2->setText(dai->_parameters2); |
651 | 690 | ||
652 | 691 | ||
653 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 692 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
654 | { | 693 | { |
655 | mChannel->setText(mEmailOtherChannel); | 694 | mChannel->setText(mEmailOtherChannel); |
656 | mMessage->setText(mEmailOtherMessage); | 695 | mMessage->setText(mEmailOtherMessage); |
657 | mParameters->setText(mEmailOtherMessageParameters); | 696 | mParameters->setText(mEmailOtherMessageParameters); |
658 | mMessage2->setText(mEmailOtherMessage2); | 697 | mMessage2->setText(mEmailOtherMessage2); |
659 | mParameters2->setText(mEmailOtherMessageParameters2); | 698 | mParameters2->setText(mEmailOtherMessageParameters2); |
660 | } | 699 | } |
661 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 700 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
662 | { | 701 | { |
663 | mChannel->setText(mPhoneOtherChannel); | 702 | mChannel->setText(mPhoneOtherChannel); |
664 | mMessage->setText(mPhoneOtherMessage); | 703 | mMessage->setText(mPhoneOtherMessage); |
665 | mParameters->setText(mPhoneOtherMessageParameters); | 704 | mParameters->setText(mPhoneOtherMessageParameters); |
666 | } | 705 | } |
667 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 706 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
668 | { | 707 | { |
669 | mChannel->setText(mSMSOtherChannel); | 708 | mChannel->setText(mSMSOtherChannel); |
670 | mMessage->setText(mSMSOtherMessage); | 709 | mMessage->setText(mSMSOtherMessage); |
671 | mParameters->setText(mSMSOtherMessageParameters); | 710 | mParameters->setText(mSMSOtherMessageParameters); |
672 | } | 711 | } |
673 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 712 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
674 | { | 713 | { |
675 | mChannel->setText(mFaxOtherChannel); | 714 | mChannel->setText(mFaxOtherChannel); |
676 | mMessage->setText(mFaxOtherMessage); | 715 | mMessage->setText(mFaxOtherMessage); |
677 | mParameters->setText(mFaxOtherMessageParameters); | 716 | mParameters->setText(mFaxOtherMessageParameters); |
678 | } | 717 | } |
679 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 718 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
680 | { | 719 | { |
681 | mChannel->setText(mPagerOtherChannel); | 720 | mChannel->setText(mPagerOtherChannel); |
682 | mMessage->setText(mPagerOtherMessage); | 721 | mMessage->setText(mPagerOtherMessage); |
683 | mParameters->setText(mPagerOtherMessageParameters); | 722 | mParameters->setText(mPagerOtherMessageParameters); |
684 | } | 723 | } |
685 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 724 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
686 | { | 725 | { |
687 | mChannel->setText(mSipOtherChannel); | 726 | mChannel->setText(mSipOtherChannel); |
688 | mMessage->setText(mSipOtherMessage); | 727 | mMessage->setText(mSipOtherMessage); |
689 | mParameters->setText(mSipOtherMessageParameters); | 728 | mParameters->setText(mSipOtherMessageParameters); |
690 | } | 729 | } |
691 | } | 730 | } |
692 | 731 | ||
693 | } | 732 | } |
694 | 733 | ||
695 | bool readonly; | 734 | bool readonly; |
696 | bool enabled; | 735 | bool enabled; |
697 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 736 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
698 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 737 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
699 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 738 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
700 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 739 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
701 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 740 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
702 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) | 741 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) |
703 | { | 742 | { |
704 | readonly = false; | 743 | readonly = false; |
705 | } | 744 | } |
706 | else | 745 | else |
707 | { | 746 | { |
708 | readonly = true; | 747 | readonly = true; |
709 | } | 748 | } |
710 | 749 | ||
711 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) | 750 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) |
712 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) | 751 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) |
713 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) | 752 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) |
714 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) | 753 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) |
715 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) | 754 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) |
716 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) | 755 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) |
717 | { | 756 | { |
718 | enabled = false; | 757 | enabled = false; |
719 | } | 758 | } |
720 | else | 759 | else |
721 | { | 760 | { |
722 | enabled = true; | 761 | enabled = true; |
723 | } | 762 | } |
724 | 763 | ||
725 | 764 | ||
726 | mChannel->setReadOnly(readonly); | 765 | mChannel->setReadOnly(readonly); |
727 | mMessage->setReadOnly(readonly); | 766 | mMessage->setReadOnly(readonly); |
728 | mParameters->setReadOnly(readonly); | 767 | mParameters->setReadOnly(readonly); |
729 | mMessage2->setReadOnly(readonly); | 768 | mMessage2->setReadOnly(readonly); |
730 | mParameters2->setReadOnly(readonly); | 769 | mParameters2->setReadOnly(readonly); |
731 | 770 | ||
732 | mChannel->setEnabled(enabled); | 771 | mChannel->setEnabled(enabled); |
733 | mMessage->setEnabled(enabled); | 772 | mMessage->setEnabled(enabled); |
734 | mParameters->setEnabled(enabled); | 773 | mParameters->setEnabled(enabled); |
735 | mMessage2->setEnabled(enabled); | 774 | mMessage2->setEnabled(enabled); |
736 | mParameters2->setEnabled(enabled); | 775 | mParameters2->setEnabled(enabled); |
737 | 776 | ||
738 | 777 | ||
739 | 778 | ||
740 | mClient->setCurrentItem(mCurrentClient); | 779 | mClient->setCurrentItem(mCurrentClient); |
741 | 780 | ||
742 | 781 | ||
743 | // enable/disable the extra message/parameter field | 782 | // enable/disable the extra message/parameter field |
744 | if (mCurrentApp == ExternalAppHandler::EMAIL) | 783 | if (mCurrentApp == ExternalAppHandler::EMAIL) |
745 | { | 784 | { |
746 | } | 785 | } |
747 | else | 786 | else |
748 | { | 787 | { |
749 | mMessage2->setText( "" ); | 788 | mMessage2->setText( "" ); |
750 | mParameters2->setText( "" ); | 789 | mParameters2->setText( "" ); |
751 | } | 790 | } |
752 | 791 | ||
753 | if (enabled == true) { | 792 | if (enabled == true) { |
754 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 793 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
755 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 794 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
756 | } | 795 | } |
757 | 796 | ||
758 | 797 | ||
759 | blockSignals( blocked ); | 798 | blockSignals( blocked ); |
760 | 799 | ||
761 | } | 800 | } |
762 | 801 | ||
763 | void KDEPIMConfigWidget::usrReadConfig() | 802 | void KDEPIMConfigWidget::usrReadConfig() |
764 | { | 803 | { |
765 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 804 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
766 | 805 | ||
767 | bool blocked = signalsBlocked(); | 806 | bool blocked = signalsBlocked(); |
768 | blockSignals( true ); | 807 | blockSignals( true ); |
769 | 808 | ||
770 | QString dummy = prefs->mUserDateFormatLong; | 809 | QString dummy = prefs->mUserDateFormatLong; |
771 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 810 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
772 | dummy = prefs->mUserDateFormatShort; | 811 | dummy = prefs->mUserDateFormatShort; |
773 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 812 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
774 | 813 | ||
775 | QDate current ( 2001, 1,1); | 814 | QDate current ( 2001, 1,1); |
776 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); | 815 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); |
777 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); | 816 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); |
778 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); | 817 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); |
779 | 818 | ||
780 | 819 | ||
781 | 820 | ||
782 | 821 | ||
783 | mEmailClient = prefs->mEmailClient; | 822 | mEmailClient = prefs->mEmailClient; |
784 | mEmailOtherChannel = prefs->mEmailOtherChannel; | 823 | mEmailOtherChannel = prefs->mEmailOtherChannel; |
785 | mEmailOtherMessage = prefs->mEmailOtherMessage; | 824 | mEmailOtherMessage = prefs->mEmailOtherMessage; |
786 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; | 825 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; |
787 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; | 826 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; |
788 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; | 827 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; |
789 | 828 | ||
790 | mPhoneClient = prefs->mPhoneClient; | 829 | mPhoneClient = prefs->mPhoneClient; |
791 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; | 830 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; |
792 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; | 831 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; |
793 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; | 832 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; |
794 | 833 | ||
795 | mFaxClient = prefs->mFaxClient; | 834 | mFaxClient = prefs->mFaxClient; |
796 | mFaxOtherChannel = prefs->mFaxOtherChannel; | 835 | mFaxOtherChannel = prefs->mFaxOtherChannel; |
797 | mFaxOtherMessage = prefs->mFaxOtherMessage; | 836 | mFaxOtherMessage = prefs->mFaxOtherMessage; |
798 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; | 837 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; |
799 | 838 | ||
800 | mSMSClient = prefs->mSMSClient; | 839 | mSMSClient = prefs->mSMSClient; |
801 | mSMSOtherChannel = prefs->mSMSOtherChannel; | 840 | mSMSOtherChannel = prefs->mSMSOtherChannel; |
802 | mSMSOtherMessage = prefs->mSMSOtherMessage; | 841 | mSMSOtherMessage = prefs->mSMSOtherMessage; |
803 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; | 842 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; |
804 | 843 | ||
805 | mPagerClient = prefs->mPagerClient; | 844 | mPagerClient = prefs->mPagerClient; |
806 | mPagerOtherChannel = prefs->mPagerOtherChannel; | 845 | mPagerOtherChannel = prefs->mPagerOtherChannel; |
807 | mPagerOtherMessage = prefs->mPagerOtherMessage; | 846 | mPagerOtherMessage = prefs->mPagerOtherMessage; |
808 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; | 847 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; |
809 | 848 | ||
810 | mSipClient = prefs->mSipClient; | 849 | mSipClient = prefs->mSipClient; |
811 | mSipOtherChannel = prefs->mSipOtherChannel; | 850 | mSipOtherChannel = prefs->mSipOtherChannel; |
812 | mSipOtherMessage = prefs->mSipOtherMessage; | 851 | mSipOtherMessage = prefs->mSipOtherMessage; |
813 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; | 852 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; |
814 | 853 | ||
815 | mCurrentApp = ExternalAppHandler::EMAIL; | 854 | mCurrentApp = ExternalAppHandler::EMAIL; |
816 | mCurrentClient = mEmailClient; | 855 | mCurrentClient = mEmailClient; |
817 | 856 | ||
818 | updateClientWidgets(); | 857 | updateClientWidgets(); |
819 | 858 | ||
820 | blockSignals( blocked ); | 859 | blockSignals( blocked ); |
821 | 860 | ||
822 | } | 861 | } |
823 | 862 | ||
824 | void KDEPIMConfigWidget::usrWriteConfig() | 863 | void KDEPIMConfigWidget::usrWriteConfig() |
825 | { | 864 | { |
826 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 865 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
827 | 866 | ||
828 | saveEditFieldSettings(); | 867 | saveEditFieldSettings(); |
829 | 868 | ||
830 | 869 | ||
831 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 870 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
832 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 871 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
833 | 872 | ||
834 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); | 873 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); |
835 | QDate date; | 874 | QDate date; |
836 | date = mStartDateSavingEdit->date(); | 875 | date = mStartDateSavingEdit->date(); |
837 | int sub = 0; | 876 | int sub = 0; |
838 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 877 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
839 | sub = 1; | 878 | sub = 1; |
840 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; | 879 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; |
841 | date = mEndDateSavingEdit->date(); | 880 | date = mEndDateSavingEdit->date(); |
842 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 881 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
843 | sub = 1; | 882 | sub = 1; |
844 | else | 883 | else |
845 | sub = 0; | 884 | sub = 0; |
846 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; | 885 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; |
847 | 886 | ||
848 | 887 | ||
849 | prefs->mEmailClient = mEmailClient; | 888 | prefs->mEmailClient = mEmailClient; |
850 | prefs->mEmailOtherChannel = mEmailOtherChannel; | 889 | prefs->mEmailOtherChannel = mEmailOtherChannel; |
851 | prefs->mEmailOtherMessage = mEmailOtherMessage; | 890 | prefs->mEmailOtherMessage = mEmailOtherMessage; |
852 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; | 891 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; |
853 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; | 892 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; |
854 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; | 893 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; |
855 | 894 | ||
856 | prefs->mPhoneClient = mPhoneClient; | 895 | prefs->mPhoneClient = mPhoneClient; |
857 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; | 896 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; |
858 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; | 897 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; |
859 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; | 898 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; |
860 | 899 | ||
861 | prefs->mFaxClient = mFaxClient; | 900 | prefs->mFaxClient = mFaxClient; |
862 | prefs->mFaxOtherChannel = mFaxOtherChannel; | 901 | prefs->mFaxOtherChannel = mFaxOtherChannel; |
863 | prefs->mFaxOtherMessage = mFaxOtherMessage; | 902 | prefs->mFaxOtherMessage = mFaxOtherMessage; |
864 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; | 903 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; |
865 | 904 | ||
866 | prefs->mSMSClient = mSMSClient; | 905 | prefs->mSMSClient = mSMSClient; |
867 | prefs->mSMSOtherChannel = mSMSOtherChannel; | 906 | prefs->mSMSOtherChannel = mSMSOtherChannel; |
868 | prefs->mSMSOtherMessage = mSMSOtherMessage; | 907 | prefs->mSMSOtherMessage = mSMSOtherMessage; |
869 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; | 908 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; |
870 | 909 | ||
871 | prefs->mPagerClient = mPagerClient; | 910 | prefs->mPagerClient = mPagerClient; |
872 | prefs->mPagerOtherChannel = mPagerOtherChannel; | 911 | prefs->mPagerOtherChannel = mPagerOtherChannel; |
873 | prefs->mPagerOtherMessage = mPagerOtherMessage; | 912 | prefs->mPagerOtherMessage = mPagerOtherMessage; |
874 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; | 913 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; |
875 | 914 | ||
876 | 915 | ||
877 | prefs->mSipClient = mSipClient; | 916 | prefs->mSipClient = mSipClient; |
878 | prefs->mSipOtherChannel = mSipOtherChannel; | 917 | prefs->mSipOtherChannel = mSipOtherChannel; |
879 | prefs->mSipOtherMessage = mSipOtherMessage; | 918 | prefs->mSipOtherMessage = mSipOtherMessage; |
880 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; | 919 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; |
881 | 920 | ||
882 | //release the cache that other views can access the changed values instantanious | 921 | //release the cache that other views can access the changed values instantanious |
883 | ExternalAppHandler::instance()->loadConfig(); | 922 | ExternalAppHandler::instance()->loadConfig(); |
884 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 923 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
885 | } | 924 | } |
886 | 925 | ||
887 | 926 | ||
888 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, | 927 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, |
889 | const QStringList *tags) | 928 | const QStringList *tags) |
890 | { | 929 | { |
891 | if (tags) { | 930 | if (tags) { |
892 | int i = tags->findIndex(text); | 931 | int i = tags->findIndex(text); |
893 | if (i > 0) combo->setCurrentItem(i); | 932 | if (i > 0) combo->setCurrentItem(i); |
894 | } else { | 933 | } else { |
895 | for(int i=0;i<combo->count();++i) { | 934 | for(int i=0;i<combo->count();++i) { |
896 | if (combo->text(i) == text) { | 935 | if (combo->text(i) == text) { |
897 | combo->setCurrentItem(i); | 936 | combo->setCurrentItem(i); |
898 | break; | 937 | break; |
899 | } | 938 | } |
900 | } | 939 | } |
901 | } | 940 | } |
902 | } | 941 | } |
903 | 942 | ||
904 | 943 | ||
905 | void KDEPIMConfigWidget::textChanged( const QString& text ) | 944 | void KDEPIMConfigWidget::textChanged( const QString& text ) |
906 | { | 945 | { |
907 | emit changed( true ); | 946 | emit changed( true ); |
908 | } | 947 | } |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h index 984e4e0..c0b92a9 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.h +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h | |||
@@ -1,161 +1,163 @@ | |||
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 | #ifndef KDEPIMCONFIGWIDGET_H | 31 | #ifndef KDEPIMCONFIGWIDGET_H |
32 | #define KDEPIMCONFIGWIDGET_H | 32 | #define KDEPIMCONFIGWIDGET_H |
33 | 33 | ||
34 | #include <kprefswidget.h> | 34 | #include <kprefswidget.h> |
35 | #include <kio/kfile/kurlrequester.h> | 35 | #include <kio/kfile/kurlrequester.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | 37 | ||
38 | #include "externalapphandler.h" | 38 | #include "externalapphandler.h" |
39 | 39 | ||
40 | 40 | ||
41 | class QComboBox; | 41 | class QComboBox; |
42 | class QLineEdit; | 42 | class QLineEdit; |
43 | class KPimGlobalPrefs; | 43 | class KPimGlobalPrefs; |
44 | class QGroupBox; | 44 | class QGroupBox; |
45 | class QTabWidget; | 45 | class QTabWidget; |
46 | class KDateEdit; | 46 | class KDateEdit; |
47 | 47 | ||
48 | class KDEPIMConfigWidget : public KPrefsWidget | 48 | class KDEPIMConfigWidget : public KPrefsWidget |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 ); | 53 | KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 ); |
54 | 54 | ||
55 | public slots: | 55 | public slots: |
56 | void textChanged( const QString& text ); | 56 | void textChanged( const QString& text ); |
57 | void showTimeZoneTab(); | 57 | void showTimeZoneTab(); |
58 | 58 | ||
59 | protected: | 59 | protected: |
60 | /** Implement this to read custom configuration widgets. */ | 60 | /** Implement this to read custom configuration widgets. */ |
61 | virtual void usrReadConfig(); | 61 | virtual void usrReadConfig(); |
62 | /** Implement this to write custom configuration widgets. */ | 62 | /** Implement this to write custom configuration widgets. */ |
63 | virtual void usrWriteConfig(); | 63 | virtual void usrWriteConfig(); |
64 | 64 | ||
65 | 65 | ||
66 | private slots: | 66 | private slots: |
67 | // void configureExtension(); | 67 | // void configureExtension(); |
68 | // void selectionChanged( QListViewItem* ); | 68 | // void selectionChanged( QListViewItem* ); |
69 | // void itemClicked( QListViewItem* ); | 69 | // void itemClicked( QListViewItem* ); |
70 | void client_changed( int newClient ); | 70 | void client_changed( int newClient ); |
71 | void externalapp_changed( int newApp ); | 71 | void externalapp_changed( int newApp ); |
72 | void saveStoreSettings(); | 72 | void saveStoreSettings(); |
73 | void setStandardStore(); | 73 | void setStandardStore(); |
74 | void setLocalStore(); | 74 | void setLocalStore(); |
75 | 75 | ||
76 | private: | 76 | private: |
77 | void setupExternalAppTab(); | 77 | void setupExternalAppTab(); |
78 | void setupLocaleDateTab(); | 78 | void setupLocaleDateTab(); |
79 | void setupLocaleTab(); | 79 | void setupLocaleTab(); |
80 | void setupTimeZoneTab(); | 80 | void setupTimeZoneTab(); |
81 | void setupStoreTab(); | 81 | void setupStoreTab(); |
82 | void setupBackupTab(); | ||
82 | KURLRequester* mStoreUrl; | 83 | KURLRequester* mStoreUrl; |
83 | 84 | ||
84 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | 85 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); |
85 | 86 | ||
86 | 87 | ||
87 | void saveEditFieldSettings(); | 88 | void saveEditFieldSettings(); |
88 | void updateClientWidgets(); | 89 | void updateClientWidgets(); |
89 | 90 | ||
90 | QTabWidget *tabWidget; | 91 | QTabWidget *tabWidget; |
91 | 92 | ||
92 | 93 | ||
93 | QLineEdit* mUserDateFormatShort; | 94 | QLineEdit* mUserDateFormatShort; |
94 | QLineEdit* mUserDateFormatLong; | 95 | QLineEdit* mUserDateFormatLong; |
95 | QComboBox* mTimeZoneCombo; | 96 | QComboBox* mTimeZoneCombo; |
96 | KDateEdit* mStartDateSavingEdit; | 97 | KDateEdit* mStartDateSavingEdit; |
97 | KDateEdit* mEndDateSavingEdit; | 98 | KDateEdit* mEndDateSavingEdit; |
98 | 99 | ||
99 | // void restoreExtensionSettings(); | 100 | // void restoreExtensionSettings(); |
100 | // void saveExtensionSettings(); | 101 | // void saveExtensionSettings(); |
101 | 102 | ||
102 | // KListView *mExtensionView; | 103 | // KListView *mExtensionView; |
103 | 104 | ||
104 | // QCheckBox *mNameParsing; | 105 | // QCheckBox *mNameParsing; |
105 | // QCheckBox *mViewsSingleClickBox; | 106 | // QCheckBox *mViewsSingleClickBox; |
106 | // QPushButton *mConfigureButton; | 107 | // QPushButton *mConfigureButton; |
107 | QComboBox* mExternalApps; | 108 | QComboBox* mExternalApps; |
108 | QGroupBox* mExternalAppGroupBox; | 109 | QGroupBox* mExternalAppGroupBox; |
109 | 110 | ||
110 | 111 | ||
111 | QComboBox* mClient; | 112 | QComboBox* mClient; |
112 | QLineEdit* mChannel; | 113 | QLineEdit* mChannel; |
113 | QLineEdit* mMessage; | 114 | QLineEdit* mMessage; |
114 | QLineEdit* mParameters; | 115 | QLineEdit* mParameters; |
115 | QLineEdit* mMessage2; | 116 | QLineEdit* mMessage2; |
116 | QLineEdit* mParameters2; | 117 | QLineEdit* mParameters2; |
117 | 118 | ||
118 | ExternalAppHandler::Types mCurrentApp; | 119 | ExternalAppHandler::Types mCurrentApp; |
119 | int mCurrentClient; | 120 | int mCurrentClient; |
120 | 121 | ||
121 | 122 | ||
122 | int mEmailClient; | 123 | int mEmailClient; |
123 | QString mEmailOtherChannel; | 124 | QString mEmailOtherChannel; |
124 | QString mEmailOtherMessage; | 125 | QString mEmailOtherMessage; |
125 | QString mEmailOtherMessageParameters; | 126 | QString mEmailOtherMessageParameters; |
126 | QString mEmailOtherMessage2; | 127 | QString mEmailOtherMessage2; |
127 | QString mEmailOtherMessageParameters2; | 128 | QString mEmailOtherMessageParameters2; |
128 | 129 | ||
129 | int mPhoneClient; | 130 | int mPhoneClient; |
130 | QString mPhoneOtherChannel; | 131 | QString mPhoneOtherChannel; |
131 | QString mPhoneOtherMessage; | 132 | QString mPhoneOtherMessage; |
132 | QString mPhoneOtherMessageParameters; | 133 | QString mPhoneOtherMessageParameters; |
133 | 134 | ||
134 | int mFaxClient; | 135 | int mFaxClient; |
135 | QString mFaxOtherChannel; | 136 | QString mFaxOtherChannel; |
136 | QString mFaxOtherMessage; | 137 | QString mFaxOtherMessage; |
137 | QString mFaxOtherMessageParameters; | 138 | QString mFaxOtherMessageParameters; |
138 | 139 | ||
139 | int mSMSClient; | 140 | int mSMSClient; |
140 | QString mSMSOtherChannel; | 141 | QString mSMSOtherChannel; |
141 | QString mSMSOtherMessage; | 142 | QString mSMSOtherMessage; |
142 | QString mSMSOtherMessageParameters; | 143 | QString mSMSOtherMessageParameters; |
143 | 144 | ||
144 | int mPagerClient; | 145 | int mPagerClient; |
145 | QString mPagerOtherChannel; | 146 | QString mPagerOtherChannel; |
146 | QString mPagerOtherMessage; | 147 | QString mPagerOtherMessage; |
147 | QString mPagerOtherMessageParameters; | 148 | QString mPagerOtherMessageParameters; |
148 | 149 | ||
149 | int mSipClient; | 150 | int mSipClient; |
150 | QString mSipOtherChannel; | 151 | QString mSipOtherChannel; |
151 | QString mSipOtherMessage; | 152 | QString mSipOtherMessage; |
152 | QString mSipOtherMessageParameters; | 153 | QString mSipOtherMessageParameters; |
153 | 154 | ||
154 | 155 | ||
155 | 156 | KURLRequester* mBackupUrl; | |
157 | QSpinBox* mBackupDayCountSpin, *mBackupNumbersSpin ; | ||
156 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; | 158 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; |
157 | 159 | ||
158 | // AddresseeWidget *mAddresseeWidget; | 160 | // AddresseeWidget *mAddresseeWidget; |
159 | }; | 161 | }; |
160 | 162 | ||
161 | #endif | 163 | #endif |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 873f0eb..90321b2 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -1,216 +1,223 @@ | |||
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" ); | ||
115 | addItemString("BackupDatadir",&mBackupDatadir,KGlobalSettings::backupDataDir()); | ||
116 | addItemInt( "BackupNumbers", &mBackupNumbers, 3 ); | ||
117 | addItemInt( "BackupDayCount", &mBackupDayCount, 2 ); | ||
118 | addItemBool( "BackupUseDefaultDir",&mBackupUseDefaultDir, true ); | ||
119 | addItemBool( "BackupEnabled",&mBackupEnabled, false ); | ||
120 | |||
114 | } | 121 | } |
115 | 122 | ||
116 | void KPimGlobalPrefs::setGlobalConfig() | 123 | void KPimGlobalPrefs::setGlobalConfig() |
117 | { | 124 | { |
118 | if ( mLocaleDict == 0 ) { | 125 | if ( mLocaleDict == 0 ) { |
119 | QString fileName ; | 126 | QString fileName ; |
120 | QString name = KGlobal::getAppName() +"/"; | 127 | QString name = KGlobal::getAppName() +"/"; |
121 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
122 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; | 129 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; |
123 | #else | 130 | #else |
124 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; | 131 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; |
125 | #endif | 132 | #endif |
126 | mLocaleDict = 0; | 133 | mLocaleDict = 0; |
127 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | 134 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { |
128 | 135 | ||
129 | if ( mPreferredLanguage == 1 ) | 136 | if ( mPreferredLanguage == 1 ) |
130 | fileName = fileName+"germantranslation.txt"; | 137 | fileName = fileName+"germantranslation.txt"; |
131 | else if ( mPreferredLanguage == 4 ) | 138 | else if ( mPreferredLanguage == 4 ) |
132 | fileName = fileName+"usertranslation.txt"; | 139 | fileName = fileName+"usertranslation.txt"; |
133 | else if ( mPreferredLanguage == 2 ) | 140 | else if ( mPreferredLanguage == 2 ) |
134 | fileName = fileName+"frenchtranslation.txt"; | 141 | fileName = fileName+"frenchtranslation.txt"; |
135 | else if ( mPreferredLanguage == 3 ) | 142 | else if ( mPreferredLanguage == 3 ) |
136 | fileName = fileName+"italiantranslation.txt"; | 143 | fileName = fileName+"italiantranslation.txt"; |
137 | QFile file( fileName ); | 144 | QFile file( fileName ); |
138 | if (file.open( IO_ReadOnly ) ) { | 145 | if (file.open( IO_ReadOnly ) ) { |
139 | QTextStream ts( &file ); | 146 | QTextStream ts( &file ); |
140 | ts.setEncoding( QTextStream::Latin1 ); | 147 | ts.setEncoding( QTextStream::Latin1 ); |
141 | //ts.setCodec( QTextCodec::latin1 ); | 148 | //ts.setCodec( QTextCodec::latin1 ); |
142 | QString text = ts.read(); | 149 | QString text = ts.read(); |
143 | file.close(); | 150 | file.close(); |
144 | text.replace( QRegExp("\\\\n"), "\n" ); | 151 | text.replace( QRegExp("\\\\n"), "\n" ); |
145 | QString line; | 152 | QString line; |
146 | QString we; | 153 | QString we; |
147 | QString wt; | 154 | QString wt; |
148 | int br = 0; | 155 | int br = 0; |
149 | int nbr; | 156 | int nbr; |
150 | nbr = text.find ( "},", br ); | 157 | nbr = text.find ( "},", br ); |
151 | line = text.mid( br, nbr - br ); | 158 | line = text.mid( br, nbr - br ); |
152 | br = nbr+1; | 159 | br = nbr+1; |
153 | int se, ee, st, et; | 160 | int se, ee, st, et; |
154 | mLocaleDict = new QDict<QString>; | 161 | mLocaleDict = new QDict<QString>; |
155 | mLocaleDict->setAutoDelete( true ); | 162 | mLocaleDict->setAutoDelete( true ); |
156 | QString end = "{ \"\",\"\" }"; | 163 | QString end = "{ \"\",\"\" }"; |
157 | while ( (line != end) && (br > 1) ) { | 164 | while ( (line != end) && (br > 1) ) { |
158 | //qDebug("%d *%s* ", br, line.latin1()); | 165 | //qDebug("%d *%s* ", br, line.latin1()); |
159 | se = line.find("\"")+1; | 166 | se = line.find("\"")+1; |
160 | et = line.findRev("\"",-1); | 167 | et = line.findRev("\"",-1); |
161 | ee = line.find("\",\""); | 168 | ee = line.find("\",\""); |
162 | st = ee+3; | 169 | st = ee+3; |
163 | we = line.mid( se, ee-se ); | 170 | we = line.mid( se, ee-se ); |
164 | if ( mPreferredLanguage == 4 ) | 171 | if ( mPreferredLanguage == 4 ) |
165 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); | 172 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); |
166 | else | 173 | else |
167 | wt = line.mid( st, et-st ); | 174 | wt = line.mid( st, et-st ); |
168 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | 175 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); |
169 | mLocaleDict->insert( we, new QString (wt) ); | 176 | mLocaleDict->insert( we, new QString (wt) ); |
170 | nbr = text.find ( "}", br ); | 177 | nbr = text.find ( "}", br ); |
171 | line = text.mid( br, nbr - br ); | 178 | line = text.mid( br, nbr - br ); |
172 | br = nbr+1; | 179 | br = nbr+1; |
173 | } | 180 | } |
174 | //qDebug("end *%s* ", end.latin1()); | 181 | //qDebug("end *%s* ", end.latin1()); |
175 | 182 | ||
176 | setLocaleDict( mLocaleDict ); | 183 | setLocaleDict( mLocaleDict ); |
177 | } else { | 184 | } else { |
178 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | 185 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); |
179 | } | 186 | } |
180 | } | 187 | } |
181 | } | 188 | } |
182 | 189 | ||
183 | KGlobal::locale()->setHore24Format( !mPreferredTime ); | 190 | KGlobal::locale()->setHore24Format( !mPreferredTime ); |
184 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); | 191 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); |
185 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); | 192 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); |
186 | KGlobal::locale()->setLanguage( mPreferredLanguage ); | 193 | KGlobal::locale()->setLanguage( mPreferredLanguage ); |
187 | QString dummy = mUserDateFormatLong; | 194 | QString dummy = mUserDateFormatLong; |
188 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 195 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
189 | dummy = mUserDateFormatShort; | 196 | dummy = mUserDateFormatShort; |
190 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 197 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
191 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, | 198 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, |
192 | mDaylightsavingStart, | 199 | mDaylightsavingStart, |
193 | mDaylightsavingEnd ); | 200 | mDaylightsavingEnd ); |
194 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); | 201 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); |
195 | KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); | 202 | KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); |
196 | 203 | ||
197 | } | 204 | } |
198 | KPimGlobalPrefs::~KPimGlobalPrefs() | 205 | KPimGlobalPrefs::~KPimGlobalPrefs() |
199 | { | 206 | { |
200 | if (sInstance == this) | 207 | if (sInstance == this) |
201 | sInstance = staticDeleterGP.setObject(0); | 208 | sInstance = staticDeleterGP.setObject(0); |
202 | else | 209 | else |
203 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); | 210 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); |
204 | if ( mLocaleDict ) | 211 | if ( mLocaleDict ) |
205 | delete mLocaleDict; | 212 | delete mLocaleDict; |
206 | } | 213 | } |
207 | 214 | ||
208 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 215 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
209 | { | 216 | { |
210 | if ( !sInstance ) { | 217 | if ( !sInstance ) { |
211 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); | 218 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); |
212 | sInstance->readConfig(); | 219 | sInstance->readConfig(); |
213 | } | 220 | } |
214 | 221 | ||
215 | return sInstance; | 222 | return sInstance; |
216 | } | 223 | } |
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h index 36cc25a..94ac8ae 100644 --- a/libkdepim/kpimglobalprefs.h +++ b/libkdepim/kpimglobalprefs.h | |||
@@ -1,145 +1,151 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
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 | #ifndef KPIMGLOBALPREFS_H | 31 | #ifndef KPIMGLOBALPREFS_H |
32 | #define KPIMGLOBALPREFS_H | 32 | #define KPIMGLOBALPREFS_H |
33 | 33 | ||
34 | #include "kprefs.h" | 34 | #include "kprefs.h" |
35 | #include <qdict.h> | 35 | #include <qdict.h> |
36 | 36 | ||
37 | class KPimGlobalPrefs : public KPrefs | 37 | class KPimGlobalPrefs : public KPrefs |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | 40 | ||
41 | void setGlobalConfig(); | 41 | void setGlobalConfig(); |
42 | static KPimGlobalPrefs *instance(); | 42 | static KPimGlobalPrefs *instance(); |
43 | 43 | ||
44 | 44 | ||
45 | virtual ~KPimGlobalPrefs(); | 45 | virtual ~KPimGlobalPrefs(); |
46 | 46 | ||
47 | 47 | ||
48 | enum EMailClients { | 48 | enum EMailClients { |
49 | NONE_EMC = 0, | 49 | NONE_EMC = 0, |
50 | OTHER_EMC = 1, | 50 | OTHER_EMC = 1, |
51 | OMPI_EMC = 2, | 51 | OMPI_EMC = 2, |
52 | QTOPIA_EMC = 3, | 52 | QTOPIA_EMC = 3, |
53 | OPIE_EMC = 4, | 53 | OPIE_EMC = 4, |
54 | OPIE_MAILIT_EMC = 5 | 54 | OPIE_MAILIT_EMC = 5 |
55 | }; | 55 | }; |
56 | 56 | ||
57 | enum PhoneClients { | 57 | enum PhoneClients { |
58 | NONE_PHC = 0, | 58 | NONE_PHC = 0, |
59 | OTHER_PHC = 1, | 59 | OTHER_PHC = 1, |
60 | KPPI_PHC = 2 | 60 | KPPI_PHC = 2 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | enum FaxClients { | 63 | enum FaxClients { |
64 | NONE_FAC = 0, | 64 | NONE_FAC = 0, |
65 | OTHER_FAC = 1 | 65 | OTHER_FAC = 1 |
66 | }; | 66 | }; |
67 | 67 | ||
68 | enum SMSClients { | 68 | enum SMSClients { |
69 | NONE_SMC = 0, | 69 | NONE_SMC = 0, |
70 | OTHER_SMC = 1 | 70 | OTHER_SMC = 1 |
71 | }; | 71 | }; |
72 | 72 | ||
73 | enum PagerClients { | 73 | enum PagerClients { |
74 | NONE_PAC = 0, | 74 | NONE_PAC = 0, |
75 | OTHER_PAC = 1 | 75 | OTHER_PAC = 1 |
76 | }; | 76 | }; |
77 | 77 | ||
78 | enum SIPClients { | 78 | enum SIPClients { |
79 | NONE_SIC = 0, | 79 | NONE_SIC = 0, |
80 | OTHER_SIC = 1, | 80 | OTHER_SIC = 1, |
81 | KPPI_SIC = 2 | 81 | KPPI_SIC = 2 |
82 | }; | 82 | }; |
83 | 83 | ||
84 | private: | 84 | private: |
85 | KPimGlobalPrefs( const QString &name = QString::null ); | 85 | KPimGlobalPrefs( const QString &name = QString::null ); |
86 | 86 | ||
87 | static KPimGlobalPrefs *sInstance; | 87 | static KPimGlobalPrefs *sInstance; |
88 | QDict<QString> *mLocaleDict; | 88 | QDict<QString> *mLocaleDict; |
89 | 89 | ||
90 | 90 | ||
91 | public: | 91 | public: |
92 | //US I copied the following "locale" settings from KOPrefs | 92 | //US I copied the following "locale" settings from KOPrefs |
93 | int mPreferredDate; | 93 | int mPreferredDate; |
94 | QString mUserDateFormatLong; | 94 | QString mUserDateFormatLong; |
95 | QString mUserDateFormatShort; | 95 | QString mUserDateFormatShort; |
96 | int mPreferredLanguage; | 96 | int mPreferredLanguage; |
97 | int mPreferredTime; | 97 | int mPreferredTime; |
98 | bool mWeekStartsOnSunday; | 98 | bool mWeekStartsOnSunday; |
99 | QString mTimeZoneId; | 99 | QString mTimeZoneId; |
100 | bool mUseDaylightsaving; | 100 | bool mUseDaylightsaving; |
101 | int mDaylightsavingStart; | 101 | int mDaylightsavingStart; |
102 | int mDaylightsavingEnd; | 102 | int mDaylightsavingEnd; |
103 | bool mTimeZoneAdd30min; | 103 | bool mTimeZoneAdd30min; |
104 | QFont mApplicationFont; | 104 | QFont mApplicationFont; |
105 | QColor mAlternateColor; | 105 | QColor mAlternateColor; |
106 | 106 | ||
107 | int mEmailClient; | 107 | int mEmailClient; |
108 | QString mEmailOtherChannel; | 108 | QString mEmailOtherChannel; |
109 | QString mEmailOtherMessage; | 109 | QString mEmailOtherMessage; |
110 | QString mEmailOtherMessageParameters; | 110 | QString mEmailOtherMessageParameters; |
111 | QString mEmailOtherMessage2; | 111 | QString mEmailOtherMessage2; |
112 | QString mEmailOtherMessageParameters2; | 112 | QString mEmailOtherMessageParameters2; |
113 | 113 | ||
114 | int mPhoneClient; | 114 | int mPhoneClient; |
115 | QString mPhoneOtherChannel; | 115 | QString mPhoneOtherChannel; |
116 | QString mPhoneOtherMessage; | 116 | QString mPhoneOtherMessage; |
117 | QString mPhoneOtherMessageParameters; | 117 | QString mPhoneOtherMessageParameters; |
118 | 118 | ||
119 | int mFaxClient; | 119 | int mFaxClient; |
120 | QString mFaxOtherChannel; | 120 | QString mFaxOtherChannel; |
121 | QString mFaxOtherMessage; | 121 | QString mFaxOtherMessage; |
122 | QString mFaxOtherMessageParameters; | 122 | QString mFaxOtherMessageParameters; |
123 | 123 | ||
124 | int mSMSClient; | 124 | int mSMSClient; |
125 | QString mSMSOtherChannel; | 125 | QString mSMSOtherChannel; |
126 | QString mSMSOtherMessage; | 126 | QString mSMSOtherMessage; |
127 | QString mSMSOtherMessageParameters; | 127 | QString mSMSOtherMessageParameters; |
128 | 128 | ||
129 | int mPagerClient; | 129 | int mPagerClient; |
130 | QString mPagerOtherChannel; | 130 | QString mPagerOtherChannel; |
131 | QString mPagerOtherMessage; | 131 | QString mPagerOtherMessage; |
132 | QString mPagerOtherMessageParameters; | 132 | QString mPagerOtherMessageParameters; |
133 | 133 | ||
134 | int mSipClient; | 134 | int mSipClient; |
135 | QString mSipOtherChannel; | 135 | QString mSipOtherChannel; |
136 | QString mSipOtherMessage; | 136 | QString mSipOtherMessage; |
137 | QString mSipOtherMessageParameters; | 137 | QString mSipOtherMessageParameters; |
138 | 138 | ||
139 | QString mEx2PhoneDevice; | 139 | QString mEx2PhoneDevice; |
140 | QString mEx2PhoneConnection; | 140 | QString mEx2PhoneConnection; |
141 | QString mEx2PhoneModel; | 141 | QString mEx2PhoneModel; |
142 | 142 | ||
143 | |||
144 | bool mBackupEnabled; | ||
145 | QString mBackupDatadir; | ||
146 | bool mBackupUseDefaultDir; | ||
147 | int mBackupNumbers; | ||
148 | int mBackupDayCount; | ||
143 | }; | 149 | }; |
144 | 150 | ||
145 | #endif | 151 | #endif |
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index dd9a602..b6ae775 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -1,410 +1,410 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 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 | // $Id$ | 24 | // $Id$ |
25 | 25 | ||
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qgroupbox.h> | 28 | #include <qgroupbox.h> |
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | #include <qslider.h> | 32 | #include <qslider.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <qhbox.h> | 36 | #include <qhbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qframe.h> | 39 | #include <qframe.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qradiobutton.h> | 42 | #include <qradiobutton.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | 45 | ||
46 | #include <kcolorbutton.h> | 46 | #include <kcolorbutton.h> |
47 | #include <kdebug.h> | 47 | #include <kdebug.h> |
48 | #include <klocale.h> | 48 | #include <klocale.h> |
49 | #include <kglobal.h> | 49 | #include <kglobal.h> |
50 | #include <kfontdialog.h> | 50 | #include <kfontdialog.h> |
51 | #include <kmessagebox.h> | 51 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 52 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 53 | #include <kiconloader.h> |
54 | 54 | ||
55 | #include "kprefs.h" | 55 | #include "kprefs.h" |
56 | 56 | ||
57 | #include "kprefsdialog.h" | 57 | #include "kprefsdialog.h" |
58 | //#include "kprefsdialog.moc" | 58 | //#include "kprefsdialog.moc" |
59 | 59 | ||
60 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, | 60 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, |
61 | QWidget *parent) | 61 | QWidget *parent) |
62 | { | 62 | { |
63 | mReference = reference; | 63 | mReference = reference; |
64 | 64 | ||
65 | mCheck = new QCheckBox(text,parent); | 65 | mCheck = new QCheckBox(text,parent); |
66 | } | 66 | } |
67 | 67 | ||
68 | void KPrefsDialogWidBool::readConfig() | 68 | void KPrefsDialogWidBool::readConfig() |
69 | { | 69 | { |
70 | mCheck->setChecked(*mReference); | 70 | mCheck->setChecked(*mReference); |
71 | } | 71 | } |
72 | 72 | ||
73 | void KPrefsDialogWidBool::writeConfig() | 73 | void KPrefsDialogWidBool::writeConfig() |
74 | { | 74 | { |
75 | *mReference = mCheck->isChecked(); | 75 | *mReference = mCheck->isChecked(); |
76 | } | 76 | } |
77 | 77 | ||
78 | QCheckBox *KPrefsDialogWidBool::checkBox() | 78 | QCheckBox *KPrefsDialogWidBool::checkBox() |
79 | { | 79 | { |
80 | return mCheck; | 80 | return mCheck; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, | 84 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, |
85 | QWidget *parent) | 85 | QWidget *parent) |
86 | { | 86 | { |
87 | mReference = reference; | 87 | mReference = reference; |
88 | 88 | ||
89 | mButton = new KColorButton(parent); | 89 | mButton = new KColorButton(parent); |
90 | mLabel = new QLabel(mButton, text, parent); | 90 | mLabel = new QLabel(mButton, text, parent); |
91 | mButton->setColor( *mReference ); | 91 | mButton->setColor( *mReference ); |
92 | mButton->setColor( Qt::red ); | 92 | mButton->setColor( Qt::red ); |
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | KPrefsDialogWidColor::~KPrefsDialogWidColor() | 96 | KPrefsDialogWidColor::~KPrefsDialogWidColor() |
97 | { | 97 | { |
98 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; | 98 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; |
99 | } | 99 | } |
100 | 100 | ||
101 | void KPrefsDialogWidColor::readConfig() | 101 | void KPrefsDialogWidColor::readConfig() |
102 | { | 102 | { |
103 | mButton->setColor(*mReference); | 103 | mButton->setColor(*mReference); |
104 | } | 104 | } |
105 | 105 | ||
106 | void KPrefsDialogWidColor::writeConfig() | 106 | void KPrefsDialogWidColor::writeConfig() |
107 | { | 107 | { |
108 | *mReference = mButton->color(); | 108 | *mReference = mButton->color(); |
109 | } | 109 | } |
110 | 110 | ||
111 | QLabel *KPrefsDialogWidColor::label() | 111 | QLabel *KPrefsDialogWidColor::label() |
112 | { | 112 | { |
113 | return mLabel; | 113 | return mLabel; |
114 | } | 114 | } |
115 | 115 | ||
116 | KColorButton *KPrefsDialogWidColor::button() | 116 | KColorButton *KPrefsDialogWidColor::button() |
117 | { | 117 | { |
118 | return mButton; | 118 | return mButton; |
119 | } | 119 | } |
120 | 120 | ||
121 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, | 121 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, |
122 | QFont *reference,QWidget *parent) | 122 | QFont *reference,QWidget *parent) |
123 | { | 123 | { |
124 | mReference = reference; | 124 | mReference = reference; |
125 | 125 | ||
126 | mLabel = new QLabel(labelText, parent); | 126 | mLabel = new QLabel(labelText, parent); |
127 | 127 | ||
128 | mPreview = new QLabel(sampleText,parent); | 128 | mPreview = new QLabel(sampleText,parent); |
129 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 129 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
130 | 130 | ||
131 | mButton = new QPushButton(i18n("Choose..."), parent); | 131 | mButton = new QPushButton(i18n("Choose..."), parent); |
132 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); | 132 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); |
133 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); | 133 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); |
134 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); | 134 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); |
135 | } | 135 | } |
136 | 136 | ||
137 | KPrefsDialogWidFont::~KPrefsDialogWidFont() | 137 | KPrefsDialogWidFont::~KPrefsDialogWidFont() |
138 | { | 138 | { |
139 | } | 139 | } |
140 | 140 | ||
141 | void KPrefsDialogWidFont::readConfig() | 141 | void KPrefsDialogWidFont::readConfig() |
142 | { | 142 | { |
143 | mPreview->setFont(*mReference); | 143 | mPreview->setFont(*mReference); |
144 | } | 144 | } |
145 | 145 | ||
146 | void KPrefsDialogWidFont::writeConfig() | 146 | void KPrefsDialogWidFont::writeConfig() |
147 | { | 147 | { |
148 | *mReference = mPreview->font(); | 148 | *mReference = mPreview->font(); |
149 | } | 149 | } |
150 | 150 | ||
151 | QLabel *KPrefsDialogWidFont::label() | 151 | QLabel *KPrefsDialogWidFont::label() |
152 | { | 152 | { |
153 | return mLabel; | 153 | return mLabel; |
154 | } | 154 | } |
155 | 155 | ||
156 | QLabel *KPrefsDialogWidFont::preview() | 156 | QLabel *KPrefsDialogWidFont::preview() |
157 | { | 157 | { |
158 | return mPreview; | 158 | return mPreview; |
159 | } | 159 | } |
160 | 160 | ||
161 | QPushButton *KPrefsDialogWidFont::button() | 161 | QPushButton *KPrefsDialogWidFont::button() |
162 | { | 162 | { |
163 | return mButton; | 163 | return mButton; |
164 | } | 164 | } |
165 | 165 | ||
166 | void KPrefsDialogWidFont::selectFont() | 166 | void KPrefsDialogWidFont::selectFont() |
167 | { | 167 | { |
168 | QFont myFont(mPreview->font()); | 168 | QFont myFont(mPreview->font()); |
169 | bool ok; | 169 | bool ok; |
170 | myFont = KFontDialog::getFont(myFont, ok); | 170 | myFont = KFontDialog::getFont(myFont, ok); |
171 | if ( ok ) { | 171 | if ( ok ) { |
172 | mPreview->setFont(myFont); | 172 | mPreview->setFont(myFont); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, | 177 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, |
178 | QWidget *parent) | 178 | QWidget *parent) |
179 | { | 179 | { |
180 | mReference = reference; | 180 | mReference = reference; |
181 | 181 | ||
182 | mLabel = new QLabel(text,parent); | 182 | mLabel = new QLabel(text,parent); |
183 | mSpin = new QSpinBox(0,23,1,parent); | 183 | mSpin = new QSpinBox(0,23,1,parent); |
184 | mSpin->setSuffix(":00"); | 184 | mSpin->setSuffix(":00"); |
185 | } | 185 | } |
186 | 186 | ||
187 | void KPrefsDialogWidTime::readConfig() | 187 | void KPrefsDialogWidTime::readConfig() |
188 | { | 188 | { |
189 | mSpin->setValue(*mReference); | 189 | mSpin->setValue(*mReference); |
190 | } | 190 | } |
191 | 191 | ||
192 | void KPrefsDialogWidTime::writeConfig() | 192 | void KPrefsDialogWidTime::writeConfig() |
193 | { | 193 | { |
194 | *mReference = mSpin->value(); | 194 | *mReference = mSpin->value(); |
195 | } | 195 | } |
196 | 196 | ||
197 | QLabel *KPrefsDialogWidTime::label() | 197 | QLabel *KPrefsDialogWidTime::label() |
198 | { | 198 | { |
199 | return mLabel; | 199 | return mLabel; |
200 | } | 200 | } |
201 | 201 | ||
202 | QSpinBox *KPrefsDialogWidTime::spinBox() | 202 | QSpinBox *KPrefsDialogWidTime::spinBox() |
203 | { | 203 | { |
204 | return mSpin; | 204 | return mSpin; |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, | 208 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, |
209 | QWidget *parent) | 209 | QWidget *parent) |
210 | { | 210 | { |
211 | mReference = reference; | 211 | mReference = reference; |
212 | 212 | ||
213 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); | 213 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); |
214 | } | 214 | } |
215 | 215 | ||
216 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() | 216 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() |
217 | { | 217 | { |
218 | } | 218 | } |
219 | 219 | ||
220 | void KPrefsDialogWidRadios::addRadio(const QString &text) | 220 | void KPrefsDialogWidRadios::addRadio(const QString &text) |
221 | { | 221 | { |
222 | new QRadioButton(text,mBox); | 222 | new QRadioButton(text,mBox); |
223 | } | 223 | } |
224 | 224 | ||
225 | QButtonGroup *KPrefsDialogWidRadios::groupBox() | 225 | QButtonGroup *KPrefsDialogWidRadios::groupBox() |
226 | { | 226 | { |
227 | return mBox; | 227 | return mBox; |
228 | } | 228 | } |
229 | 229 | ||
230 | void KPrefsDialogWidRadios::readConfig() | 230 | void KPrefsDialogWidRadios::readConfig() |
231 | { | 231 | { |
232 | mBox->setButton(*mReference); | 232 | mBox->setButton(*mReference); |
233 | } | 233 | } |
234 | 234 | ||
235 | void KPrefsDialogWidRadios::writeConfig() | 235 | void KPrefsDialogWidRadios::writeConfig() |
236 | { | 236 | { |
237 | *mReference = mBox->id(mBox->selected()); | 237 | *mReference = mBox->id(mBox->selected()); |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
241 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, | 241 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, |
242 | QWidget *parent, QLineEdit::EchoMode echomode) | 242 | QWidget *parent, QLineEdit::EchoMode echomode) |
243 | { | 243 | { |
244 | mReference = reference; | 244 | mReference = reference; |
245 | 245 | ||
246 | mLabel = new QLabel(text,parent); | 246 | mLabel = new QLabel(text,parent); |
247 | mEdit = new QLineEdit(parent); | 247 | mEdit = new QLineEdit(parent); |
248 | mEdit->setEchoMode( echomode ); | 248 | mEdit->setEchoMode( echomode ); |
249 | } | 249 | } |
250 | 250 | ||
251 | KPrefsDialogWidString::~KPrefsDialogWidString() | 251 | KPrefsDialogWidString::~KPrefsDialogWidString() |
252 | { | 252 | { |
253 | } | 253 | } |
254 | 254 | ||
255 | void KPrefsDialogWidString::readConfig() | 255 | void KPrefsDialogWidString::readConfig() |
256 | { | 256 | { |
257 | mEdit->setText(*mReference); | 257 | mEdit->setText(*mReference); |
258 | } | 258 | } |
259 | 259 | ||
260 | void KPrefsDialogWidString::writeConfig() | 260 | void KPrefsDialogWidString::writeConfig() |
261 | { | 261 | { |
262 | *mReference = mEdit->text(); | 262 | *mReference = mEdit->text(); |
263 | } | 263 | } |
264 | 264 | ||
265 | QLabel *KPrefsDialogWidString::label() | 265 | QLabel *KPrefsDialogWidString::label() |
266 | { | 266 | { |
267 | return mLabel; | 267 | return mLabel; |
268 | } | 268 | } |
269 | 269 | ||
270 | QLineEdit *KPrefsDialogWidString::lineEdit() | 270 | QLineEdit *KPrefsDialogWidString::lineEdit() |
271 | { | 271 | { |
272 | return mEdit; | 272 | return mEdit; |
273 | } | 273 | } |
274 | 274 | ||
275 | 275 | ||
276 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : | 276 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : |
277 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, | 277 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, |
278 | name,modal,true) | 278 | name,modal,true) |
279 | { | 279 | { |
280 | mPrefs = prefs; | 280 | mPrefs = prefs; |
281 | 281 | ||
282 | // This seems to cause a crash on exit. Investigate later. | 282 | // This seems to cause a crash on exit. Investigate later. |
283 | // mPrefsWids.setAutoDelete(true); | 283 | mPrefsWids.setAutoDelete(true); |
284 | 284 | ||
285 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); | 285 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); |
286 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); | 286 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); |
287 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); | 287 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); |
288 | } | 288 | } |
289 | 289 | ||
290 | KPrefsDialog::~KPrefsDialog() | 290 | KPrefsDialog::~KPrefsDialog() |
291 | { | 291 | { |
292 | } | 292 | } |
293 | 293 | ||
294 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) | 294 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) |
295 | { | 295 | { |
296 | mPrefsWids.append(wid); | 296 | mPrefsWids.append(wid); |
297 | } | 297 | } |
298 | 298 | ||
299 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) | 299 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) |
300 | { | 300 | { |
301 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); | 301 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); |
302 | addWid(w); | 302 | addWid(w); |
303 | return w; | 303 | return w; |
304 | } | 304 | } |
305 | 305 | ||
306 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) | 306 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) |
307 | { | 307 | { |
308 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); | 308 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); |
309 | addWid(w); | 309 | addWid(w); |
310 | return w; | 310 | return w; |
311 | } | 311 | } |
312 | 312 | ||
313 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) | 313 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) |
314 | { | 314 | { |
315 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); | 315 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); |
316 | addWid(w); | 316 | addWid(w); |
317 | return w; | 317 | return w; |
318 | } | 318 | } |
319 | 319 | ||
320 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) | 320 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) |
321 | { | 321 | { |
322 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); | 322 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); |
323 | addWid(w); | 323 | addWid(w); |
324 | return w; | 324 | return w; |
325 | } | 325 | } |
326 | 326 | ||
327 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) | 327 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) |
328 | { | 328 | { |
329 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); | 329 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); |
330 | addWid(w); | 330 | addWid(w); |
331 | return w; | 331 | return w; |
332 | } | 332 | } |
333 | 333 | ||
334 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) | 334 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) |
335 | { | 335 | { |
336 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); | 336 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); |
337 | addWid(w); | 337 | addWid(w); |
338 | return w; | 338 | return w; |
339 | } | 339 | } |
340 | 340 | ||
341 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, | 341 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, |
342 | QFont *reference,QWidget *parent) | 342 | QFont *reference,QWidget *parent) |
343 | { | 343 | { |
344 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); | 344 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); |
345 | addWid(w); | 345 | addWid(w); |
346 | return w; | 346 | return w; |
347 | } | 347 | } |
348 | 348 | ||
349 | void KPrefsDialog::setDefaults() | 349 | void KPrefsDialog::setDefaults() |
350 | { | 350 | { |
351 | mPrefs->setDefaults(); | 351 | mPrefs->setDefaults(); |
352 | 352 | ||
353 | readConfig(); | 353 | readConfig(); |
354 | } | 354 | } |
355 | 355 | ||
356 | void KPrefsDialog::readConfig() | 356 | void KPrefsDialog::readConfig() |
357 | { | 357 | { |
358 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; | 358 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; |
359 | 359 | ||
360 | KPrefsDialogWid *wid; | 360 | KPrefsDialogWid *wid; |
361 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 361 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
362 | wid->readConfig(); | 362 | wid->readConfig(); |
363 | } | 363 | } |
364 | 364 | ||
365 | usrReadConfig(); | 365 | usrReadConfig(); |
366 | } | 366 | } |
367 | 367 | ||
368 | void KPrefsDialog::writeConfig() | 368 | void KPrefsDialog::writeConfig() |
369 | { | 369 | { |
370 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; | 370 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; |
371 | 371 | ||
372 | KPrefsDialogWid *wid; | 372 | KPrefsDialogWid *wid; |
373 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 373 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
374 | wid->writeConfig(); | 374 | wid->writeConfig(); |
375 | } | 375 | } |
376 | 376 | ||
377 | usrWriteConfig(); | 377 | usrWriteConfig(); |
378 | 378 | ||
379 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; | 379 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; |
380 | 380 | ||
381 | mPrefs->writeConfig(); | 381 | mPrefs->writeConfig(); |
382 | 382 | ||
383 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; | 383 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | void KPrefsDialog::slotApply() | 387 | void KPrefsDialog::slotApply() |
388 | { | 388 | { |
389 | writeConfig(); | 389 | writeConfig(); |
390 | emit configChanged(); | 390 | emit configChanged(); |
391 | } | 391 | } |
392 | 392 | ||
393 | void KPrefsDialog::slotOk() | 393 | void KPrefsDialog::slotOk() |
394 | { | 394 | { |
395 | slotApply(); | 395 | slotApply(); |
396 | QDialog::accept(); | 396 | QDialog::accept(); |
397 | } | 397 | } |
398 | void KPrefsDialog::accept() | 398 | void KPrefsDialog::accept() |
399 | { | 399 | { |
400 | slotOk(); | 400 | slotOk(); |
401 | } | 401 | } |
402 | 402 | ||
403 | void KPrefsDialog::slotDefault() | 403 | void KPrefsDialog::slotDefault() |
404 | { | 404 | { |
405 | if (KMessageBox::warningContinueCancel(this, | 405 | if (KMessageBox::warningContinueCancel(this, |
406 | i18n("You are about to set all\npreferences to default values.\nAll " | 406 | i18n("You are about to set all\npreferences to default values.\nAll " |
407 | "custom modifications will be lost."),i18n("Setting Default Preferences"), | 407 | "custom modifications will be lost."),i18n("Setting Default Preferences"), |
408 | i18n("Continue")) | 408 | i18n("Continue")) |
409 | == KMessageBox::Continue) setDefaults(); | 409 | == KMessageBox::Continue) setDefaults(); |
410 | } | 410 | } |
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h index ad13b78..efcb86a 100644 --- a/libkdepim/kprefsdialog.h +++ b/libkdepim/kprefsdialog.h | |||
@@ -1,446 +1,445 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 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 | #ifndef _KPREFSDIALOG_H | 23 | #ifndef _KPREFSDIALOG_H |
24 | #define _KPREFSDIALOG_H | 24 | #define _KPREFSDIALOG_H |
25 | // $Id$ | 25 | // $Id$ |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | 29 | ||
30 | #include <kdialogbase.h> | 30 | #include <kdialogbase.h> |
31 | 31 | ||
32 | class KPrefs; | 32 | class KPrefs; |
33 | class KPrefsDialog; | 33 | class KPrefsDialog; |
34 | 34 | ||
35 | class KColorButton; | 35 | class KColorButton; |
36 | class QCheckBox; | 36 | class QCheckBox; |
37 | class QLabel; | 37 | class QLabel; |
38 | class QSpinBox; | 38 | class QSpinBox; |
39 | class QButtonGroup; | 39 | class QButtonGroup; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | @short Base class for widgets used by @ref KPrefsDialog. | 42 | @short Base class for widgets used by @ref KPrefsDialog. |
43 | @author Cornelius Schumacher | 43 | @author Cornelius Schumacher |
44 | @see KPrefsDialog | 44 | @see KPrefsDialog |
45 | 45 | ||
46 | This class provides the interface for the preferences widgets used by | 46 | This class provides the interface for the preferences widgets used by |
47 | KPrefsDialog. | 47 | KPrefsDialog. |
48 | */ | 48 | */ |
49 | class KPrefsDialogWid | 49 | class KPrefsDialogWid : public QObject |
50 | { | 50 | { |
51 | public: | 51 | public: |
52 | /** | 52 | /** |
53 | This function is called to read value of the setting from the | 53 | This function is called to read value of the setting from the |
54 | stored configuration and display it in the widget. | 54 | stored configuration and display it in the widget. |
55 | */ | 55 | */ |
56 | virtual void readConfig() = 0; | 56 | virtual void readConfig() = 0; |
57 | /** | 57 | /** |
58 | This function is called to write the current setting of the widget to the | 58 | This function is called to write the current setting of the widget to the |
59 | stored configuration. | 59 | stored configuration. |
60 | */ | 60 | */ |
61 | virtual void writeConfig() = 0; | 61 | virtual void writeConfig() = 0; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | @short Widget for bool settings in @ref KPrefsDialog. | 65 | @short Widget for bool settings in @ref KPrefsDialog. |
66 | 66 | ||
67 | This class provides a widget for configuring bool values. It is meant to be | 67 | This class provides a widget for configuring bool values. It is meant to be |
68 | used by KPrefsDialog. The user is responsible for the layout management. | 68 | used by KPrefsDialog. The user is responsible for the layout management. |
69 | */ | 69 | */ |
70 | class KPrefsDialogWidBool : public KPrefsDialogWid | 70 | class KPrefsDialogWidBool : public KPrefsDialogWid |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | /** | 73 | /** |
74 | Create a bool widget consisting of a QCheckbox. | 74 | Create a bool widget consisting of a QCheckbox. |
75 | 75 | ||
76 | @param text Text of QCheckBox. | 76 | @param text Text of QCheckBox. |
77 | @param reference Pointer to variable read and written by this widget. | 77 | @param reference Pointer to variable read and written by this widget. |
78 | @param parent Parent widget. | 78 | @param parent Parent widget. |
79 | */ | 79 | */ |
80 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); | 80 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); |
81 | 81 | ||
82 | /** | 82 | /** |
83 | Return the QCheckbox used by this widget. | 83 | Return the QCheckbox used by this widget. |
84 | */ | 84 | */ |
85 | QCheckBox *checkBox(); | 85 | QCheckBox *checkBox(); |
86 | 86 | ||
87 | void readConfig(); | 87 | void readConfig(); |
88 | void writeConfig(); | 88 | void writeConfig(); |
89 | 89 | ||
90 | private: | 90 | private: |
91 | bool *mReference; | 91 | bool *mReference; |
92 | 92 | ||
93 | QCheckBox *mCheck; | 93 | QCheckBox *mCheck; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | @short Widget for time settings in @ref KPrefsDialog. | 97 | @short Widget for time settings in @ref KPrefsDialog. |
98 | 98 | ||
99 | This class provides a widget for configuring time values. It is meant to be | 99 | This class provides a widget for configuring time values. It is meant to be |
100 | used by KPrefsDialog. The user is responsible for the layout management. | 100 | used by KPrefsDialog. The user is responsible for the layout management. |
101 | */ | 101 | */ |
102 | class KPrefsDialogWidTime : public KPrefsDialogWid | 102 | class KPrefsDialogWidTime : public KPrefsDialogWid |
103 | { | 103 | { |
104 | public: | 104 | public: |
105 | /** | 105 | /** |
106 | Create a time widget consisting of a label and a spinbox. | 106 | Create a time widget consisting of a label and a spinbox. |
107 | 107 | ||
108 | @param text Text of Label. | 108 | @param text Text of Label. |
109 | @param reference Pointer to variable read and written by this widget. | 109 | @param reference Pointer to variable read and written by this widget. |
110 | @param parent Parent widget. | 110 | @param parent Parent widget. |
111 | */ | 111 | */ |
112 | KPrefsDialogWidTime(const QString &text,int *reference,QWidget *parent); | 112 | KPrefsDialogWidTime(const QString &text,int *reference,QWidget *parent); |
113 | 113 | ||
114 | /** | 114 | /** |
115 | Return QLabel used by this widget. | 115 | Return QLabel used by this widget. |
116 | */ | 116 | */ |
117 | QLabel *label(); | 117 | QLabel *label(); |
118 | /** | 118 | /** |
119 | Return QSpinBox used by this widget. | 119 | Return QSpinBox used by this widget. |
120 | */ | 120 | */ |
121 | QSpinBox *spinBox(); | 121 | QSpinBox *spinBox(); |
122 | 122 | ||
123 | void readConfig(); | 123 | void readConfig(); |
124 | void writeConfig(); | 124 | void writeConfig(); |
125 | 125 | ||
126 | private: | 126 | private: |
127 | int *mReference; | 127 | int *mReference; |
128 | 128 | ||
129 | QLabel *mLabel; | 129 | QLabel *mLabel; |
130 | QSpinBox *mSpin; | 130 | QSpinBox *mSpin; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | /** | 133 | /** |
134 | @short Widget for color settings in @ref KPrefsDialog. | 134 | @short Widget for color settings in @ref KPrefsDialog. |
135 | 135 | ||
136 | This class provides a widget for configuring color values. It is meant to be | 136 | This class provides a widget for configuring color values. It is meant to be |
137 | used by KPrefsDialog. The user is responsible for the layout management. | 137 | used by KPrefsDialog. The user is responsible for the layout management. |
138 | */ | 138 | */ |
139 | class KPrefsDialogWidColor : public QObject, public KPrefsDialogWid | 139 | class KPrefsDialogWidColor : public KPrefsDialogWid |
140 | { | 140 | { |
141 | Q_OBJECT | ||
142 | public: | 141 | public: |
143 | /** | 142 | /** |
144 | Create a color widget consisting of a test field and a button for opening | 143 | Create a color widget consisting of a test field and a button for opening |
145 | a color dialog. | 144 | a color dialog. |
146 | 145 | ||
147 | @param text Text of button. | 146 | @param text Text of button. |
148 | @param reference Pointer to variable read and written by this widget. | 147 | @param reference Pointer to variable read and written by this widget. |
149 | @param parent Parent widget. | 148 | @param parent Parent widget. |
150 | */ | 149 | */ |
151 | KPrefsDialogWidColor(const QString &text,QColor *reference,QWidget *parent); | 150 | KPrefsDialogWidColor(const QString &text,QColor *reference,QWidget *parent); |
152 | /** | 151 | /** |
153 | Destruct color setting widget. | 152 | Destruct color setting widget. |
154 | */ | 153 | */ |
155 | ~KPrefsDialogWidColor(); | 154 | ~KPrefsDialogWidColor(); |
156 | 155 | ||
157 | /** | 156 | /** |
158 | Return QLabel for the button | 157 | Return QLabel for the button |
159 | */ | 158 | */ |
160 | QLabel *label(); | 159 | QLabel *label(); |
161 | /** | 160 | /** |
162 | Return button opening the color dialog. | 161 | Return button opening the color dialog. |
163 | */ | 162 | */ |
164 | KColorButton *button(); | 163 | KColorButton *button(); |
165 | 164 | ||
166 | void readConfig(); | 165 | void readConfig(); |
167 | void writeConfig(); | 166 | void writeConfig(); |
168 | 167 | ||
169 | private: | 168 | private: |
170 | QColor *mReference; | 169 | QColor *mReference; |
171 | 170 | ||
172 | QLabel *mLabel; | 171 | QLabel *mLabel; |
173 | KColorButton *mButton; | 172 | KColorButton *mButton; |
174 | }; | 173 | }; |
175 | 174 | ||
176 | /** | 175 | /** |
177 | @short Widget for font settings in @ref KPrefsDialog. | 176 | @short Widget for font settings in @ref KPrefsDialog. |
178 | 177 | ||
179 | This class provides a widget for configuring font values. It is meant to be | 178 | This class provides a widget for configuring font values. It is meant to be |
180 | used by KPrefsDialog. The user is responsible for the layout management. | 179 | used by KPrefsDialog. The user is responsible for the layout management. |
181 | */ | 180 | */ |
182 | class KPrefsDialogWidFont : public QObject, public KPrefsDialogWid | 181 | class KPrefsDialogWidFont : public KPrefsDialogWid |
183 | { | 182 | { |
184 | Q_OBJECT | 183 | Q_OBJECT |
185 | public: | 184 | public: |
186 | /** | 185 | /** |
187 | Create a font widget consisting of a test field and a button for opening | 186 | Create a font widget consisting of a test field and a button for opening |
188 | a font dialog. | 187 | a font dialog. |
189 | 188 | ||
190 | @param label Text of label. | 189 | @param label Text of label. |
191 | @param reference Pointer to variable read and written by this widget. | 190 | @param reference Pointer to variable read and written by this widget. |
192 | @param parent Parent widget. | 191 | @param parent Parent widget. |
193 | */ | 192 | */ |
194 | KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, | 193 | KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, |
195 | QFont *reference,QWidget *parent); | 194 | QFont *reference,QWidget *parent); |
196 | /** | 195 | /** |
197 | Destruct font setting widget. | 196 | Destruct font setting widget. |
198 | */ | 197 | */ |
199 | ~KPrefsDialogWidFont(); | 198 | ~KPrefsDialogWidFont(); |
200 | 199 | ||
201 | /** | 200 | /** |
202 | Return label. | 201 | Return label. |
203 | */ | 202 | */ |
204 | QLabel *label(); | 203 | QLabel *label(); |
205 | /** | 204 | /** |
206 | Return QFrame used as preview field. | 205 | Return QFrame used as preview field. |
207 | */ | 206 | */ |
208 | QLabel *preview(); | 207 | QLabel *preview(); |
209 | /** | 208 | /** |
210 | Return button opening the font dialog. | 209 | Return button opening the font dialog. |
211 | */ | 210 | */ |
212 | QPushButton *button(); | 211 | QPushButton *button(); |
213 | 212 | ||
214 | void readConfig(); | 213 | void readConfig(); |
215 | void writeConfig(); | 214 | void writeConfig(); |
216 | 215 | ||
217 | protected slots: | 216 | protected slots: |
218 | void selectFont(); | 217 | void selectFont(); |
219 | 218 | ||
220 | private: | 219 | private: |
221 | QFont *mReference; | 220 | QFont *mReference; |
222 | 221 | ||
223 | QLabel *mLabel; | 222 | QLabel *mLabel; |
224 | QLabel *mPreview; | 223 | QLabel *mPreview; |
225 | QPushButton *mButton; | 224 | QPushButton *mButton; |
226 | }; | 225 | }; |
227 | 226 | ||
228 | /** | 227 | /** |
229 | @short Widget for settings represented by a group of radio buttons in | 228 | @short Widget for settings represented by a group of radio buttons in |
230 | @ref KPrefsDialog. | 229 | @ref KPrefsDialog. |
231 | 230 | ||
232 | This class provides a widget for configuring selections. It is meant to be | 231 | This class provides a widget for configuring selections. It is meant to be |
233 | used by KPrefsDialog. The user is responsible for the layout management. The | 232 | used by KPrefsDialog. The user is responsible for the layout management. The |
234 | setting is interpreted as an int value, corresponding to the position of the | 233 | setting is interpreted as an int value, corresponding to the position of the |
235 | radio button. The position of the button is defined by the sequence of @ref | 234 | radio button. The position of the button is defined by the sequence of @ref |
236 | addRadio() calls, starting with 0. | 235 | addRadio() calls, starting with 0. |
237 | */ | 236 | */ |
238 | class KPrefsDialogWidRadios : public KPrefsDialogWid | 237 | class KPrefsDialogWidRadios : public KPrefsDialogWid |
239 | { | 238 | { |
240 | public: | 239 | public: |
241 | /** | 240 | /** |
242 | Create a widget for selection of an option. It consists of a box with | 241 | Create a widget for selection of an option. It consists of a box with |
243 | several radio buttons. | 242 | several radio buttons. |
244 | 243 | ||
245 | @param text Text of main box. | 244 | @param text Text of main box. |
246 | @param reference Pointer to variable read and written by this widget. | 245 | @param reference Pointer to variable read and written by this widget. |
247 | @param parent Parent widget. | 246 | @param parent Parent widget. |
248 | */ | 247 | */ |
249 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); | 248 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); |
250 | virtual ~KPrefsDialogWidRadios(); | 249 | virtual ~KPrefsDialogWidRadios(); |
251 | 250 | ||
252 | /** | 251 | /** |
253 | Add a radio button. | 252 | Add a radio button. |
254 | 253 | ||
255 | @param text Text of the button. | 254 | @param text Text of the button. |
256 | */ | 255 | */ |
257 | void addRadio(const QString &text); | 256 | void addRadio(const QString &text); |
258 | 257 | ||
259 | /** | 258 | /** |
260 | Return the box widget used by this widget. | 259 | Return the box widget used by this widget. |
261 | */ | 260 | */ |
262 | QButtonGroup *groupBox(); | 261 | QButtonGroup *groupBox(); |
263 | 262 | ||
264 | void readConfig(); | 263 | void readConfig(); |
265 | void writeConfig(); | 264 | void writeConfig(); |
266 | 265 | ||
267 | private: | 266 | private: |
268 | int *mReference; | 267 | int *mReference; |
269 | 268 | ||
270 | QButtonGroup *mBox; | 269 | QButtonGroup *mBox; |
271 | }; | 270 | }; |
272 | 271 | ||
273 | 272 | ||
274 | /** | 273 | /** |
275 | @short Widget for string settings in @ref KPrefsDialog. | 274 | @short Widget for string settings in @ref KPrefsDialog. |
276 | 275 | ||
277 | This class provides a widget for configuring string values. It is meant to be | 276 | This class provides a widget for configuring string values. It is meant to be |
278 | used by KPrefsDialog. The user is responsible for the layout management. | 277 | used by KPrefsDialog. The user is responsible for the layout management. |
279 | */ | 278 | */ |
280 | class KPrefsDialogWidString : public KPrefsDialogWid | 279 | class KPrefsDialogWidString : public KPrefsDialogWid |
281 | { | 280 | { |
282 | public: | 281 | public: |
283 | /** | 282 | /** |
284 | Create a string widget consisting of a test label and a line edit. | 283 | Create a string widget consisting of a test label and a line edit. |
285 | 284 | ||
286 | @param text Text of label. | 285 | @param text Text of label. |
287 | @param reference Pointer to variable read and written by this widget. | 286 | @param reference Pointer to variable read and written by this widget. |
288 | @param parent Parent widget. | 287 | @param parent Parent widget. |
289 | */ | 288 | */ |
290 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); | 289 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); |
291 | /** | 290 | /** |
292 | Destructor. | 291 | Destructor. |
293 | */ | 292 | */ |
294 | virtual ~KPrefsDialogWidString(); | 293 | virtual ~KPrefsDialogWidString(); |
295 | 294 | ||
296 | /** | 295 | /** |
297 | Return label used by this widget. | 296 | Return label used by this widget. |
298 | */ | 297 | */ |
299 | QLabel *label(); | 298 | QLabel *label(); |
300 | /** | 299 | /** |
301 | Return QLineEdit used by this widget. | 300 | Return QLineEdit used by this widget. |
302 | */ | 301 | */ |
303 | QLineEdit *lineEdit(); | 302 | QLineEdit *lineEdit(); |
304 | 303 | ||
305 | void readConfig(); | 304 | void readConfig(); |
306 | void writeConfig(); | 305 | void writeConfig(); |
307 | 306 | ||
308 | private: | 307 | private: |
309 | QString *mReference; | 308 | QString *mReference; |
310 | 309 | ||
311 | QLabel *mLabel; | 310 | QLabel *mLabel; |
312 | QLineEdit *mEdit; | 311 | QLineEdit *mEdit; |
313 | }; | 312 | }; |
314 | 313 | ||
315 | 314 | ||
316 | /** | 315 | /** |
317 | @short Base class for a preferences dialog. | 316 | @short Base class for a preferences dialog. |
318 | 317 | ||
319 | This class provides the framework for a preferences dialog. You have to | 318 | This class provides the framework for a preferences dialog. You have to |
320 | subclass it and add the code to create the actual configuration widgets and | 319 | subclass it and add the code to create the actual configuration widgets and |
321 | do the layout management. | 320 | do the layout management. |
322 | 321 | ||
323 | KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For | 322 | KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For |
324 | these widgets the reading, writing and setting to default values is handled | 323 | these widgets the reading, writing and setting to default values is handled |
325 | automatically. Custom widgets have to be handled in the functions @ref | 324 | automatically. Custom widgets have to be handled in the functions @ref |
326 | usrReadConfig() and @ref usrWriteConfig(). | 325 | usrReadConfig() and @ref usrWriteConfig(). |
327 | */ | 326 | */ |
328 | class KPrefsDialog : public KDialogBase | 327 | class KPrefsDialog : public KDialogBase |
329 | { | 328 | { |
330 | Q_OBJECT | 329 | Q_OBJECT |
331 | public: | 330 | public: |
332 | /** | 331 | /** |
333 | Create a KPrefsDialog for a KPrefs object. | 332 | Create a KPrefsDialog for a KPrefs object. |
334 | 333 | ||
335 | @param prefs KPrefs object used to access te configuration. | 334 | @param prefs KPrefs object used to access te configuration. |
336 | @param parent Parent widget. | 335 | @param parent Parent widget. |
337 | @param name Widget name. | 336 | @param name Widget name. |
338 | @param modal true, if dialog has to be modal, false for non-modal. | 337 | @param modal true, if dialog has to be modal, false for non-modal. |
339 | */ | 338 | */ |
340 | KPrefsDialog(KPrefs *prefs,QWidget *parent=0,char *name=0,bool modal=false); | 339 | KPrefsDialog(KPrefs *prefs,QWidget *parent=0,char *name=0,bool modal=false); |
341 | /** | 340 | /** |
342 | Destructor. | 341 | Destructor. |
343 | */ | 342 | */ |
344 | virtual ~KPrefsDialog(); | 343 | virtual ~KPrefsDialog(); |
345 | 344 | ||
346 | /** | 345 | /** |
347 | Register a custom KPrefsDialogWid object. | 346 | Register a custom KPrefsDialogWid object. |
348 | */ | 347 | */ |
349 | void addWid(KPrefsDialogWid *); | 348 | void addWid(KPrefsDialogWid *); |
350 | /** | 349 | /** |
351 | Register a @ref KPrefsDialogWidBool object. | 350 | Register a @ref KPrefsDialogWidBool object. |
352 | 351 | ||
353 | @param text Text of bool widget. | 352 | @param text Text of bool widget. |
354 | @param reference Reference to variable storing the setting. | 353 | @param reference Reference to variable storing the setting. |
355 | @param parent Parent widget. | 354 | @param parent Parent widget. |
356 | */ | 355 | */ |
357 | KPrefsDialogWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent); | 356 | KPrefsDialogWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent); |
358 | /** | 357 | /** |
359 | Register a @ref KPrefsDialogWidTime object. | 358 | Register a @ref KPrefsDialogWidTime object. |
360 | 359 | ||
361 | @param text Text of time widget. | 360 | @param text Text of time widget. |
362 | @param reference Reference to variable storing the setting. | 361 | @param reference Reference to variable storing the setting. |
363 | @param parent Parent widget. | 362 | @param parent Parent widget. |
364 | */ | 363 | */ |
365 | KPrefsDialogWidTime *addWidTime(const QString &text,int *reference,QWidget *parent); | 364 | KPrefsDialogWidTime *addWidTime(const QString &text,int *reference,QWidget *parent); |
366 | /** | 365 | /** |
367 | Register a @ref KPrefsDialogWidColor object. | 366 | Register a @ref KPrefsDialogWidColor object. |
368 | 367 | ||
369 | @param text Text of color widget. | 368 | @param text Text of color widget. |
370 | @param reference Reference to variable storing the setting. | 369 | @param reference Reference to variable storing the setting. |
371 | @param parent Parent widget. | 370 | @param parent Parent widget. |
372 | */ | 371 | */ |
373 | KPrefsDialogWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent); | 372 | KPrefsDialogWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent); |
374 | /** | 373 | /** |
375 | Register a @ref KPrefsDialogWidRadios object. | 374 | Register a @ref KPrefsDialogWidRadios object. |
376 | 375 | ||
377 | @param text Text of radio button box widget. | 376 | @param text Text of radio button box widget. |
378 | @param reference Reference to variable storing the setting. | 377 | @param reference Reference to variable storing the setting. |
379 | @param parent Parent widget. | 378 | @param parent Parent widget. |
380 | */ | 379 | */ |
381 | KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent); | 380 | KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent); |
382 | /** | 381 | /** |
383 | Register a @ref KPrefsDialogWidString object. | 382 | Register a @ref KPrefsDialogWidString object. |
384 | 383 | ||
385 | @param text Text of string widget. | 384 | @param text Text of string widget. |
386 | @param reference Reference to variable storing the setting. | 385 | @param reference Reference to variable storing the setting. |
387 | @param parent Parent widget. | 386 | @param parent Parent widget. |
388 | */ | 387 | */ |
389 | KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent); | 388 | KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent); |
390 | /** | 389 | /** |
391 | Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password. | 390 | Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password. |
392 | 391 | ||
393 | @param text Text of string widget. | 392 | @param text Text of string widget. |
394 | @param reference Reference to variable storing the setting. | 393 | @param reference Reference to variable storing the setting. |
395 | @param parent Parent widget. | 394 | @param parent Parent widget. |
396 | */ | 395 | */ |
397 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); | 396 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); |
398 | /** | 397 | /** |
399 | Register a @ref KPrefsDialogWidFont object. | 398 | Register a @ref KPrefsDialogWidFont object. |
400 | 399 | ||
401 | @param sampleText Sample text of font widget. | 400 | @param sampleText Sample text of font widget. |
402 | @param buttonText Button text of font widget. | 401 | @param buttonText Button text of font widget. |
403 | @param reference Reference to variable storing the setting. | 402 | @param reference Reference to variable storing the setting. |
404 | @param parent Parent widget. | 403 | @param parent Parent widget. |
405 | */ | 404 | */ |
406 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, | 405 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, |
407 | QFont *reference,QWidget *parent); | 406 | QFont *reference,QWidget *parent); |
408 | 407 | ||
409 | public slots: | 408 | public slots: |
410 | /** Set all widgets to default values. */ | 409 | /** Set all widgets to default values. */ |
411 | void setDefaults(); | 410 | void setDefaults(); |
412 | 411 | ||
413 | /** Read preferences from config file. */ | 412 | /** Read preferences from config file. */ |
414 | void readConfig(); | 413 | void readConfig(); |
415 | 414 | ||
416 | /** Write preferences to config file. */ | 415 | /** Write preferences to config file. */ |
417 | void writeConfig(); | 416 | void writeConfig(); |
418 | 417 | ||
419 | signals: | 418 | signals: |
420 | /** Emitted when the a changed configuration has been stored. */ | 419 | /** Emitted when the a changed configuration has been stored. */ |
421 | void configChanged(); | 420 | void configChanged(); |
422 | 421 | ||
423 | protected slots: | 422 | protected slots: |
424 | /** Apply changes to preferences */ | 423 | /** Apply changes to preferences */ |
425 | void slotApply(); | 424 | void slotApply(); |
426 | 425 | ||
427 | void accept(); | 426 | void accept(); |
428 | /** Accept changes to preferences and close dialog */ | 427 | /** Accept changes to preferences and close dialog */ |
429 | void slotOk(); | 428 | void slotOk(); |
430 | 429 | ||
431 | /** Set preferences to default values */ | 430 | /** Set preferences to default values */ |
432 | void slotDefault(); | 431 | void slotDefault(); |
433 | 432 | ||
434 | protected: | 433 | protected: |
435 | /** Implement this to read custom configuration widgets. */ | 434 | /** Implement this to read custom configuration widgets. */ |
436 | virtual void usrReadConfig() {} | 435 | virtual void usrReadConfig() {} |
437 | /** Implement this to write custom configuration widgets. */ | 436 | /** Implement this to write custom configuration widgets. */ |
438 | virtual void usrWriteConfig() {} | 437 | virtual void usrWriteConfig() {} |
439 | 438 | ||
440 | private: | 439 | private: |
441 | KPrefs *mPrefs; | 440 | KPrefs *mPrefs; |
442 | 441 | ||
443 | QPtrList<KPrefsDialogWid> mPrefsWids; | 442 | QPtrList<KPrefsDialogWid> mPrefsWids; |
444 | }; | 443 | }; |
445 | 444 | ||
446 | #endif | 445 | #endif |