-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 26 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.h | 2 | ||||
-rw-r--r-- | libkdepim/kdatepicker.cpp | 1 |
3 files changed, 25 insertions, 4 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index ff1e240..764c495 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,987 +1,1007 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KdePim/Pi. | 2 | This file is part of KdePim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qgroupbox.h> | 34 | #include <qgroupbox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qbuttongroup.h> | 37 | #include <qbuttongroup.h> |
38 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qvbox.h> | 40 | #include <qvbox.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | 44 | ||
45 | #include <kdialog.h> | 45 | #include <kdialog.h> |
46 | #include <kprefsdialog.h> | 46 | #include <kprefsdialog.h> |
47 | #include <klocale.h> | 47 | #include <klocale.h> |
48 | #include <kglobalsettings.h> | 48 | #include <kglobalsettings.h> |
49 | #include <kdateedit.h> | 49 | #include <kdateedit.h> |
50 | #include <kglobal.h> | 50 | #include <kglobal.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | 52 | ||
53 | /*US | 53 | /*US |
54 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
55 | #include <qframe.h> | 55 | #include <qframe.h> |
56 | #include <qpushbutton.h> | 56 | #include <qpushbutton.h> |
57 | #include <qcombobox.h> | 57 | #include <qcombobox.h> |
58 | #include <qlineedit.h> | 58 | #include <qlineedit.h> |
59 | #include <qlabel.h> | 59 | #include <qlabel.h> |
60 | #include <qfile.h> | 60 | #include <qfile.h> |
61 | 61 | ||
62 | #include <kconfig.h> | 62 | #include <kconfig.h> |
63 | #include <kdebug.h> | 63 | #include <kdebug.h> |
64 | #include <kdialog.h> | 64 | #include <kdialog.h> |
65 | #include <klistview.h> | 65 | #include <klistview.h> |
66 | #include <klocale.h> | 66 | #include <klocale.h> |
67 | #include <kglobal.h> | 67 | #include <kglobal.h> |
68 | #include <kmessagebox.h> | 68 | #include <kmessagebox.h> |
69 | #include <kstandarddirs.h> | 69 | #include <kstandarddirs.h> |
70 | 70 | ||
71 | #ifndef KAB_EMBEDDED | 71 | #ifndef KAB_EMBEDDED |
72 | #include <ktrader.h> | 72 | #include <ktrader.h> |
73 | #else // KAB_EMBEDDED | 73 | #else // KAB_EMBEDDED |
74 | #include <mergewidget.h> | 74 | #include <mergewidget.h> |
75 | #include <distributionlistwidget.h> | 75 | #include <distributionlistwidget.h> |
76 | #endif // KAB_EMBEDDED | 76 | #endif // KAB_EMBEDDED |
77 | 77 | ||
78 | #include "addresseewidget.h" | 78 | #include "addresseewidget.h" |
79 | #include "extensionconfigdialog.h" | 79 | #include "extensionconfigdialog.h" |
80 | #include "extensionwidget.h" | 80 | #include "extensionwidget.h" |
81 | */ | 81 | */ |
82 | 82 | ||
83 | #include "qapplication.h" | 83 | #include "qapplication.h" |
84 | 84 | ||
85 | #include "kpimglobalprefs.h" | 85 | #include "kpimglobalprefs.h" |
86 | 86 | ||
87 | #include "kdepimconfigwidget.h" | 87 | #include "kdepimconfigwidget.h" |
88 | #include <kprefs.h> | 88 | #include <kprefs.h> |
89 | #include <kmessagebox.h> | 89 | #include <kmessagebox.h> |
90 | 90 | ||
91 | 91 | ||
92 | 92 | ||
93 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 93 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
94 | : KPrefsWidget(prefs, parent, name ) | 94 | : KPrefsWidget(prefs, parent, name ) |
95 | { | 95 | { |
96 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 96 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
97 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 97 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
98 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 98 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
99 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 99 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
100 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 100 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
101 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 101 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
102 | 102 | ||
103 | 103 | ||
104 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 104 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
105 | KDialog::spacingHint() ); | 105 | KDialog::spacingHint() ); |
106 | 106 | ||
107 | tabWidget = new QTabWidget( this ); | 107 | tabWidget = new QTabWidget( this ); |
108 | topLayout->addWidget( tabWidget ); | 108 | topLayout->addWidget( tabWidget ); |
109 | 109 | ||
110 | 110 | ||
111 | setupLocaleTab(); | 111 | setupLocaleTab(); |
112 | setupLocaleDateTab(); | 112 | setupLocaleDateTab(); |
113 | setupTimeZoneTab(); | 113 | setupTimeZoneTab(); |
114 | setupExternalAppTab(); | 114 | setupExternalAppTab(); |
115 | setupStoreTab(); | 115 | setupStoreTab(); |
116 | setupBackupTab(); | 116 | setupBackupTab(); |
117 | } | 117 | } |
118 | void KDEPIMConfigWidget::showTimeZoneTab() | 118 | void KDEPIMConfigWidget::showTimeZoneTab() |
119 | { | 119 | { |
120 | tabWidget->setCurrentPage ( 3 ) ; | 120 | tabWidget->setCurrentPage ( 3 ) ; |
121 | } | 121 | } |
122 | void KDEPIMConfigWidget::setupBackupTab() | 122 | void KDEPIMConfigWidget::setupBackupTab() |
123 | { | 123 | { |
124 | QVBox *colorPage = new QVBox( this ); | 124 | QVBox *colorPage = new QVBox( this ); |
125 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); | 125 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); |
126 | QWidget* topFrame = new QWidget( colorPage ); | 126 | QWidget* topFrame = new QWidget( colorPage ); |
127 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 127 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
128 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), | 128 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), |
129 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); | 129 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); |
130 | topLayout->addWidget((QWidget*)sb->checkBox()); | 130 | topLayout->addWidget((QWidget*)sb->checkBox()); |
131 | QWidget* bupFrame = new QWidget( topFrame ); | 131 | QWidget* bupFrame = new QWidget( topFrame ); |
132 | topLayout->addWidget((bupFrame)); | 132 | topLayout->addWidget((bupFrame)); |
133 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); | 133 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); |
134 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); | 134 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); |
135 | sb = addWidBool(i18n("Use standard backup dir"), | 135 | sb = addWidBool(i18n("Use standard backup dir"), |
136 | &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); | 136 | &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); |
137 | bupLayout->addWidget((QWidget*)sb->checkBox()); | 137 | bupLayout->addWidget((QWidget*)sb->checkBox()); |
138 | mBackupUrl = new KURLRequester( bupFrame ); | 138 | mBackupUrl = new KURLRequester( bupFrame ); |
139 | mBackupUrl->setPathIsDir(); | 139 | mBackupUrl->setPathIsDir(); |
140 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | 140 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); |
141 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); | 141 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); |
142 | bupLayout->addWidget( mBackupUrl ); | 142 | bupLayout->addWidget( mBackupUrl ); |
143 | 143 | ||
144 | mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); | 144 | mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); |
145 | bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); | 145 | bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); |
146 | QHBox *dummy = new QHBox(bupFrame); | 146 | QHBox *dummy = new QHBox(bupFrame); |
147 | new QLabel(i18n("Number of Backups:"),dummy); | 147 | new QLabel(i18n("Number of Backups:"),dummy); |
148 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); | 148 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); |
149 | new QLabel(i18n(" "),dummy); | 149 | new QLabel(i18n(" "),dummy); |
150 | bupLayout->addWidget( dummy ); | 150 | bupLayout->addWidget( dummy ); |
151 | 151 | ||
152 | dummy = new QHBox(bupFrame); | 152 | dummy = new QHBox(bupFrame); |
153 | new QLabel(i18n("Make backup every "),dummy); | 153 | new QLabel(i18n("Make backup every "),dummy); |
154 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); | 154 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); |
155 | new QLabel(i18n(" days"),dummy); | 155 | new QLabel(i18n(" days"),dummy); |
156 | new QLabel(i18n(" "),dummy); | 156 | new QLabel(i18n(" "),dummy); |
157 | bupLayout->addWidget( dummy ); | 157 | bupLayout->addWidget( dummy ); |
158 | QString localKdeDir; | 158 | QString localKdeDir; |
159 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); | 159 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); |
160 | if ( ! localKdeDir.isEmpty() ) { | 160 | if ( ! localKdeDir.isEmpty() ) { |
161 | sb->checkBox()->setEnabled( false ); | 161 | sb->checkBox()->setEnabled( false ); |
162 | sb->checkBox()->setChecked( true ); | 162 | sb->checkBox()->setChecked( true ); |
163 | mBackupUrl->setEnabled( false ); | 163 | mBackupUrl->setEnabled( false ); |
164 | KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; | 164 | KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; |
165 | } | 165 | } |
166 | 166 | ||
167 | } | 167 | } |
168 | void KDEPIMConfigWidget::setupStoreTab() | 168 | void KDEPIMConfigWidget::setupStoreTab() |
169 | { | 169 | { |
170 | QVBox *colorPage = new QVBox( this ); | 170 | QVBox *colorPage = new QVBox( this ); |
171 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); | 171 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); |
172 | QWidget* cw = new QWidget( colorPage ); | 172 | QWidget* cw = new QWidget( colorPage ); |
173 | KPrefsWidColor *holidayColor = | 173 | KPrefsWidColor *holidayColor = |
174 | addWidColor(i18n("Alternating background of list views"), | 174 | addWidColor(i18n("Alternating background of list views"), |
175 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); | 175 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); |
176 | QHBoxLayout *topLayout = new QHBoxLayout(cw); | 176 | QHBoxLayout *topLayout = new QHBoxLayout(cw); |
177 | topLayout->addWidget(holidayColor->label()); | 177 | topLayout->addWidget(holidayColor->label()); |
178 | topLayout->addWidget( (QWidget* )holidayColor->button()); | 178 | topLayout->addWidget( (QWidget* )holidayColor->button()); |
179 | 179 | ||
180 | 180 | ||
181 | QVBox *storePage = new QVBox( this ); | 181 | QVBox *storePage = new QVBox( this ); |
182 | if ( QApplication::desktop()->height() > 240 ) | 182 | if ( QApplication::desktop()->height() > 240 ) |
183 | 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 ); | 183 | 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 ); |
184 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 184 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
185 | mStoreUrl = new KURLRequester( storePage ); | 185 | mStoreUrl = new KURLRequester( storePage ); |
186 | mStoreUrl->setPathIsDir(); | 186 | mStoreUrl->setPathIsDir(); |
187 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 187 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
188 | #ifdef DESKTOP_VERSION | 188 | #ifdef DESKTOP_VERSION |
189 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | 189 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; |
190 | QFileInfo fi ( confFile ); | 190 | QFileInfo fi ( confFile ); |
191 | if ( fi.exists() ) { | 191 | if ( fi.exists() ) { |
192 | KConfig cfg ( confFile ); | 192 | KConfig cfg ( confFile ); |
193 | cfg.setGroup("Global"); | 193 | cfg.setGroup("Global"); |
194 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); | 194 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); |
195 | if ( localKdeDir != "x_x_x" ) { | 195 | if ( localKdeDir != "x_x_x" ) { |
196 | mStoreUrl->setURL( localKdeDir ); | 196 | mStoreUrl->setURL( localKdeDir ); |
197 | qDebug("Reading config from %s ", confFile.latin1()); | 197 | qDebug("Reading config from %s ", confFile.latin1()); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | #endif | 201 | #endif |
202 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 202 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
203 | QHBox *bb = new QHBox( storePage ); | 203 | QHBox *bb = new QHBox( storePage ); |
204 | QPushButton * pb; | 204 | QPushButton * pb; |
205 | if ( QApplication::desktop()->width() < 640 ) | 205 | if ( QApplication::desktop()->width() < 640 ) |
206 | pb = new QPushButton ( i18n("Save"), bb ); | 206 | pb = new QPushButton ( i18n("Save"), bb ); |
207 | else | 207 | else |
208 | pb = new QPushButton ( i18n("Save settings"), bb ); | 208 | pb = new QPushButton ( i18n("Save settings"), bb ); |
209 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 209 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
210 | pb = new QPushButton ( i18n("Save standard"), bb ); | 210 | pb = new QPushButton ( i18n("Save standard"), bb ); |
211 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 211 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
212 | #ifdef DESKTOP_VERSION | 212 | #ifdef DESKTOP_VERSION |
213 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); | 213 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); |
214 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); | 214 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); |
215 | #endif | 215 | #endif |
216 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 216 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
217 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 217 | mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
218 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 218 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
219 | |||
220 | #ifdef DESKTOP_VERSION | ||
221 | if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) { | ||
222 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" )); | ||
223 | } | ||
224 | #endif | ||
219 | } | 225 | } |
220 | void KDEPIMConfigWidget::setLocalStore() | 226 | void KDEPIMConfigWidget::setLocalStore() |
221 | { | 227 | { |
222 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); | 228 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); |
223 | saveStoreSettings(); | 229 | saveStoreSettings(); |
224 | 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."); | 230 | 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."); |
225 | KMessageBox::information( this, message); | 231 | KMessageBox::information( this, message); |
226 | } | 232 | } |
227 | void KDEPIMConfigWidget::setStandardStore() | 233 | void KDEPIMConfigWidget::setStandardStore() |
228 | { | 234 | { |
229 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 235 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
230 | saveStoreSettings(); | 236 | saveStoreSettings(); |
231 | } | 237 | } |
232 | void KDEPIMConfigWidget::saveStoreSettings() | 238 | void KDEPIMConfigWidget::saveStoreSettings() |
233 | { | 239 | { |
240 | #ifdef DESKTOP_VERSION | ||
241 | if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) { | ||
242 | QString file = qApp->applicationDirPath ()+"/.microkdehome"; | ||
243 | QFileInfo fi ( file ); | ||
244 | if ( fi.exists() ) { | ||
245 | bool res = QFile::remove( file ); | ||
246 | if ( ! res ) | ||
247 | KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file )); | ||
248 | } | ||
249 | } | ||
250 | #endif | ||
234 | if ( !mStoreUrl->url().isEmpty() ) { | 251 | if ( !mStoreUrl->url().isEmpty() ) { |
235 | QString path = QDir::homeDirPath(); | 252 | QString path = QDir::homeDirPath(); |
236 | QString url = mStoreUrl->url(); | 253 | QString url = mStoreUrl->url(); |
237 | #ifdef DESKTOP_VERSION | 254 | #ifdef DESKTOP_VERSION |
238 | if ( url.startsWith( "LOCAL:" ) ) { | 255 | if ( url.startsWith( "LOCAL:" ) ) { |
239 | path = qApp->applicationDirPath () ; | 256 | path = qApp->applicationDirPath () ; |
240 | } | 257 | } |
241 | #endif | 258 | #endif |
242 | KConfig cfg ( path + "/.microkdehome" ); | 259 | KConfig cfg ( path + "/.microkdehome" ); |
243 | cfg.setGroup("Global"); | 260 | cfg.setGroup("Global"); |
244 | cfg.writeEntry( "MICROKDEHOME", url ); | 261 | cfg.writeEntry( "MICROKDEHOME", url ); |
245 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); | 262 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
246 | cfg.sync(); | 263 | cfg.sync(); |
264 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" )); | ||
247 | } else { | 265 | } else { |
248 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 266 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
249 | saveStoreSettings(); | 267 | saveStoreSettings(); |
250 | } | 268 | } |
251 | } | 269 | } |
252 | void KDEPIMConfigWidget::setupExternalAppTab() | 270 | void KDEPIMConfigWidget::setupExternalAppTab() |
253 | { | 271 | { |
254 | QWidget *externalAppsPage = new QWidget( this ); | 272 | QWidget *externalAppsPage = new QWidget( this ); |
255 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 273 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
256 | KDialog::spacingHintSmall() ); | 274 | KDialog::spacingHintSmall() ); |
257 | 275 | ||
258 | mExternalApps = new QComboBox( externalAppsPage ); | 276 | mExternalApps = new QComboBox( externalAppsPage ); |
259 | 277 | ||
260 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 278 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
261 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 279 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
262 | mExternalApps->insertItem( it.data(), it.key() ); | 280 | mExternalApps->insertItem( it.data(), it.key() ); |
263 | 281 | ||
264 | layout->addWidget( mExternalApps ); | 282 | layout->addWidget( mExternalApps ); |
265 | 283 | ||
266 | connect( mExternalApps, SIGNAL( activated( int ) ), | 284 | connect( mExternalApps, SIGNAL( activated( int ) ), |
267 | this, SLOT (externalapp_changed( int ) ) ); | 285 | this, SLOT (externalapp_changed( int ) ) ); |
268 | 286 | ||
269 | 287 | ||
270 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 288 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
271 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 289 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
272 | mExternalAppGroupBox->layout()->setMargin(4); | 290 | mExternalAppGroupBox->layout()->setMargin(4); |
273 | 291 | ||
274 | mClient = new QComboBox( mExternalAppGroupBox ); | 292 | mClient = new QComboBox( mExternalAppGroupBox ); |
275 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 293 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
276 | 294 | ||
277 | connect( mClient, SIGNAL( activated( int ) ), | 295 | connect( mClient, SIGNAL( activated( int ) ), |
278 | this, SLOT (client_changed( int ) ) ); | 296 | this, SLOT (client_changed( int ) ) ); |
279 | 297 | ||
280 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 298 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
281 | boxLayout->addWidget( lab, 1, 0 ); | 299 | boxLayout->addWidget( lab, 1, 0 ); |
282 | mChannel = new QLineEdit(mExternalAppGroupBox); | 300 | mChannel = new QLineEdit(mExternalAppGroupBox); |
283 | mChannel->setReadOnly(true); | 301 | mChannel->setReadOnly(true); |
284 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 302 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
285 | 303 | ||
286 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 304 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
287 | boxLayout->addWidget( lab, 3, 0 ); | 305 | boxLayout->addWidget( lab, 3, 0 ); |
288 | mMessage = new QLineEdit(mExternalAppGroupBox); | 306 | mMessage = new QLineEdit(mExternalAppGroupBox); |
289 | mMessage->setReadOnly(true); | 307 | mMessage->setReadOnly(true); |
290 | boxLayout->addWidget( mMessage , 4, 0); | 308 | boxLayout->addWidget( mMessage , 4, 0); |
291 | 309 | ||
292 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 310 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
293 | boxLayout->addWidget( lab, 3, 1 ); | 311 | boxLayout->addWidget( lab, 3, 1 ); |
294 | mParameters = new QLineEdit(mExternalAppGroupBox); | 312 | mParameters = new QLineEdit(mExternalAppGroupBox); |
295 | mParameters->setReadOnly(true); | 313 | mParameters->setReadOnly(true); |
296 | boxLayout->addWidget( mParameters, 4, 1 ); | 314 | boxLayout->addWidget( mParameters, 4, 1 ); |
297 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 315 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
298 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 316 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
299 | 317 | ||
300 | 318 | ||
301 | if ( QApplication::desktop()->height() > 240 ) { | 319 | if ( QApplication::desktop()->height() > 240 ) { |
302 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 320 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
303 | boxLayout->addWidget( lab, 6, 0 ); | 321 | boxLayout->addWidget( lab, 6, 0 ); |
304 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 322 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
305 | mMessage2->setReadOnly(true); | 323 | mMessage2->setReadOnly(true); |
306 | boxLayout->addWidget( mMessage2 , 7, 0); | 324 | boxLayout->addWidget( mMessage2 , 7, 0); |
307 | 325 | ||
308 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 326 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
309 | boxLayout->addWidget( lab, 6, 1 ); | 327 | boxLayout->addWidget( lab, 6, 1 ); |
310 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 328 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
311 | mParameters2->setReadOnly(true); | 329 | mParameters2->setReadOnly(true); |
312 | boxLayout->addWidget( mParameters2, 7, 1 ); | 330 | boxLayout->addWidget( mParameters2, 7, 1 ); |
313 | 331 | ||
314 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 332 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
315 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 333 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
316 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 334 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
317 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 335 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
318 | } else { | 336 | } else { |
319 | mMessage2 = 0; | 337 | mMessage2 = 0; |
320 | mParameters2 = 0; | 338 | mParameters2 = 0; |
321 | } | 339 | } |
322 | 340 | ||
323 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 341 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
324 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 342 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
325 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 343 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
326 | 344 | ||
327 | 345 | ||
328 | layout->addWidget( mExternalAppGroupBox ); | 346 | layout->addWidget( mExternalAppGroupBox ); |
329 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 347 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
330 | 348 | ||
331 | } | 349 | } |
332 | 350 | ||
333 | 351 | ||
334 | void KDEPIMConfigWidget::setupLocaleDateTab() | 352 | void KDEPIMConfigWidget::setupLocaleDateTab() |
335 | { | 353 | { |
336 | QWidget *topFrame = new QWidget( this ); | 354 | QWidget *topFrame = new QWidget( this ); |
337 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | 355 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); |
338 | 356 | ||
339 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 357 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
340 | topLayout->setMargin(KDialog::marginHintSmall()); | 358 | topLayout->setMargin(KDialog::marginHintSmall()); |
341 | int iii = 0; | 359 | int iii = 0; |
342 | 360 | ||
343 | 361 | ||
344 | KPrefsWidRadios *syncPrefsGroup = | 362 | KPrefsWidRadios *syncPrefsGroup = |
345 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | 363 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); |
346 | QString format; | 364 | QString format; |
347 | if ( QApplication::desktop()->width() < 480 ) | 365 | if ( QApplication::desktop()->width() < 480 ) |
348 | format = "(%d.%m.%Y)"; | 366 | format = "(%d.%m.%Y)"; |
349 | else | 367 | else |
350 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 368 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
351 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 369 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
352 | if ( QApplication::desktop()->width() < 480 ) | 370 | if ( QApplication::desktop()->width() < 480 ) |
353 | format = "(%m.%d.%Y)"; | 371 | format = "(%m.%d.%Y)"; |
354 | else | 372 | else |
355 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 373 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
356 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 374 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
357 | if ( QApplication::desktop()->width() < 480 ) | 375 | if ( QApplication::desktop()->width() < 480 ) |
358 | format = "(%Y-%m-%d)"; | 376 | format = "(%Y-%m-%d)"; |
359 | else | 377 | else |
360 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 378 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
361 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 379 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
362 | syncPrefsGroup->addRadio(i18n("User defined")); | 380 | syncPrefsGroup->addRadio(i18n("User defined")); |
363 | if ( QApplication::desktop()->width() < 480 ) { | 381 | if ( QApplication::desktop()->width() < 480 ) { |
364 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 382 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
365 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 383 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
366 | } | 384 | } |
367 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 385 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
368 | ++iii; | 386 | ++iii; |
369 | ++iii; | 387 | ++iii; |
370 | QLabel * lab; | 388 | QLabel * lab; |
371 | mUserDateFormatLong = new QLineEdit(topFrame); | 389 | mUserDateFormatLong = new QLineEdit(topFrame); |
372 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 390 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
373 | topLayout->addWidget(lab ,iii,0); | 391 | topLayout->addWidget(lab ,iii,0); |
374 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 392 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
375 | ++iii; | 393 | ++iii; |
376 | mUserDateFormatShort = new QLineEdit(topFrame); | 394 | mUserDateFormatShort = new QLineEdit(topFrame); |
377 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 395 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
378 | topLayout->addWidget(lab ,iii,0); | 396 | topLayout->addWidget(lab ,iii,0); |
379 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 397 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
380 | ++iii; | 398 | ++iii; |
381 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 399 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
382 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 400 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
383 | ++iii; | 401 | ++iii; |
384 | //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() ); | 402 | //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() ); |
385 | if ( QApplication::desktop()->height() > 240 ) { | 403 | if ( QApplication::desktop()->height() > 240 ) { |
386 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 404 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
387 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 405 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
388 | ++iii; | 406 | ++iii; |
389 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 407 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
390 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 408 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
391 | ++iii; | 409 | ++iii; |
392 | } | 410 | } |
393 | 411 | ||
394 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 412 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
395 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 413 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
396 | 414 | ||
397 | 415 | ||
398 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | 416 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); |
399 | } | 417 | } |
400 | 418 | ||
401 | void KDEPIMConfigWidget::setupLocaleTab() | 419 | void KDEPIMConfigWidget::setupLocaleTab() |
402 | { | 420 | { |
403 | 421 | ||
404 | QWidget *topFrame = new QWidget( this ); | 422 | QWidget *topFrame = new QWidget( this ); |
405 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 423 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
406 | 424 | ||
407 | topLayout->setSpacing(KDialog::spacingHint()); | 425 | topLayout->setSpacing(KDialog::spacingHint()); |
408 | topLayout->setMargin(KDialog::marginHint()); | 426 | topLayout->setMargin(KDialog::marginHint()); |
409 | int iii = 0; | 427 | int iii = 0; |
410 | KPrefsWidRadios *syncPrefsGroup = | 428 | KPrefsWidRadios *syncPrefsGroup = |
411 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | 429 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); |
412 | syncPrefsGroup->addRadio(i18n("English")); | 430 | syncPrefsGroup->addRadio(i18n("English")); |
413 | syncPrefsGroup->addRadio(i18n("German")); | 431 | syncPrefsGroup->addRadio(i18n("German")); |
414 | syncPrefsGroup->addRadio(i18n("French")); | 432 | syncPrefsGroup->addRadio(i18n("French")); |
415 | syncPrefsGroup->addRadio(i18n("Italian")); | 433 | syncPrefsGroup->addRadio(i18n("Italian")); |
416 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 434 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
417 | if ( QApplication::desktop()->width() < 300 ) { | 435 | if ( QApplication::desktop()->width() < 300 ) { |
418 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 436 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
419 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 437 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
420 | } | 438 | } |
421 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 439 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
422 | ++iii; | 440 | ++iii; |
423 | 441 | ||
424 | 442 | ||
425 | tabWidget->addTab( topFrame, i18n( "Language" ) ); | 443 | tabWidget->addTab( topFrame, i18n( "Language" ) ); |
426 | topFrame = new QWidget( this ); | 444 | topFrame = new QWidget( this ); |
427 | topLayout = new QGridLayout(topFrame,4,2); | 445 | topLayout = new QGridLayout(topFrame,4,2); |
428 | 446 | ||
429 | topLayout->setSpacing(KDialog::spacingHint()); | 447 | topLayout->setSpacing(KDialog::spacingHint()); |
430 | topLayout->setMargin(KDialog::marginHint()); | 448 | topLayout->setMargin(KDialog::marginHint()); |
431 | iii = 0; | 449 | iii = 0; |
432 | syncPrefsGroup = | 450 | syncPrefsGroup = |
433 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | 451 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); |
434 | if ( QApplication::desktop()->width() > 300 ) | 452 | if ( QApplication::desktop()->width() > 300 ) |
435 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 453 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
436 | syncPrefsGroup->addRadio(i18n("24:00")); | 454 | syncPrefsGroup->addRadio(i18n("24:00")); |
437 | syncPrefsGroup->addRadio(i18n("12:00am")); | 455 | syncPrefsGroup->addRadio(i18n("12:00am")); |
438 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 456 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
439 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 457 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
440 | ++iii; | 458 | ++iii; |
441 | 459 | ||
442 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | 460 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), |
443 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | 461 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); |
444 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 462 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
445 | ++iii; | 463 | ++iii; |
446 | 464 | ||
447 | 465 | ||
448 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); | 466 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); |
449 | 467 | ||
450 | } | 468 | } |
451 | 469 | ||
452 | 470 | ||
453 | void KDEPIMConfigWidget::setupTimeZoneTab() | 471 | void KDEPIMConfigWidget::setupTimeZoneTab() |
454 | { | 472 | { |
455 | QWidget *topFrame; | 473 | QWidget *topFrame; |
456 | QGridLayout *topLayout ; | 474 | QGridLayout *topLayout ; |
457 | 475 | ||
458 | 476 | ||
459 | 477 | ||
460 | 478 | ||
461 | 479 | ||
462 | 480 | ||
463 | topFrame = new QWidget( this ); | 481 | topFrame = new QWidget( this ); |
464 | topLayout = new QGridLayout( topFrame, 5, 2); | 482 | topLayout = new QGridLayout( topFrame, 5, 2); |
465 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 483 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
466 | topLayout->setMargin(KDialog::marginHintSmall()); | 484 | topLayout->setMargin(KDialog::marginHintSmall()); |
467 | 485 | ||
468 | QHBox *timeZoneBox = new QHBox( topFrame ); | 486 | QHBox *timeZoneBox = new QHBox( topFrame ); |
469 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 487 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
470 | 488 | ||
471 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 489 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
472 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 490 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
473 | if ( QApplication::desktop()->width() < 300 ) { | 491 | if ( QApplication::desktop()->width() < 300 ) { |
474 | mTimeZoneCombo->setMaximumWidth(150); | 492 | mTimeZoneCombo->setMaximumWidth(150); |
475 | } | 493 | } |
476 | 494 | ||
477 | QStringList list; | 495 | QStringList list; |
478 | list = KGlobal::locale()->timeZoneList(); | 496 | list = KGlobal::locale()->timeZoneList(); |
479 | mTimeZoneCombo->insertStringList(list); | 497 | mTimeZoneCombo->insertStringList(list); |
480 | 498 | ||
481 | // find the currently set time zone and select it | 499 | // find the currently set time zone and select it |
482 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | 500 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; |
483 | int nCurrentlySet = 11; | 501 | int nCurrentlySet = 11; |
484 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 502 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
485 | { | 503 | { |
486 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 504 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
487 | { | 505 | { |
488 | nCurrentlySet = i; | 506 | nCurrentlySet = i; |
489 | break; | 507 | break; |
490 | } | 508 | } |
491 | } | 509 | } |
492 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 510 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
493 | int iii = 1; | 511 | int iii = 1; |
494 | KPrefsWidBool *sb = | 512 | KPrefsWidBool *sb = |
495 | addWidBool(i18n("Add 30 min to selected Timezone"), | 513 | addWidBool(i18n("Add 30 min to selected Timezone"), |
496 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); | 514 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); |
497 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 515 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
498 | ++iii; | 516 | ++iii; |
499 | sb = | 517 | sb = |
500 | addWidBool(i18n("Timezone has daylight saving"), | 518 | addWidBool(i18n("Timezone has daylight saving"), |
501 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | 519 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); |
502 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 520 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
503 | ++iii; | 521 | ++iii; |
504 | QLabel* lab; | 522 | QLabel* lab; |
505 | 523 | ||
506 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 524 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
507 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 525 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
508 | ++iii; | 526 | ++iii; |
509 | 527 | ||
510 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 528 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
511 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 529 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
512 | ++iii; | 530 | ++iii; |
513 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 531 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
514 | topLayout->addWidget(lab, iii,0); | 532 | topLayout->addWidget(lab, iii,0); |
515 | mStartDateSavingEdit = new KDateEdit(topFrame); | 533 | mStartDateSavingEdit = new KDateEdit(topFrame); |
516 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 534 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
517 | ++iii; | 535 | ++iii; |
518 | 536 | ||
519 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 537 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
520 | topLayout->addWidget(lab, iii,0); | 538 | topLayout->addWidget(lab, iii,0); |
521 | mEndDateSavingEdit = new KDateEdit(topFrame); | 539 | mEndDateSavingEdit = new KDateEdit(topFrame); |
522 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 540 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
523 | ++iii; | 541 | ++iii; |
524 | QDate current ( 2001, 1,1); | 542 | QDate current ( 2001, 1,1); |
525 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | 543 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); |
526 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | 544 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); |
527 | 545 | ||
528 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 546 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
529 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 547 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
530 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | 548 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); |
531 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | 549 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); |
532 | 550 | ||
533 | 551 | ||
534 | topFrame = new QWidget( this ); | 552 | topFrame = new QWidget( this ); |
535 | topLayout = new QGridLayout( topFrame, 3, 2); | 553 | topLayout = new QGridLayout( topFrame, 3, 2); |
536 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 554 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
537 | topLayout->setMargin(KDialog::marginHintSmall()); | 555 | topLayout->setMargin(KDialog::marginHintSmall()); |
538 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); | 556 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); |
539 | 557 | ||
540 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); | 558 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); |
541 | topLayout->addMultiCellWidget(labb,0,0,0,2); | 559 | topLayout->addMultiCellWidget(labb,0,0,0,2); |
542 | int i = 1; | 560 | int i = 1; |
543 | KPrefsWidFont *timeLabelsFont = | 561 | KPrefsWidFont *timeLabelsFont = |
544 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), | 562 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), |
545 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); | 563 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); |
546 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 564 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
547 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 565 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
548 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 566 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
549 | } | 567 | } |
550 | 568 | ||
551 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 569 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
552 | { | 570 | { |
553 | // first store the current data | 571 | // first store the current data |
554 | saveEditFieldSettings(); | 572 | saveEditFieldSettings(); |
555 | 573 | ||
556 | // set mCurrentApp | 574 | // set mCurrentApp |
557 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 575 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
558 | 576 | ||
559 | // set mCurrentClient | 577 | // set mCurrentClient |
560 | switch(mCurrentApp) | 578 | switch(mCurrentApp) |
561 | { | 579 | { |
562 | case(ExternalAppHandler::EMAIL): | 580 | case(ExternalAppHandler::EMAIL): |
563 | mCurrentClient = mEmailClient; | 581 | mCurrentClient = mEmailClient; |
564 | break; | 582 | break; |
565 | case(ExternalAppHandler::PHONE): | 583 | case(ExternalAppHandler::PHONE): |
566 | mCurrentClient = mPhoneClient; | 584 | mCurrentClient = mPhoneClient; |
567 | break; | 585 | break; |
568 | case(ExternalAppHandler::SMS): | 586 | case(ExternalAppHandler::SMS): |
569 | mCurrentClient = mSMSClient; | 587 | mCurrentClient = mSMSClient; |
570 | break; | 588 | break; |
571 | case(ExternalAppHandler::FAX): | 589 | case(ExternalAppHandler::FAX): |
572 | mCurrentClient = mFaxClient; | 590 | mCurrentClient = mFaxClient; |
573 | break; | 591 | break; |
574 | case(ExternalAppHandler::PAGER): | 592 | case(ExternalAppHandler::PAGER): |
575 | mCurrentClient = mPagerClient; | 593 | mCurrentClient = mPagerClient; |
576 | break; | 594 | break; |
577 | case(ExternalAppHandler::SIP): | 595 | case(ExternalAppHandler::SIP): |
578 | mCurrentClient = mSipClient; | 596 | mCurrentClient = mSipClient; |
579 | break; | 597 | break; |
580 | default: | 598 | default: |
581 | return; | 599 | return; |
582 | } | 600 | } |
583 | 601 | ||
584 | // and at last update the widgets | 602 | // and at last update the widgets |
585 | updateClientWidgets(); | 603 | updateClientWidgets(); |
586 | } | 604 | } |
587 | 605 | ||
588 | 606 | ||
589 | 607 | ||
590 | void KDEPIMConfigWidget::client_changed( int newClient ) | 608 | void KDEPIMConfigWidget::client_changed( int newClient ) |
591 | { | 609 | { |
592 | if (newClient == mCurrentClient) | 610 | if (newClient == mCurrentClient) |
593 | return; | 611 | return; |
594 | 612 | ||
595 | // first store the current data | 613 | // first store the current data |
596 | saveEditFieldSettings(); | 614 | saveEditFieldSettings(); |
597 | 615 | ||
598 | 616 | ||
599 | //then reset the clientvariable | 617 | //then reset the clientvariable |
600 | mCurrentClient = newClient; | 618 | mCurrentClient = newClient; |
601 | 619 | ||
602 | // and at last update the widgets | 620 | // and at last update the widgets |
603 | updateClientWidgets(); | 621 | updateClientWidgets(); |
604 | 622 | ||
605 | KPrefsWidget::modified(); | 623 | KPrefsWidget::modified(); |
606 | } | 624 | } |
607 | 625 | ||
608 | void KDEPIMConfigWidget::saveEditFieldSettings() | 626 | void KDEPIMConfigWidget::saveEditFieldSettings() |
609 | { | 627 | { |
610 | 628 | ||
611 | switch(mCurrentApp) | 629 | switch(mCurrentApp) |
612 | { | 630 | { |
613 | case(ExternalAppHandler::EMAIL): | 631 | case(ExternalAppHandler::EMAIL): |
614 | mEmailClient = mClient->currentItem(); | 632 | mEmailClient = mClient->currentItem(); |
615 | break; | 633 | break; |
616 | case(ExternalAppHandler::PHONE): | 634 | case(ExternalAppHandler::PHONE): |
617 | mPhoneClient= mClient->currentItem(); | 635 | mPhoneClient= mClient->currentItem(); |
618 | break; | 636 | break; |
619 | case(ExternalAppHandler::SMS): | 637 | case(ExternalAppHandler::SMS): |
620 | mSMSClient = mClient->currentItem(); | 638 | mSMSClient = mClient->currentItem(); |
621 | break; | 639 | break; |
622 | case(ExternalAppHandler::FAX): | 640 | case(ExternalAppHandler::FAX): |
623 | mFaxClient = mClient->currentItem(); | 641 | mFaxClient = mClient->currentItem(); |
624 | break; | 642 | break; |
625 | case(ExternalAppHandler::PAGER): | 643 | case(ExternalAppHandler::PAGER): |
626 | mPagerClient = mClient->currentItem(); | 644 | mPagerClient = mClient->currentItem(); |
627 | break; | 645 | break; |
628 | case(ExternalAppHandler::SIP): | 646 | case(ExternalAppHandler::SIP): |
629 | mSipClient = mClient->currentItem(); | 647 | mSipClient = mClient->currentItem(); |
630 | break; | 648 | break; |
631 | default: | 649 | default: |
632 | return; | 650 | return; |
633 | } | 651 | } |
634 | 652 | ||
635 | //store the current data back to the apropriate membervariables if we had set it to "other" | 653 | //store the current data back to the apropriate membervariables if we had set it to "other" |
636 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 654 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
637 | { | 655 | { |
638 | mEmailOtherChannel = mChannel->text(); | 656 | mEmailOtherChannel = mChannel->text(); |
639 | mEmailOtherMessage = mMessage->text(); | 657 | mEmailOtherMessage = mMessage->text(); |
640 | mEmailOtherMessageParameters = mParameters->text(); | 658 | mEmailOtherMessageParameters = mParameters->text(); |
641 | if ( mMessage2 ) | 659 | if ( mMessage2 ) |
642 | mEmailOtherMessage2 = mMessage2->text(); | 660 | mEmailOtherMessage2 = mMessage2->text(); |
643 | if ( mParameters2 ) | 661 | if ( mParameters2 ) |
644 | mEmailOtherMessageParameters2 = mParameters2->text(); | 662 | mEmailOtherMessageParameters2 = mParameters2->text(); |
645 | } | 663 | } |
646 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 664 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
647 | { | 665 | { |
648 | mPhoneOtherChannel = mChannel->text(); | 666 | mPhoneOtherChannel = mChannel->text(); |
649 | mPhoneOtherMessage = mMessage->text(); | 667 | mPhoneOtherMessage = mMessage->text(); |
650 | mPhoneOtherMessageParameters = mParameters->text(); | 668 | mPhoneOtherMessageParameters = mParameters->text(); |
651 | } | 669 | } |
652 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 670 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
653 | { | 671 | { |
654 | mSMSOtherChannel = mChannel->text(); | 672 | mSMSOtherChannel = mChannel->text(); |
655 | mSMSOtherMessage = mMessage->text(); | 673 | mSMSOtherMessage = mMessage->text(); |
656 | mSMSOtherMessageParameters = mParameters->text(); | 674 | mSMSOtherMessageParameters = mParameters->text(); |
657 | } | 675 | } |
658 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 676 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
659 | { | 677 | { |
660 | mFaxOtherChannel = mChannel->text(); | 678 | mFaxOtherChannel = mChannel->text(); |
661 | mFaxOtherMessage = mMessage->text(); | 679 | mFaxOtherMessage = mMessage->text(); |
662 | mFaxOtherMessageParameters = mParameters->text(); | 680 | mFaxOtherMessageParameters = mParameters->text(); |
663 | } | 681 | } |
664 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 682 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
665 | { | 683 | { |
666 | mPagerOtherChannel = mChannel->text(); | 684 | mPagerOtherChannel = mChannel->text(); |
667 | mPagerOtherMessage = mMessage->text(); | 685 | mPagerOtherMessage = mMessage->text(); |
668 | mPagerOtherMessageParameters = mParameters->text(); | 686 | mPagerOtherMessageParameters = mParameters->text(); |
669 | } | 687 | } |
670 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 688 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
671 | { | 689 | { |
672 | mSipOtherChannel = mChannel->text(); | 690 | mSipOtherChannel = mChannel->text(); |
673 | mSipOtherMessage = mMessage->text(); | 691 | mSipOtherMessage = mMessage->text(); |
674 | mSipOtherMessageParameters = mParameters->text(); | 692 | mSipOtherMessageParameters = mParameters->text(); |
675 | } | 693 | } |
676 | 694 | ||
677 | 695 | ||
678 | } | 696 | } |
679 | 697 | ||
680 | void KDEPIMConfigWidget::updateClientWidgets() | 698 | void KDEPIMConfigWidget::updateClientWidgets() |
681 | { | 699 | { |
682 | bool blocked = signalsBlocked(); | 700 | bool blocked = signalsBlocked(); |
683 | blockSignals( true ); | 701 | blockSignals( true ); |
684 | 702 | ||
685 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 703 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
686 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 704 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
687 | if (it == mExternalAppsMap.end()) | 705 | if (it == mExternalAppsMap.end()) |
688 | return; | 706 | return; |
689 | 707 | ||
690 | // update group box | 708 | // update group box |
691 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 709 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
692 | 710 | ||
693 | //update the entries in the client combobox | 711 | //update the entries in the client combobox |
694 | mClient->clear(); | 712 | mClient->clear(); |
695 | 713 | ||
696 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 714 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
697 | DefaultAppItem* dai; | 715 | DefaultAppItem* dai; |
698 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 716 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
699 | { | 717 | { |
700 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 718 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
701 | 719 | ||
702 | if (dai->_id == mCurrentClient) | 720 | if (dai->_id == mCurrentClient) |
703 | { | 721 | { |
704 | //restore the edit fields with the data of the local membervariables if we had set it to "other". | 722 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
705 | //Otherwise take the default data from externalapphandler. | 723 | //Otherwise take the default data from externalapphandler. |
706 | mChannel->setText(dai->_channel); | 724 | mChannel->setText(dai->_channel); |
707 | mMessage->setText(dai->_message); | 725 | mMessage->setText(dai->_message); |
708 | mParameters->setText(dai->_parameters); | 726 | mParameters->setText(dai->_parameters); |
709 | if ( mMessage2 ) | 727 | if ( mMessage2 ) |
710 | mMessage2->setText(dai->_message2); | 728 | mMessage2->setText(dai->_message2); |
711 | if ( mParameters2 ) | 729 | if ( mParameters2 ) |
712 | mParameters2->setText(dai->_parameters2); | 730 | mParameters2->setText(dai->_parameters2); |
713 | 731 | ||
714 | 732 | ||
715 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 733 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
716 | { | 734 | { |
717 | mChannel->setText(mEmailOtherChannel); | 735 | mChannel->setText(mEmailOtherChannel); |
718 | mMessage->setText(mEmailOtherMessage); | 736 | mMessage->setText(mEmailOtherMessage); |
719 | mParameters->setText(mEmailOtherMessageParameters); | 737 | mParameters->setText(mEmailOtherMessageParameters); |
720 | if ( mMessage2 ) | 738 | if ( mMessage2 ) |
721 | mMessage2->setText(mEmailOtherMessage2); | 739 | mMessage2->setText(mEmailOtherMessage2); |
722 | if ( mParameters2 ) | 740 | if ( mParameters2 ) |
723 | mParameters2->setText(mEmailOtherMessageParameters2); | 741 | mParameters2->setText(mEmailOtherMessageParameters2); |
724 | } | 742 | } |
725 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 743 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
726 | { | 744 | { |
727 | mChannel->setText(mPhoneOtherChannel); | 745 | mChannel->setText(mPhoneOtherChannel); |
728 | mMessage->setText(mPhoneOtherMessage); | 746 | mMessage->setText(mPhoneOtherMessage); |
729 | mParameters->setText(mPhoneOtherMessageParameters); | 747 | mParameters->setText(mPhoneOtherMessageParameters); |
730 | } | 748 | } |
731 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 749 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
732 | { | 750 | { |
733 | mChannel->setText(mSMSOtherChannel); | 751 | mChannel->setText(mSMSOtherChannel); |
734 | mMessage->setText(mSMSOtherMessage); | 752 | mMessage->setText(mSMSOtherMessage); |
735 | mParameters->setText(mSMSOtherMessageParameters); | 753 | mParameters->setText(mSMSOtherMessageParameters); |
736 | } | 754 | } |
737 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 755 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
738 | { | 756 | { |
739 | mChannel->setText(mFaxOtherChannel); | 757 | mChannel->setText(mFaxOtherChannel); |
740 | mMessage->setText(mFaxOtherMessage); | 758 | mMessage->setText(mFaxOtherMessage); |
741 | mParameters->setText(mFaxOtherMessageParameters); | 759 | mParameters->setText(mFaxOtherMessageParameters); |
742 | } | 760 | } |
743 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 761 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
744 | { | 762 | { |
745 | mChannel->setText(mPagerOtherChannel); | 763 | mChannel->setText(mPagerOtherChannel); |
746 | mMessage->setText(mPagerOtherMessage); | 764 | mMessage->setText(mPagerOtherMessage); |
747 | mParameters->setText(mPagerOtherMessageParameters); | 765 | mParameters->setText(mPagerOtherMessageParameters); |
748 | } | 766 | } |
749 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 767 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
750 | { | 768 | { |
751 | mChannel->setText(mSipOtherChannel); | 769 | mChannel->setText(mSipOtherChannel); |
752 | mMessage->setText(mSipOtherMessage); | 770 | mMessage->setText(mSipOtherMessage); |
753 | mParameters->setText(mSipOtherMessageParameters); | 771 | mParameters->setText(mSipOtherMessageParameters); |
754 | } | 772 | } |
755 | } | 773 | } |
756 | 774 | ||
757 | } | 775 | } |
758 | 776 | ||
759 | bool readonly; | 777 | bool readonly; |
760 | bool enabled; | 778 | bool enabled; |
761 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 779 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
762 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 780 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
763 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 781 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
764 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 782 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
765 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 783 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
766 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) | 784 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) |
767 | { | 785 | { |
768 | readonly = false; | 786 | readonly = false; |
769 | } | 787 | } |
770 | else | 788 | else |
771 | { | 789 | { |
772 | readonly = true; | 790 | readonly = true; |
773 | } | 791 | } |
774 | 792 | ||
775 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) | 793 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) |
776 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) | 794 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) |
777 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) | 795 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) |
778 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) | 796 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) |
779 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) | 797 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) |
780 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) | 798 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) |
781 | { | 799 | { |
782 | enabled = false; | 800 | enabled = false; |
783 | } | 801 | } |
784 | else | 802 | else |
785 | { | 803 | { |
786 | enabled = true; | 804 | enabled = true; |
787 | } | 805 | } |
788 | 806 | ||
789 | 807 | ||
790 | mChannel->setReadOnly(readonly); | 808 | mChannel->setReadOnly(readonly); |
791 | mMessage->setReadOnly(readonly); | 809 | mMessage->setReadOnly(readonly); |
792 | mParameters->setReadOnly(readonly); | 810 | mParameters->setReadOnly(readonly); |
793 | if ( mMessage2 ) | 811 | if ( mMessage2 ) |
794 | mMessage2->setReadOnly(readonly); | 812 | mMessage2->setReadOnly(readonly); |
795 | if ( mParameters2 ) | 813 | if ( mParameters2 ) |
796 | mParameters2->setReadOnly(readonly); | 814 | mParameters2->setReadOnly(readonly); |
797 | 815 | ||
798 | mChannel->setEnabled(enabled); | 816 | mChannel->setEnabled(enabled); |
799 | mMessage->setEnabled(enabled); | 817 | mMessage->setEnabled(enabled); |
800 | mParameters->setEnabled(enabled); | 818 | mParameters->setEnabled(enabled); |
801 | if ( mMessage2 ) | 819 | if ( mMessage2 ) |
802 | mMessage2->setEnabled(enabled); | 820 | mMessage2->setEnabled(enabled); |
803 | if ( mParameters2 ) | 821 | if ( mParameters2 ) |
804 | mParameters2->setEnabled(enabled); | 822 | mParameters2->setEnabled(enabled); |
805 | 823 | ||
806 | 824 | ||
807 | 825 | ||
808 | mClient->setCurrentItem(mCurrentClient); | 826 | mClient->setCurrentItem(mCurrentClient); |
809 | 827 | ||
810 | 828 | ||
811 | // enable/disable the extra message/parameter field | 829 | // enable/disable the extra message/parameter field |
812 | if (mCurrentApp == ExternalAppHandler::EMAIL) | 830 | if (mCurrentApp == ExternalAppHandler::EMAIL) |
813 | { | 831 | { |
814 | } | 832 | } |
815 | else | 833 | else |
816 | { | 834 | { |
817 | if ( mMessage2 ) | 835 | if ( mMessage2 ) |
818 | mMessage2->setText( "" ); | 836 | mMessage2->setText( "" ); |
819 | if ( mParameters2 ) | 837 | if ( mParameters2 ) |
820 | mParameters2->setText( "" ); | 838 | mParameters2->setText( "" ); |
821 | } | 839 | } |
822 | 840 | ||
823 | if (enabled == true) { | 841 | if (enabled == true) { |
824 | if ( mMessage2 ) | 842 | if ( mMessage2 ) |
825 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 843 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
826 | if ( mParameters2 ) | 844 | if ( mParameters2 ) |
827 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 845 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
828 | } | 846 | } |
829 | 847 | ||
830 | 848 | ||
831 | blockSignals( blocked ); | 849 | blockSignals( blocked ); |
832 | 850 | ||
833 | } | 851 | } |
834 | 852 | ||
835 | void KDEPIMConfigWidget::usrReadConfig() | 853 | void KDEPIMConfigWidget::usrReadConfig() |
836 | { | 854 | { |
837 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 855 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
838 | 856 | ||
839 | bool blocked = signalsBlocked(); | 857 | bool blocked = signalsBlocked(); |
840 | blockSignals( true ); | 858 | blockSignals( true ); |
841 | 859 | ||
842 | if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) | 860 | if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) |
843 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | 861 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); |
844 | else | 862 | else { |
845 | mBackupUrl->setURL(prefs->mBackupDatadir); | 863 | mBackupUrl->setURL(prefs->mBackupDatadir); |
864 | |||
865 | } | ||
846 | mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); | 866 | mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); |
847 | mBackupDayCountSpin->setValue( prefs->mBackupDayCount); | 867 | mBackupDayCountSpin->setValue( prefs->mBackupDayCount); |
848 | 868 | ||
849 | QString dummy = prefs->mUserDateFormatLong; | 869 | QString dummy = prefs->mUserDateFormatLong; |
850 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 870 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
851 | dummy = prefs->mUserDateFormatShort; | 871 | dummy = prefs->mUserDateFormatShort; |
852 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 872 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
853 | 873 | ||
854 | QDate current ( 2001, 1,1); | 874 | QDate current ( 2001, 1,1); |
855 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); | 875 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); |
856 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); | 876 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); |
857 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); | 877 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); |
858 | 878 | ||
859 | mEmailClient = prefs->mEmailClient; | 879 | mEmailClient = prefs->mEmailClient; |
860 | mEmailOtherChannel = prefs->mEmailOtherChannel; | 880 | mEmailOtherChannel = prefs->mEmailOtherChannel; |
861 | mEmailOtherMessage = prefs->mEmailOtherMessage; | 881 | mEmailOtherMessage = prefs->mEmailOtherMessage; |
862 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; | 882 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; |
863 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; | 883 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; |
864 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; | 884 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; |
865 | 885 | ||
866 | mPhoneClient = prefs->mPhoneClient; | 886 | mPhoneClient = prefs->mPhoneClient; |
867 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; | 887 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; |
868 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; | 888 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; |
869 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; | 889 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; |
870 | 890 | ||
871 | mFaxClient = prefs->mFaxClient; | 891 | mFaxClient = prefs->mFaxClient; |
872 | mFaxOtherChannel = prefs->mFaxOtherChannel; | 892 | mFaxOtherChannel = prefs->mFaxOtherChannel; |
873 | mFaxOtherMessage = prefs->mFaxOtherMessage; | 893 | mFaxOtherMessage = prefs->mFaxOtherMessage; |
874 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; | 894 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; |
875 | 895 | ||
876 | mSMSClient = prefs->mSMSClient; | 896 | mSMSClient = prefs->mSMSClient; |
877 | mSMSOtherChannel = prefs->mSMSOtherChannel; | 897 | mSMSOtherChannel = prefs->mSMSOtherChannel; |
878 | mSMSOtherMessage = prefs->mSMSOtherMessage; | 898 | mSMSOtherMessage = prefs->mSMSOtherMessage; |
879 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; | 899 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; |
880 | 900 | ||
881 | mPagerClient = prefs->mPagerClient; | 901 | mPagerClient = prefs->mPagerClient; |
882 | mPagerOtherChannel = prefs->mPagerOtherChannel; | 902 | mPagerOtherChannel = prefs->mPagerOtherChannel; |
883 | mPagerOtherMessage = prefs->mPagerOtherMessage; | 903 | mPagerOtherMessage = prefs->mPagerOtherMessage; |
884 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; | 904 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; |
885 | 905 | ||
886 | mSipClient = prefs->mSipClient; | 906 | mSipClient = prefs->mSipClient; |
887 | mSipOtherChannel = prefs->mSipOtherChannel; | 907 | mSipOtherChannel = prefs->mSipOtherChannel; |
888 | mSipOtherMessage = prefs->mSipOtherMessage; | 908 | mSipOtherMessage = prefs->mSipOtherMessage; |
889 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; | 909 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; |
890 | 910 | ||
891 | mCurrentApp = ExternalAppHandler::EMAIL; | 911 | mCurrentApp = ExternalAppHandler::EMAIL; |
892 | mCurrentClient = mEmailClient; | 912 | mCurrentClient = mEmailClient; |
893 | 913 | ||
894 | updateClientWidgets(); | 914 | updateClientWidgets(); |
895 | 915 | ||
896 | blockSignals( blocked ); | 916 | blockSignals( blocked ); |
897 | 917 | ||
898 | } | 918 | } |
899 | 919 | ||
900 | void KDEPIMConfigWidget::usrWriteConfig() | 920 | void KDEPIMConfigWidget::usrWriteConfig() |
901 | { | 921 | { |
902 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 922 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
903 | 923 | ||
904 | saveEditFieldSettings(); | 924 | saveEditFieldSettings(); |
905 | 925 | ||
906 | prefs->mBackupNumbers = mBackupNumbersSpin->value(); | 926 | prefs->mBackupNumbers = mBackupNumbersSpin->value(); |
907 | prefs->mBackupDayCount = mBackupDayCountSpin->value(); | 927 | prefs->mBackupDayCount = mBackupDayCountSpin->value(); |
908 | prefs->mBackupDatadir = mBackupUrl->url(); | 928 | prefs->mBackupDatadir = mBackupUrl->url(); |
909 | 929 | ||
910 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 930 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
911 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 931 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
912 | 932 | ||
913 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); | 933 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); |
914 | QDate date; | 934 | QDate date; |
915 | date = mStartDateSavingEdit->date(); | 935 | date = mStartDateSavingEdit->date(); |
916 | int sub = 0; | 936 | int sub = 0; |
917 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 937 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
918 | sub = 1; | 938 | sub = 1; |
919 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; | 939 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; |
920 | date = mEndDateSavingEdit->date(); | 940 | date = mEndDateSavingEdit->date(); |
921 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 941 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
922 | sub = 1; | 942 | sub = 1; |
923 | else | 943 | else |
924 | sub = 0; | 944 | sub = 0; |
925 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; | 945 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; |
926 | 946 | ||
927 | 947 | ||
928 | prefs->mEmailClient = mEmailClient; | 948 | prefs->mEmailClient = mEmailClient; |
929 | prefs->mEmailOtherChannel = mEmailOtherChannel; | 949 | prefs->mEmailOtherChannel = mEmailOtherChannel; |
930 | prefs->mEmailOtherMessage = mEmailOtherMessage; | 950 | prefs->mEmailOtherMessage = mEmailOtherMessage; |
931 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; | 951 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; |
932 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; | 952 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; |
933 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; | 953 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; |
934 | 954 | ||
935 | prefs->mPhoneClient = mPhoneClient; | 955 | prefs->mPhoneClient = mPhoneClient; |
936 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; | 956 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; |
937 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; | 957 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; |
938 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; | 958 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; |
939 | 959 | ||
940 | prefs->mFaxClient = mFaxClient; | 960 | prefs->mFaxClient = mFaxClient; |
941 | prefs->mFaxOtherChannel = mFaxOtherChannel; | 961 | prefs->mFaxOtherChannel = mFaxOtherChannel; |
942 | prefs->mFaxOtherMessage = mFaxOtherMessage; | 962 | prefs->mFaxOtherMessage = mFaxOtherMessage; |
943 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; | 963 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; |
944 | 964 | ||
945 | prefs->mSMSClient = mSMSClient; | 965 | prefs->mSMSClient = mSMSClient; |
946 | prefs->mSMSOtherChannel = mSMSOtherChannel; | 966 | prefs->mSMSOtherChannel = mSMSOtherChannel; |
947 | prefs->mSMSOtherMessage = mSMSOtherMessage; | 967 | prefs->mSMSOtherMessage = mSMSOtherMessage; |
948 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; | 968 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; |
949 | 969 | ||
950 | prefs->mPagerClient = mPagerClient; | 970 | prefs->mPagerClient = mPagerClient; |
951 | prefs->mPagerOtherChannel = mPagerOtherChannel; | 971 | prefs->mPagerOtherChannel = mPagerOtherChannel; |
952 | prefs->mPagerOtherMessage = mPagerOtherMessage; | 972 | prefs->mPagerOtherMessage = mPagerOtherMessage; |
953 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; | 973 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; |
954 | 974 | ||
955 | 975 | ||
956 | prefs->mSipClient = mSipClient; | 976 | prefs->mSipClient = mSipClient; |
957 | prefs->mSipOtherChannel = mSipOtherChannel; | 977 | prefs->mSipOtherChannel = mSipOtherChannel; |
958 | prefs->mSipOtherMessage = mSipOtherMessage; | 978 | prefs->mSipOtherMessage = mSipOtherMessage; |
959 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; | 979 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; |
960 | 980 | ||
961 | //release the cache that other views can access the changed values instantanious | 981 | //release the cache that other views can access the changed values instantanious |
962 | ExternalAppHandler::instance()->loadConfig(); | 982 | ExternalAppHandler::instance()->loadConfig(); |
963 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 983 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
964 | } | 984 | } |
965 | 985 | ||
966 | 986 | ||
967 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, | 987 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, |
968 | const QStringList *tags) | 988 | const QStringList *tags) |
969 | { | 989 | { |
970 | if (tags) { | 990 | if (tags) { |
971 | int i = tags->findIndex(text); | 991 | int i = tags->findIndex(text); |
972 | if (i > 0) combo->setCurrentItem(i); | 992 | if (i > 0) combo->setCurrentItem(i); |
973 | } else { | 993 | } else { |
974 | for(int i=0;i<combo->count();++i) { | 994 | for(int i=0;i<combo->count();++i) { |
975 | if (combo->text(i) == text) { | 995 | if (combo->text(i) == text) { |
976 | combo->setCurrentItem(i); | 996 | combo->setCurrentItem(i); |
977 | break; | 997 | break; |
978 | } | 998 | } |
979 | } | 999 | } |
980 | } | 1000 | } |
981 | } | 1001 | } |
982 | 1002 | ||
983 | 1003 | ||
984 | void KDEPIMConfigWidget::textChanged( const QString& text ) | 1004 | void KDEPIMConfigWidget::textChanged( const QString& text ) |
985 | { | 1005 | { |
986 | emit changed( true ); | 1006 | emit changed( true ); |
987 | } | 1007 | } |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h index c0b92a9..824ef79 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.h +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h | |||
@@ -1,163 +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 | void setupBackupTab(); |
83 | KURLRequester* mStoreUrl; | 83 | KURLRequester* mStoreUrl; |
84 | 84 | ||
85 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | 85 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); |
86 | 86 | ||
87 | 87 | ||
88 | void saveEditFieldSettings(); | 88 | void saveEditFieldSettings(); |
89 | void updateClientWidgets(); | 89 | void updateClientWidgets(); |
90 | 90 | ||
91 | QTabWidget *tabWidget; | 91 | QTabWidget *tabWidget; |
92 | 92 | ||
93 | 93 | ||
94 | QLineEdit* mUserDateFormatShort; | 94 | QLineEdit* mUserDateFormatShort; |
95 | QLineEdit* mUserDateFormatLong; | 95 | QLineEdit* mUserDateFormatLong; |
96 | QComboBox* mTimeZoneCombo; | 96 | QComboBox* mTimeZoneCombo; |
97 | KDateEdit* mStartDateSavingEdit; | 97 | KDateEdit* mStartDateSavingEdit; |
98 | KDateEdit* mEndDateSavingEdit; | 98 | KDateEdit* mEndDateSavingEdit; |
99 | 99 | ||
100 | // void restoreExtensionSettings(); | 100 | // void restoreExtensionSettings(); |
101 | // void saveExtensionSettings(); | 101 | // void saveExtensionSettings(); |
102 | 102 | ||
103 | // KListView *mExtensionView; | 103 | // KListView *mExtensionView; |
104 | 104 | ||
105 | // QCheckBox *mNameParsing; | 105 | // QCheckBox *mNameParsing; |
106 | // QCheckBox *mViewsSingleClickBox; | 106 | // QCheckBox *mViewsSingleClickBox; |
107 | // QPushButton *mConfigureButton; | 107 | // QPushButton *mConfigureButton; |
108 | QComboBox* mExternalApps; | 108 | QComboBox* mExternalApps; |
109 | QGroupBox* mExternalAppGroupBox; | 109 | QGroupBox* mExternalAppGroupBox; |
110 | 110 | ||
111 | 111 | ||
112 | QComboBox* mClient; | 112 | QComboBox* mClient; |
113 | QLineEdit* mChannel; | 113 | QLineEdit* mChannel; |
114 | QLineEdit* mMessage; | 114 | QLineEdit* mMessage; |
115 | QLineEdit* mParameters; | 115 | QLineEdit* mParameters; |
116 | QLineEdit* mMessage2; | 116 | QLineEdit* mMessage2; |
117 | QLineEdit* mParameters2; | 117 | QLineEdit* mParameters2; |
118 | 118 | ||
119 | ExternalAppHandler::Types mCurrentApp; | 119 | ExternalAppHandler::Types mCurrentApp; |
120 | int mCurrentClient; | 120 | int mCurrentClient; |
121 | 121 | ||
122 | 122 | ||
123 | int mEmailClient; | 123 | int mEmailClient; |
124 | QString mEmailOtherChannel; | 124 | QString mEmailOtherChannel; |
125 | QString mEmailOtherMessage; | 125 | QString mEmailOtherMessage; |
126 | QString mEmailOtherMessageParameters; | 126 | QString mEmailOtherMessageParameters; |
127 | QString mEmailOtherMessage2; | 127 | QString mEmailOtherMessage2; |
128 | QString mEmailOtherMessageParameters2; | 128 | QString mEmailOtherMessageParameters2; |
129 | 129 | ||
130 | int mPhoneClient; | 130 | int mPhoneClient; |
131 | QString mPhoneOtherChannel; | 131 | QString mPhoneOtherChannel; |
132 | QString mPhoneOtherMessage; | 132 | QString mPhoneOtherMessage; |
133 | QString mPhoneOtherMessageParameters; | 133 | QString mPhoneOtherMessageParameters; |
134 | 134 | ||
135 | int mFaxClient; | 135 | int mFaxClient; |
136 | QString mFaxOtherChannel; | 136 | QString mFaxOtherChannel; |
137 | QString mFaxOtherMessage; | 137 | QString mFaxOtherMessage; |
138 | QString mFaxOtherMessageParameters; | 138 | QString mFaxOtherMessageParameters; |
139 | 139 | ||
140 | int mSMSClient; | 140 | int mSMSClient; |
141 | QString mSMSOtherChannel; | 141 | QString mSMSOtherChannel; |
142 | QString mSMSOtherMessage; | 142 | QString mSMSOtherMessage; |
143 | QString mSMSOtherMessageParameters; | 143 | QString mSMSOtherMessageParameters; |
144 | 144 | ||
145 | int mPagerClient; | 145 | int mPagerClient; |
146 | QString mPagerOtherChannel; | 146 | QString mPagerOtherChannel; |
147 | QString mPagerOtherMessage; | 147 | QString mPagerOtherMessage; |
148 | QString mPagerOtherMessageParameters; | 148 | QString mPagerOtherMessageParameters; |
149 | 149 | ||
150 | int mSipClient; | 150 | int mSipClient; |
151 | QString mSipOtherChannel; | 151 | QString mSipOtherChannel; |
152 | QString mSipOtherMessage; | 152 | QString mSipOtherMessage; |
153 | QString mSipOtherMessageParameters; | 153 | QString mSipOtherMessageParameters; |
154 | 154 | ||
155 | 155 | QLabel* mDataStoragePath; | |
156 | KURLRequester* mBackupUrl; | 156 | KURLRequester* mBackupUrl; |
157 | QSpinBox* mBackupDayCountSpin, *mBackupNumbersSpin ; | 157 | QSpinBox* mBackupDayCountSpin, *mBackupNumbersSpin ; |
158 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; | 158 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; |
159 | 159 | ||
160 | // AddresseeWidget *mAddresseeWidget; | 160 | // AddresseeWidget *mAddresseeWidget; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | #endif | 163 | #endif |
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index 7f352d6..25b4e81 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp | |||
@@ -1,489 +1,490 @@ | |||
1 | /* -*- C++ -*- | 1 | /* -*- C++ -*- |
2 | This file is part of the KDE libraries | 2 | This file is part of the KDE libraries |
3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) | 3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) |
4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) | 4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) |
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "kdatepicker.h" | 21 | #include "kdatepicker.h" |
22 | #include <kglobal.h> | 22 | #include <kglobal.h> |
23 | #include <kapplication.h> | 23 | #include <kapplication.h> |
24 | #include <klocale.h> | 24 | #include <klocale.h> |
25 | #include <kiconloader.h> | 25 | #include <kiconloader.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qfont.h> | 30 | #include <qfont.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qvalidator.h> | 33 | #include <qvalidator.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <knotifyclient.h> | 35 | #include <knotifyclient.h> |
36 | #include <kglobalsettings.h> | 36 | #include <kglobalsettings.h> |
37 | #include "kdatetbl.h" | 37 | #include "kdatetbl.h" |
38 | #include "kdateedit.h" | 38 | #include "kdateedit.h" |
39 | //#include "kdatepicker.moc" | 39 | //#include "kdatepicker.moc" |
40 | 40 | ||
41 | 41 | ||
42 | KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) | 42 | KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) |
43 | : QFrame(parent,name), | 43 | : QFrame(parent,name), |
44 | yearForward(new QToolButton(this)), | 44 | yearForward(new QToolButton(this)), |
45 | yearBackward(new QToolButton(this)), | 45 | yearBackward(new QToolButton(this)), |
46 | monthForward(new QToolButton(this)), | 46 | monthForward(new QToolButton(this)), |
47 | monthBackward(new QToolButton(this)), | 47 | monthBackward(new QToolButton(this)), |
48 | selectMonth(new QToolButton(this)), | 48 | selectMonth(new QToolButton(this)), |
49 | selectYear(new QToolButton(this)), | 49 | selectYear(new QToolButton(this)), |
50 | todayBut(new QToolButton(this)), | 50 | todayBut(new QToolButton(this)), |
51 | //line(new QLineEdit(this)), | 51 | //line(new QLineEdit(this)), |
52 | val(new KDateValidator(this)) | 52 | val(new KDateValidator(this)) |
53 | //table(new KDateTable(this)), | 53 | //table(new KDateTable(this)), |
54 | //fontsize(1) | 54 | //fontsize(1) |
55 | { | 55 | { |
56 | QFont fo = KGlobalSettings::generalFont(); | 56 | QFont fo = KGlobalSettings::generalFont(); |
57 | int add = 2; | 57 | int add = 2; |
58 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 58 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
59 | add += 4; | 59 | add += 4; |
60 | fo.setPointSize(fo.pointSize()+add ); | 60 | fo.setPointSize(fo.pointSize()+add ); |
61 | setFont( fo ); | 61 | setFont( fo ); |
62 | table = new KDateTable(this); | 62 | table = new KDateTable(this); |
63 | setFontSize(font().pointSize()); | 63 | setFontSize(font().pointSize()); |
64 | //line->setValidator(val); | 64 | //line->setValidator(val); |
65 | lineDate = new KDateEdit( this, "dateediipicker", true ); | 65 | lineDate = new KDateEdit( this, "dateediipicker", true ); |
66 | yearForward->setPixmap(SmallIcon("3rightarrowB")); | 66 | yearForward->setPixmap(SmallIcon("3rightarrowB")); |
67 | yearBackward->setPixmap(SmallIcon("3leftarrowB")); | 67 | yearBackward->setPixmap(SmallIcon("3leftarrowB")); |
68 | monthForward->setPixmap(SmallIcon("2rightarrowB")); | 68 | monthForward->setPixmap(SmallIcon("2rightarrowB")); |
69 | monthBackward->setPixmap(SmallIcon("2leftarrowB")); | 69 | monthBackward->setPixmap(SmallIcon("2leftarrowB")); |
70 | todayBut->setPixmap(SmallIcon("today")); | 70 | todayBut->setPixmap(SmallIcon("today")); |
71 | setDate(dt); // set button texts | 71 | setDate(dt); // set button texts |
72 | connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); | 72 | connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); |
73 | connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); | 73 | connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); |
74 | connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); | 74 | connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); |
75 | connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); | 75 | connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); |
76 | connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); | 76 | connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); |
77 | connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); | 77 | connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); |
78 | connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); | 78 | connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); |
79 | connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); | 79 | connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); |
80 | connect(todayBut, SIGNAL(clicked()), SLOT(goToday())); | 80 | connect(todayBut, SIGNAL(clicked()), SLOT(goToday())); |
81 | //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); | 81 | //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); |
82 | connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); | 82 | connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); |
83 | connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); | 83 | connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); |
84 | table->setFocus(); | 84 | table->setFocus(); |
85 | 85 | ||
86 | } | 86 | } |
87 | 87 | ||
88 | KDatePicker::~KDatePicker() | 88 | KDatePicker::~KDatePicker() |
89 | { | 89 | { |
90 | } | 90 | } |
91 | 91 | ||
92 | void | 92 | void |
93 | KDatePicker::resizeEvent(QResizeEvent*) | 93 | KDatePicker::resizeEvent(QResizeEvent*) |
94 | { | 94 | { |
95 | QWidget *buttons[] = { | 95 | QWidget *buttons[] = { |
96 | yearBackward, | 96 | yearBackward, |
97 | monthBackward, | 97 | monthBackward, |
98 | selectMonth, | 98 | selectMonth, |
99 | selectYear, | 99 | selectYear, |
100 | monthForward, | 100 | monthForward, |
101 | yearForward }; | 101 | yearForward }; |
102 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); | 102 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); |
103 | QSize sizes[NoOfButtons]; | 103 | QSize sizes[NoOfButtons]; |
104 | int buttonHeight=0; | 104 | int buttonHeight=0; |
105 | int count; | 105 | int count; |
106 | int w; | 106 | int w; |
107 | int x=0; | 107 | int x=0; |
108 | // ----- calculate button row height: | 108 | // ----- calculate button row height: |
109 | for(count=0; count<NoOfButtons; ++count) { | 109 | for(count=0; count<NoOfButtons; ++count) { |
110 | int xS = buttons[count]->sizeHint().width(); | 110 | int xS = buttons[count]->sizeHint().width(); |
111 | int yS = buttons[count]->sizeHint().height(); | 111 | int yS = buttons[count]->sizeHint().height(); |
112 | if ( QApplication::desktop()->width() < 320 ) | 112 | if ( QApplication::desktop()->width() < 320 ) |
113 | sizes[count]=QSize ( xS+4, yS ); | 113 | sizes[count]=QSize ( xS+4, yS ); |
114 | else | 114 | else |
115 | sizes[count]=QSize ( xS+10, yS ); | 115 | sizes[count]=QSize ( xS+10, yS ); |
116 | 116 | ||
117 | buttonHeight=QMAX(buttonHeight, sizes[count].height()); | 117 | buttonHeight=QMAX(buttonHeight, sizes[count].height()); |
118 | } | 118 | } |
119 | buttonHeight += 10; | 119 | buttonHeight += 10; |
120 | // ----- calculate size of the month button: | 120 | // ----- calculate size of the month button: |
121 | w=0; | 121 | w=0; |
122 | for(count=0; count<NoOfButtons; ++count) { | 122 | for(count=0; count<NoOfButtons; ++count) { |
123 | if(buttons[count]!=selectMonth) | 123 | if(buttons[count]!=selectMonth) |
124 | { | 124 | { |
125 | w+=sizes[count].width(); | 125 | w+=sizes[count].width(); |
126 | } else { | 126 | } else { |
127 | x=count; | 127 | x=count; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | sizes[x].setWidth(width()-w); // stretch the month button | 130 | sizes[x].setWidth(width()-w); // stretch the month button |
131 | // ----- place the buttons: | 131 | // ----- place the buttons: |
132 | x=0; | 132 | x=0; |
133 | for(count=0; count<NoOfButtons; ++count) | 133 | for(count=0; count<NoOfButtons; ++count) |
134 | { | 134 | { |
135 | w=sizes[count].width(); | 135 | w=sizes[count].width(); |
136 | buttons[count]->setGeometry(x, 0, w, buttonHeight); | 136 | buttons[count]->setGeometry(x, 0, w, buttonHeight); |
137 | x+=w; | 137 | x+=w; |
138 | } | 138 | } |
139 | // ----- place the line edit for direct input: | 139 | // ----- place the line edit for direct input: |
140 | sizes[0]=lineDate->sizeHint(); | 140 | sizes[0]=lineDate->sizeHint(); |
141 | //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); | 141 | //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); |
142 | int todaywid = todayBut->sizeHint().width(); | 142 | int todaywid = todayBut->sizeHint().width(); |
143 | todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height()); | 143 | todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height()); |
144 | lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height()); | 144 | lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height()); |
145 | // ----- adjust the table: | 145 | // ----- adjust the table: |
146 | table->setGeometry(0, buttonHeight, width(), | 146 | table->setGeometry(0, buttonHeight, width(), |
147 | height()-buttonHeight-sizes[0].height()); | 147 | height()-buttonHeight-sizes[0].height()); |
148 | } | 148 | } |
149 | 149 | ||
150 | void | 150 | void |
151 | KDatePicker::dateChangedSlot(QDate date) | 151 | KDatePicker::dateChangedSlot(QDate date) |
152 | { | 152 | { |
153 | lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); | 153 | lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); |
154 | //line->setText(KGlobal::locale()->formatDate(date, true)); | 154 | //line->setText(KGlobal::locale()->formatDate(date, true)); |
155 | emit(dateChanged(date)); | 155 | emit(dateChanged(date)); |
156 | } | 156 | } |
157 | 157 | ||
158 | void | 158 | void |
159 | KDatePicker::tableClickedSlot() | 159 | KDatePicker::tableClickedSlot() |
160 | { | 160 | { |
161 | 161 | ||
162 | emit(dateSelected(table->getDate())); | 162 | emit(dateSelected(table->getDate())); |
163 | emit(tableClicked()); | 163 | emit(tableClicked()); |
164 | } | 164 | } |
165 | 165 | ||
166 | const QDate& | 166 | const QDate& |
167 | KDatePicker::getDate() const | 167 | KDatePicker::getDate() const |
168 | { | 168 | { |
169 | return table->getDate(); | 169 | return table->getDate(); |
170 | } | 170 | } |
171 | 171 | ||
172 | const QDate & | 172 | const QDate & |
173 | KDatePicker::date() const | 173 | KDatePicker::date() const |
174 | { | 174 | { |
175 | return table->getDate(); | 175 | return table->getDate(); |
176 | } | 176 | } |
177 | 177 | ||
178 | void KDatePicker::goToday() | 178 | void KDatePicker::goToday() |
179 | { | 179 | { |
180 | slotSetDate( QDate::currentDate() ); | 180 | slotSetDate( QDate::currentDate() ); |
181 | 181 | ||
182 | } | 182 | } |
183 | void KDatePicker::slotSetDate( QDate date ) | 183 | void KDatePicker::slotSetDate( QDate date ) |
184 | { | 184 | { |
185 | 185 | ||
186 | if(date.isValid()) { | 186 | if(date.isValid()) { |
187 | QString temp; | 187 | QString temp; |
188 | // ----- | 188 | // ----- |
189 | table->setDate(date); | 189 | table->setDate(date); |
190 | selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); | 190 | selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); |
191 | temp.setNum(date.year()); | 191 | temp.setNum(date.year()); |
192 | selectYear->setText(temp); | 192 | selectYear->setText(temp); |
193 | //line->setText(KGlobal::locale()->formatDate(date, true)); | 193 | //line->setText(KGlobal::locale()->formatDate(date, true)); |
194 | lineDate->setDate( date ); | 194 | lineDate->setDate( date ); |
195 | } | 195 | } |
196 | 196 | ||
197 | } | 197 | } |
198 | bool | 198 | bool |
199 | KDatePicker::setDate(const QDate& date) | 199 | KDatePicker::setDate(const QDate& date) |
200 | { | 200 | { |
201 | table->setFocus(); | 201 | table->setFocus(); |
202 | if(date.isValid()) { | 202 | if(date.isValid()) { |
203 | QString temp; | 203 | QString temp; |
204 | // ----- | 204 | // ----- |
205 | table->setDate(date); | 205 | table->setDate(date); |
206 | selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); | 206 | selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); |
207 | temp.setNum(date.year()); | 207 | temp.setNum(date.year()); |
208 | selectYear->setText(temp); | 208 | selectYear->setText(temp); |
209 | //line->setText(KGlobal::locale()->formatDate(date, true)); | 209 | //line->setText(KGlobal::locale()->formatDate(date, true)); |
210 | lineDate->setDate( date ); | 210 | lineDate->setDate( date ); |
211 | return true; | 211 | return true; |
212 | } else { | 212 | } else { |
213 | 213 | ||
214 | return false; | 214 | return false; |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | } | 218 | } |
219 | 219 | ||
220 | void | 220 | void |
221 | KDatePicker::monthForwardClicked() | 221 | KDatePicker::monthForwardClicked() |
222 | { | 222 | { |
223 | QDate temp=table->getDate(); | 223 | QDate temp=table->getDate(); |
224 | int day=temp.day(); | 224 | int day=temp.day(); |
225 | // ----- | 225 | // ----- |
226 | if(temp.month()==12) { | 226 | if(temp.month()==12) { |
227 | temp.setYMD(temp.year()+1, 1, 1); | 227 | temp.setYMD(temp.year()+1, 1, 1); |
228 | } else { | 228 | } else { |
229 | temp.setYMD(temp.year(), temp.month()+1, 1); | 229 | temp.setYMD(temp.year(), temp.month()+1, 1); |
230 | } | 230 | } |
231 | if(temp.daysInMonth()<day) { | 231 | if(temp.daysInMonth()<day) { |
232 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); | 232 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); |
233 | } else { | 233 | } else { |
234 | temp.setYMD(temp.year(), temp.month(), day); | 234 | temp.setYMD(temp.year(), temp.month(), day); |
235 | } | 235 | } |
236 | // assert(temp.isValid()); | 236 | // assert(temp.isValid()); |
237 | setDate(temp); | 237 | setDate(temp); |
238 | } | 238 | } |
239 | 239 | ||
240 | void | 240 | void |
241 | KDatePicker::monthBackwardClicked() | 241 | KDatePicker::monthBackwardClicked() |
242 | { | 242 | { |
243 | QDate temp=table->getDate(); | 243 | QDate temp=table->getDate(); |
244 | int day=temp.day(); | 244 | int day=temp.day(); |
245 | // ----- | 245 | // ----- |
246 | if(temp.month()==1) | 246 | if(temp.month()==1) |
247 | { | 247 | { |
248 | temp.setYMD(temp.year()-1, 12, 1); | 248 | temp.setYMD(temp.year()-1, 12, 1); |
249 | } else { | 249 | } else { |
250 | temp.setYMD(temp.year(), temp.month()-1, 1); | 250 | temp.setYMD(temp.year(), temp.month()-1, 1); |
251 | } | 251 | } |
252 | if(temp.daysInMonth()<day) | 252 | if(temp.daysInMonth()<day) |
253 | { | 253 | { |
254 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); | 254 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); |
255 | } else { | 255 | } else { |
256 | temp.setYMD(temp.year(), temp.month(), day); | 256 | temp.setYMD(temp.year(), temp.month(), day); |
257 | } | 257 | } |
258 | // assert(temp.isValid()); | 258 | // assert(temp.isValid()); |
259 | setDate(temp); | 259 | setDate(temp); |
260 | } | 260 | } |
261 | 261 | ||
262 | void | 262 | void |
263 | KDatePicker::yearForwardClicked() | 263 | KDatePicker::yearForwardClicked() |
264 | { | 264 | { |
265 | QDate temp=table->getDate(); | 265 | QDate temp=table->getDate(); |
266 | int day=temp.day(); | 266 | int day=temp.day(); |
267 | // ----- | 267 | // ----- |
268 | temp.setYMD(temp.year()+1, temp.month(), 1); | 268 | temp.setYMD(temp.year()+1, temp.month(), 1); |
269 | if(temp.daysInMonth()<day) | 269 | if(temp.daysInMonth()<day) |
270 | { | 270 | { |
271 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); | 271 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); |
272 | } else { | 272 | } else { |
273 | temp.setYMD(temp.year(), temp.month(), day); | 273 | temp.setYMD(temp.year(), temp.month(), day); |
274 | } | 274 | } |
275 | // assert(temp.isValid()); | 275 | // assert(temp.isValid()); |
276 | setDate(temp); | 276 | setDate(temp); |
277 | } | 277 | } |
278 | 278 | ||
279 | void | 279 | void |
280 | KDatePicker::yearBackwardClicked() | 280 | KDatePicker::yearBackwardClicked() |
281 | { | 281 | { |
282 | QDate temp=table->getDate(); | 282 | QDate temp=table->getDate(); |
283 | int day=temp.day(); | 283 | int day=temp.day(); |
284 | // ----- | 284 | // ----- |
285 | temp.setYMD(temp.year()-1, temp.month(), 1); | 285 | temp.setYMD(temp.year()-1, temp.month(), 1); |
286 | if(temp.daysInMonth()<day) | 286 | if(temp.daysInMonth()<day) |
287 | { | 287 | { |
288 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); | 288 | temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); |
289 | } else { | 289 | } else { |
290 | temp.setYMD(temp.year(), temp.month(), day); | 290 | temp.setYMD(temp.year(), temp.month(), day); |
291 | } | 291 | } |
292 | // assert(temp.isValid()); | 292 | // assert(temp.isValid()); |
293 | setDate(temp); | 293 | setDate(temp); |
294 | } | 294 | } |
295 | 295 | ||
296 | void | 296 | void |
297 | KDatePicker::selectMonthClicked() | 297 | KDatePicker::selectMonthClicked() |
298 | { | 298 | { |
299 | int month; | 299 | int month; |
300 | KPopupFrame* popup = new KPopupFrame(this); | 300 | KPopupFrame* popup = new KPopupFrame(this); |
301 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); | 301 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); |
302 | // ----- | 302 | // ----- |
303 | picker->resize(picker->sizeHint()); | 303 | picker->resize(picker->sizeHint()); |
304 | popup->setMainWidget(picker); | 304 | popup->setMainWidget(picker); |
305 | picker->setFocus(); | 305 | picker->setFocus(); |
306 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 306 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
307 | if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height())))) | 307 | if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height())))) |
308 | { | 308 | { |
309 | QDate date; | 309 | QDate date; |
310 | int day; | 310 | int day; |
311 | // ----- | 311 | // ----- |
312 | month=picker->getResult(); | 312 | month=picker->getResult(); |
313 | date=table->getDate(); | 313 | date=table->getDate(); |
314 | day=date.day(); | 314 | day=date.day(); |
315 | // ----- construct a valid date in this month: | 315 | // ----- construct a valid date in this month: |
316 | date.setYMD(date.year(), month, 1); | 316 | date.setYMD(date.year(), month, 1); |
317 | date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); | 317 | date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); |
318 | // ----- set this month | 318 | // ----- set this month |
319 | setDate(date); | 319 | setDate(date); |
320 | } else { | 320 | } else { |
321 | KNotifyClient::beep(); | 321 | KNotifyClient::beep(); |
322 | } | 322 | } |
323 | delete popup; | 323 | delete popup; |
324 | } | 324 | } |
325 | 325 | ||
326 | void | 326 | void |
327 | KDatePicker::selectYearClicked() | 327 | KDatePicker::selectYearClicked() |
328 | { | 328 | { |
329 | int year; | 329 | int year; |
330 | KPopupFrame* popup = new KPopupFrame(this); | 330 | KPopupFrame* popup = new KPopupFrame(this); |
331 | KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup); | 331 | KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup); |
332 | // ----- | 332 | // ----- |
333 | picker->resize(picker->sizeHint()); | 333 | picker->resize(picker->sizeHint()); |
334 | popup->setMainWidget(picker); | 334 | popup->setMainWidget(picker); |
335 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 335 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
336 | picker->setFocus(); | 336 | picker->setFocus(); |
337 | if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height())))) | 337 | if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height())))) |
338 | { | 338 | { |
339 | QDate date; | 339 | QDate date; |
340 | int day; | 340 | int day; |
341 | // ----- | 341 | // ----- |
342 | year=picker->getYear(); | 342 | year=picker->getYear(); |
343 | date=table->getDate(); | 343 | date=table->getDate(); |
344 | day=date.day(); | 344 | day=date.day(); |
345 | // ----- construct a valid date in this month: | 345 | // ----- construct a valid date in this month: |
346 | date.setYMD(year, date.month(), 1); | 346 | date.setYMD(year, date.month(), 1); |
347 | date.setYMD(year, date.month(), QMIN(day, date.daysInMonth())); | 347 | date.setYMD(year, date.month(), QMIN(day, date.daysInMonth())); |
348 | // ----- set this month | 348 | // ----- set this month |
349 | setDate(date); | 349 | setDate(date); |
350 | } else { | 350 | } else { |
351 | KNotifyClient::beep(); | 351 | KNotifyClient::beep(); |
352 | } | 352 | } |
353 | delete popup; | 353 | delete popup; |
354 | } | 354 | } |
355 | 355 | ||
356 | void | 356 | void |
357 | KDatePicker::setEnabled(bool enable) | 357 | KDatePicker::setEnabled(bool enable) |
358 | { | 358 | { |
359 | QWidget *widgets[]= { | 359 | QWidget *widgets[]= { |
360 | yearForward, yearBackward, monthForward, monthBackward, | 360 | yearForward, yearBackward, monthForward, monthBackward, |
361 | selectMonth, selectYear, | 361 | selectMonth, selectYear, |
362 | lineDate, table }; | 362 | lineDate, table }; |
363 | const int Size=sizeof(widgets)/sizeof(widgets[0]); | 363 | const int Size=sizeof(widgets)/sizeof(widgets[0]); |
364 | int count; | 364 | int count; |
365 | // ----- | 365 | // ----- |
366 | for(count=0; count<Size; ++count) | 366 | for(count=0; count<Size; ++count) |
367 | { | 367 | { |
368 | widgets[count]->setEnabled(enable); | 368 | widgets[count]->setEnabled(enable); |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | void | 372 | void |
373 | KDatePicker::lineEnterPressed() | 373 | KDatePicker::lineEnterPressed() |
374 | { | 374 | { |
375 | QDate temp; | 375 | QDate temp; |
376 | // ----- | 376 | // ----- |
377 | temp = lineDate->date(); | 377 | temp = lineDate->date(); |
378 | //if(val->date(line->text(), temp)==QValidator::Acceptable) | 378 | //if(val->date(line->text(), temp)==QValidator::Acceptable) |
379 | //{ | 379 | //{ |
380 | emit(dateEntered(temp)); | 380 | emit(dateEntered(temp)); |
381 | setDate(temp); | 381 | setDate(temp); |
382 | // } else { | 382 | // } else { |
383 | // KNotifyClient::beep(); | 383 | // KNotifyClient::beep(); |
384 | // } | 384 | // } |
385 | } | 385 | } |
386 | 386 | ||
387 | QSize | 387 | QSize |
388 | KDatePicker::sizeHint() const | 388 | KDatePicker::sizeHint() const |
389 | { | 389 | { |
390 | QSize tableSize=table->sizeHint(); | 390 | QSize tableSize=table->sizeHint(); |
391 | QWidget *buttons[]={ | 391 | QWidget *buttons[]={ |
392 | yearBackward, | 392 | yearBackward, |
393 | monthBackward, | 393 | monthBackward, |
394 | selectMonth, | 394 | selectMonth, |
395 | selectYear, | 395 | selectYear, |
396 | monthForward, | 396 | monthForward, |
397 | yearForward }; | 397 | yearForward }; |
398 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); | 398 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); |
399 | QSize sizes[NoOfButtons]; | 399 | QSize sizes[NoOfButtons]; |
400 | int cx=0, cy=0, count; | 400 | int cx=0, cy=0, count; |
401 | // ----- store the size hints: | 401 | // ----- store the size hints: |
402 | for(count=0; count<NoOfButtons; ++count) | 402 | for(count=0; count<NoOfButtons; ++count) |
403 | { | 403 | { |
404 | sizes[count]=buttons[count]->sizeHint(); | 404 | sizes[count]=buttons[count]->sizeHint(); |
405 | if(buttons[count]==selectMonth) | 405 | if(buttons[count]==selectMonth) |
406 | { | 406 | { |
407 | cx+=maxMonthRect.width()+15; | 407 | cx+=maxMonthRect.width()+15; |
408 | } else { | 408 | } else { |
409 | cx+=sizes[count].width()+15; | 409 | cx+=sizes[count].width()+15; |
410 | } | 410 | } |
411 | cy=QMAX(sizes[count].height(), cy); | 411 | cy=QMAX(sizes[count].height(), cy); |
412 | } | 412 | } |
413 | // ----- calculate width hint: | 413 | // ----- calculate width hint: |
414 | cx=QMAX(cx, tableSize.width()); // line edit ignored | 414 | cx=QMAX(cx, tableSize.width()); // line edit ignored |
415 | if ( cx > QApplication::desktop()->width() -5 ) | 415 | if ( cx > QApplication::desktop()->width() -5 ) |
416 | cx = QApplication::desktop()->width() -5; | 416 | cx = QApplication::desktop()->width() -5; |
417 | // ----- calculate height hint: | 417 | // ----- calculate height hint: |
418 | cy+=tableSize.height()+lineDate->sizeHint().height(); | 418 | cy+=tableSize.height()+lineDate->sizeHint().height(); |
419 | 419 | ||
420 | return QSize(cx, cy); | 420 | return QSize(cx, cy); |
421 | } | 421 | } |
422 | 422 | ||
423 | void | 423 | void |
424 | KDatePicker::setFontSize(int s) | 424 | KDatePicker::setFontSize(int s) |
425 | { | 425 | { |
426 | QWidget *buttons[]= { | 426 | QWidget *buttons[]= { |
427 | // yearBackward, | 427 | // yearBackward, |
428 | // monthBackward, | 428 | // monthBackward, |
429 | selectMonth, | 429 | selectMonth, |
430 | selectYear, | 430 | selectYear, |
431 | // monthForward, | 431 | // monthForward, |
432 | // yearForward | 432 | // yearForward |
433 | }; | 433 | }; |
434 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); | 434 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); |
435 | int count; | 435 | int count; |
436 | QFont font; | 436 | QFont font; |
437 | QRect r; | 437 | QRect r; |
438 | // ----- | 438 | // ----- |
439 | fontsize=s; | 439 | fontsize=s; |
440 | for(count=0; count<NoOfButtons; ++count) | 440 | for(count=0; count<NoOfButtons; ++count) |
441 | { | 441 | { |
442 | font=buttons[count]->font(); | 442 | font=buttons[count]->font(); |
443 | font.setPointSize(s); | 443 | font.setPointSize(s); |
444 | buttons[count]->setFont(font); | 444 | buttons[count]->setFont(font); |
445 | } | 445 | } |
446 | QFontMetrics metrics(selectMonth->fontMetrics()); | 446 | QFontMetrics metrics(selectMonth->fontMetrics()); |
447 | for(int i=1; i <= 12; ++i) | 447 | for(int i=1; i <= 12; ++i) |
448 | { // maxMonthRect is used by sizeHint() | 448 | { // maxMonthRect is used by sizeHint() |
449 | r=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); | 449 | r=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); |
450 | maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width())); | 450 | maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width())); |
451 | maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height())); | 451 | maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height())); |
452 | } | 452 | } |
453 | table->setFontSize(s); | 453 | table->setFontSize(s); |
454 | } | 454 | } |
455 | 455 | ||
456 | void KDatePicker::virtual_hook( int id, void* data ) | 456 | void KDatePicker::virtual_hook( int id, void* data ) |
457 | { /*BASE::virtual_hook( id, data );*/ } | 457 | { /*BASE::virtual_hook( id, data );*/ } |
458 | 458 | ||
459 | void KDatePicker::keyPressEvent ( QKeyEvent * e ) | 459 | void KDatePicker::keyPressEvent ( QKeyEvent * e ) |
460 | { | 460 | { |
461 | switch ( e->key() ) { | 461 | switch ( e->key() ) { |
462 | case Qt::Key_Right: | 462 | case Qt::Key_Right: |
463 | monthForwardClicked(); | 463 | monthForwardClicked(); |
464 | break; | 464 | break; |
465 | case Qt::Key_Left: | 465 | case Qt::Key_Left: |
466 | monthBackwardClicked(); | 466 | monthBackwardClicked(); |
467 | break; | 467 | break; |
468 | 468 | ||
469 | case Qt::Key_Down: | 469 | case Qt::Key_Down: |
470 | yearForwardClicked(); | 470 | yearForwardClicked(); |
471 | 471 | ||
472 | break; | 472 | break; |
473 | 473 | ||
474 | case Qt::Key_Up: | 474 | case Qt::Key_Up: |
475 | yearBackwardClicked(); | 475 | yearBackwardClicked(); |
476 | break; | 476 | break; |
477 | 477 | ||
478 | case Qt::Key_Return: | 478 | case Qt::Key_Return: |
479 | case Qt::Key_Enter: | 479 | case Qt::Key_Enter: |
480 | case Qt::Key_Space: | ||
480 | tableClickedSlot(); | 481 | tableClickedSlot(); |
481 | break; | 482 | break; |
482 | case Qt::Key_Escape: | 483 | case Qt::Key_Escape: |
483 | e->ignore(); | 484 | e->ignore(); |
484 | break; | 485 | break; |
485 | default: | 486 | default: |
486 | break; | 487 | break; |
487 | } | 488 | } |
488 | 489 | ||
489 | } | 490 | } |