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