-rw-r--r-- | libkdepim/kcmconfigs/kcmkdepimconfig.cpp | 17 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kcmkdepimconfig.h | 2 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 313 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.h | 45 |
4 files changed, 277 insertions, 100 deletions
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp index f26efe0..e77c5ab 100644 --- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp +++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp | |||
@@ -1,79 +1,80 @@ | |||
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 | 31 | ||
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | //#include <klocale.h> | 35 | //#include <klocale.h> |
36 | //#include <stdlib.h> | 36 | //#include <stdlib.h> |
37 | 37 | ||
38 | #include "kdepimconfigwidget.h" | 38 | #include "kdepimconfigwidget.h" |
39 | 39 | ||
40 | #include "kcmkdepimconfig.h" | 40 | #include "kcmkdepimconfig.h" |
41 | #include "kprefs.h" | 41 | #include "kprefs.h" |
42 | #include "kpimglobalprefs.h" | 42 | #include "kpimglobalprefs.h" |
43 | 43 | ||
44 | #ifndef _WIN32_ | 44 | #ifndef _WIN32_ |
45 | extern "C" | 45 | extern "C" |
46 | { | 46 | { |
47 | KCModule *create_kabconfig( KPimGlobalPrefs* prefs, QWidget *parent, const char * ) { | 47 | KCModule *create_kabconfig(QWidget *parent, const char * ) { |
48 | return new KCMKdePimConfig( prefs, parent, "kcmkdepimconfig" ); | 48 | return new KCMKdePimConfig(parent, "kcmkdepimconfig" ); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name ) | 53 | KCMKdePimConfig::KCMKdePimConfig(QWidget *parent, const char *name ) |
54 | : KCModule( prefs, parent, name ) | 54 | : KCModule( KPimGlobalPrefs::instance(), parent, name ) |
55 | { | 55 | { |
56 | //abort(); | 56 | //abort(); |
57 | QVBoxLayout *layout = new QVBoxLayout( this ); | 57 | QVBoxLayout *layout = new QVBoxLayout( this ); |
58 | mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" ); | 58 | mConfigWidget = new KDEPIMConfigWidget( (KPimGlobalPrefs*)getPreferences(), this, "KDEPIMConfigWidget" ); |
59 | layout->addWidget( mConfigWidget ); | 59 | layout->addWidget( mConfigWidget ); |
60 | layout->setSpacing( 0 ); | 60 | layout->setSpacing( 0 ); |
61 | layout->setMargin( 0 ); | 61 | layout->setMargin( 0 ); |
62 | 62 | ||
63 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 63 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
64 | } | 64 | } |
65 | 65 | ||
66 | void KCMKdePimConfig::load() | 66 | void KCMKdePimConfig::load() |
67 | { | 67 | { |
68 | mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences()); | 68 | mConfigWidget->readConfig(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void KCMKdePimConfig::save() | 71 | void KCMKdePimConfig::save() |
72 | { | 72 | { |
73 | mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences()); | 73 | mConfigWidget->writeConfig(); |
74 | } | 74 | } |
75 | 75 | ||
76 | void KCMKdePimConfig::defaults() | 76 | void KCMKdePimConfig::defaults() |
77 | { | 77 | { |
78 | mConfigWidget->defaults((KPimGlobalPrefs*)getPreferences()); | 78 | qDebug("KCMKdePimConfig::defaults()"); |
79 | mConfigWidget->setDefaults(); | ||
79 | } | 80 | } |
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h index fa96eda..b471e53 100644 --- a/libkdepim/kcmconfigs/kcmkdepimconfig.h +++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h | |||
@@ -1,54 +1,54 @@ | |||
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 KCMKDEPIMCONFIG_H | 31 | #ifndef KCMKDEPIMCONFIG_H |
32 | #define KCMKDEPIMCONFIG_H | 32 | #define KCMKDEPIMCONFIG_H |
33 | 33 | ||
34 | #include <kcmodule.h> | 34 | #include <kcmodule.h> |
35 | 35 | ||
36 | class KDEPIMConfigWidget; | 36 | class KDEPIMConfigWidget; |
37 | class KPimGlobalPrefs; | 37 | class KPimGlobalPrefs; |
38 | 38 | ||
39 | class KCMKdePimConfig : public KCModule | 39 | class KCMKdePimConfig : public KCModule |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent = 0, const char *name = 0 ); | 44 | KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 ); |
45 | 45 | ||
46 | virtual void load(); | 46 | virtual void load(); |
47 | virtual void save(); | 47 | virtual void save(); |
48 | virtual void defaults(); | 48 | virtual void defaults(); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | KDEPIMConfigWidget *mConfigWidget; | 51 | KDEPIMConfigWidget *mConfigWidget; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | #endif | 54 | #endif |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 703aeb1..00a07d9 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,327 +1,506 @@ | |||
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 <qfile.h> | 38 | #include <qfile.h> |
38 | 39 | ||
39 | #include <kdialog.h> | 40 | #include <kdialog.h> |
40 | #include <klocale.h> | 41 | #include <klocale.h> |
41 | 42 | #include <kdateedit.h> | |
43 | #include <kglobal.h> | ||
42 | #include <stdlib.h> | 44 | #include <stdlib.h> |
43 | 45 | ||
44 | /*US | 46 | /*US |
45 | #include <qcheckbox.h> | 47 | #include <qcheckbox.h> |
46 | #include <qframe.h> | 48 | #include <qframe.h> |
47 | #include <qpushbutton.h> | 49 | #include <qpushbutton.h> |
48 | #include <qcombobox.h> | 50 | #include <qcombobox.h> |
49 | #include <qlineedit.h> | 51 | #include <qlineedit.h> |
50 | #include <qlabel.h> | 52 | #include <qlabel.h> |
51 | #include <qfile.h> | 53 | #include <qfile.h> |
52 | 54 | ||
53 | #include <kconfig.h> | 55 | #include <kconfig.h> |
54 | #include <kdebug.h> | 56 | #include <kdebug.h> |
55 | #include <kdialog.h> | 57 | #include <kdialog.h> |
56 | #include <klistview.h> | 58 | #include <klistview.h> |
57 | #include <klocale.h> | 59 | #include <klocale.h> |
58 | #include <kglobal.h> | 60 | #include <kglobal.h> |
59 | #include <kmessagebox.h> | 61 | #include <kmessagebox.h> |
60 | #include <kstandarddirs.h> | 62 | #include <kstandarddirs.h> |
61 | 63 | ||
62 | #ifndef KAB_EMBEDDED | 64 | #ifndef KAB_EMBEDDED |
63 | #include <ktrader.h> | 65 | #include <ktrader.h> |
64 | #else // KAB_EMBEDDED | 66 | #else // KAB_EMBEDDED |
65 | #include <mergewidget.h> | 67 | #include <mergewidget.h> |
66 | #include <distributionlistwidget.h> | 68 | #include <distributionlistwidget.h> |
67 | #endif // KAB_EMBEDDED | 69 | #endif // KAB_EMBEDDED |
68 | 70 | ||
69 | #include "addresseewidget.h" | 71 | #include "addresseewidget.h" |
70 | #include "extensionconfigdialog.h" | 72 | #include "extensionconfigdialog.h" |
71 | #include "extensionwidget.h" | 73 | #include "extensionwidget.h" |
72 | */ | 74 | */ |
73 | 75 | ||
76 | #include "qapplication.h" | ||
77 | |||
74 | #include "kpimglobalprefs.h" | 78 | #include "kpimglobalprefs.h" |
75 | 79 | ||
76 | #include "kdepimconfigwidget.h" | 80 | #include "kdepimconfigwidget.h" |
77 | 81 | ||
78 | 82 | ||
79 | KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | 83 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
80 | : QWidget( parent, name ) | 84 | : KPrefsWidget(prefs, parent, name ) |
81 | { | 85 | { |
82 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 86 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
83 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 87 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
84 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 88 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
85 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 89 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
86 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 90 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
87 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 91 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
88 | 92 | ||
89 | 93 | ||
90 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 94 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
91 | KDialog::spacingHint() ); | 95 | KDialog::spacingHint() ); |
92 | 96 | ||
93 | QTabWidget *tabWidget = new QTabWidget( this ); | 97 | tabWidget = new QTabWidget( this ); |
94 | topLayout->addWidget( tabWidget ); | 98 | topLayout->addWidget( tabWidget ); |
95 | 99 | ||
96 | 100 | ||
101 | setupLocaleTab(); | ||
102 | setupLocaleDateTab(); | ||
103 | setupTimeZoneTab(); | ||
104 | setupExternalAppTab(); | ||
105 | |||
106 | } | ||
97 | 107 | ||
98 | // mailclient page | 108 | void KDEPIMConfigWidget::setupExternalAppTab() |
109 | { | ||
99 | QWidget *externalAppsPage = new QWidget( this ); | 110 | QWidget *externalAppsPage = new QWidget( this ); |
100 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 111 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
101 | KDialog::spacingHintSmall() ); | 112 | KDialog::spacingHintSmall() ); |
102 | 113 | ||
103 | mExternalApps = new QComboBox( externalAppsPage ); | 114 | mExternalApps = new QComboBox( externalAppsPage ); |
104 | 115 | ||
105 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 116 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
106 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 117 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
107 | mExternalApps->insertItem( it.data(), it.key() ); | 118 | mExternalApps->insertItem( it.data(), it.key() ); |
108 | 119 | ||
109 | layout->addWidget( mExternalApps ); | 120 | layout->addWidget( mExternalApps ); |
110 | 121 | ||
111 | connect( mExternalApps, SIGNAL( activated( int ) ), | 122 | connect( mExternalApps, SIGNAL( activated( int ) ), |
112 | this, SLOT (externalapp_changed( int ) ) ); | 123 | this, SLOT (externalapp_changed( int ) ) ); |
113 | 124 | ||
114 | 125 | ||
115 | |||
116 | |||
117 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 126 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
118 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 127 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
119 | 128 | ||
120 | 129 | ||
121 | mClient = new QComboBox( mExternalAppGroupBox ); | 130 | mClient = new QComboBox( mExternalAppGroupBox ); |
122 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 131 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
123 | 132 | ||
124 | connect( mClient, SIGNAL( activated( int ) ), | 133 | connect( mClient, SIGNAL( activated( int ) ), |
125 | this, SLOT (client_changed( int ) ) ); | 134 | this, SLOT (client_changed( int ) ) ); |
126 | 135 | ||
127 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 136 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
128 | boxLayout->addWidget( lab, 1, 0 ); | 137 | boxLayout->addWidget( lab, 1, 0 ); |
129 | mChannel = new QLineEdit(mExternalAppGroupBox); | 138 | mChannel = new QLineEdit(mExternalAppGroupBox); |
130 | mChannel->setReadOnly(true); | 139 | mChannel->setReadOnly(true); |
131 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 140 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
132 | 141 | ||
133 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 142 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
134 | boxLayout->addWidget( lab, 3, 0 ); | 143 | boxLayout->addWidget( lab, 3, 0 ); |
135 | mMessage = new QLineEdit(mExternalAppGroupBox); | 144 | mMessage = new QLineEdit(mExternalAppGroupBox); |
136 | mMessage->setReadOnly(true); | 145 | mMessage->setReadOnly(true); |
137 | boxLayout->addWidget( mMessage , 4, 0); | 146 | boxLayout->addWidget( mMessage , 4, 0); |
138 | 147 | ||
139 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 148 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
140 | boxLayout->addWidget( lab, 3, 1 ); | 149 | boxLayout->addWidget( lab, 3, 1 ); |
141 | mParameters = new QLineEdit(mExternalAppGroupBox); | 150 | mParameters = new QLineEdit(mExternalAppGroupBox); |
142 | mParameters->setReadOnly(true); | 151 | mParameters->setReadOnly(true); |
143 | boxLayout->addWidget( mParameters, 4, 1 ); | 152 | boxLayout->addWidget( mParameters, 4, 1 ); |
144 | 153 | ||
145 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 154 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
146 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 155 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
147 | 156 | ||
148 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 157 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
149 | boxLayout->addWidget( lab, 6, 0 ); | 158 | boxLayout->addWidget( lab, 6, 0 ); |
150 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 159 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
151 | mMessage2->setReadOnly(true); | 160 | mMessage2->setReadOnly(true); |
152 | boxLayout->addWidget( mMessage2 , 7, 0); | 161 | boxLayout->addWidget( mMessage2 , 7, 0); |
153 | 162 | ||
154 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 163 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
155 | boxLayout->addWidget( lab, 6, 1 ); | 164 | boxLayout->addWidget( lab, 6, 1 ); |
156 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 165 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
157 | mParameters2->setReadOnly(true); | 166 | mParameters2->setReadOnly(true); |
158 | boxLayout->addWidget( mParameters2, 7, 1 ); | 167 | boxLayout->addWidget( mParameters2, 7, 1 ); |
159 | 168 | ||
160 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 169 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
161 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 170 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
162 | 171 | ||
163 | 172 | ||
164 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 173 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
165 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 174 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
166 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 175 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
167 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 176 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
168 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 177 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
169 | 178 | ||
170 | 179 | ||
171 | |||
172 | layout->addWidget( mExternalAppGroupBox ); | 180 | layout->addWidget( mExternalAppGroupBox ); |
173 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 181 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
174 | 182 | ||
175 | } | 183 | } |
176 | 184 | ||
185 | |||
186 | void KDEPIMConfigWidget::setupLocaleDateTab() | ||
187 | { | ||
188 | QWidget *topFrame = new QWidget( this ); | ||
189 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | ||
190 | |||
191 | topLayout->setSpacing(KDialog::spacingHint()); | ||
192 | topLayout->setMargin(KDialog::marginHint()); | ||
193 | int iii = 0; | ||
194 | |||
195 | |||
196 | KPrefsWidRadios *syncPrefsGroup = | ||
197 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | ||
198 | QString format; | ||
199 | if ( QApplication::desktop()->width() < 480 ) | ||
200 | format = "(%d.%m.%Y)"; | ||
201 | else | ||
202 | format = "(%d.%m.%Y|%A %d %B %Y)"; | ||
203 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | ||
204 | if ( QApplication::desktop()->width() < 480 ) | ||
205 | format = "(%m.%d.%Y)"; | ||
206 | else | ||
207 | format = "(%m.%d.%Y|%A %B %d %Y)"; | ||
208 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | ||
209 | if ( QApplication::desktop()->width() < 480 ) | ||
210 | format = "(%Y-%m-%d)"; | ||
211 | else | ||
212 | format = "(%Y-%m-%d|%A %Y %B %d)"; | ||
213 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | ||
214 | syncPrefsGroup->addRadio(i18n("User defined")); | ||
215 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
216 | ++iii; | ||
217 | ++iii; | ||
218 | QLabel * lab; | ||
219 | mUserDateFormatLong = new QLineEdit(topFrame); | ||
220 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | ||
221 | topLayout->addWidget(lab ,iii,0); | ||
222 | topLayout->addWidget(mUserDateFormatLong,iii,1); | ||
223 | ++iii; | ||
224 | mUserDateFormatShort = new QLineEdit(topFrame); | ||
225 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | ||
226 | topLayout->addWidget(lab ,iii,0); | ||
227 | topLayout->addWidget(mUserDateFormatShort,iii,1); | ||
228 | ++iii; | ||
229 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | ||
230 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
231 | ++iii; | ||
232 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | ||
233 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
234 | ++iii; | ||
235 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | ||
236 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
237 | ++iii; | ||
238 | |||
239 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | ||
240 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | ||
241 | |||
242 | |||
243 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | ||
244 | } | ||
245 | |||
246 | void KDEPIMConfigWidget::setupLocaleTab() | ||
247 | { | ||
248 | |||
249 | QWidget *topFrame = new QWidget( this ); | ||
250 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | ||
251 | |||
252 | topLayout->setSpacing(KDialog::spacingHint()); | ||
253 | topLayout->setMargin(KDialog::marginHint()); | ||
254 | int iii = 0; | ||
255 | KPrefsWidRadios *syncPrefsGroup = | ||
256 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | ||
257 | syncPrefsGroup->addRadio(i18n("English")); | ||
258 | syncPrefsGroup->addRadio(i18n("German")); | ||
259 | syncPrefsGroup->addRadio(i18n("French")); | ||
260 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | ||
261 | if ( QApplication::desktop()->width() < 300 ) | ||
262 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | ||
263 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
264 | ++iii; | ||
265 | |||
266 | syncPrefsGroup = | ||
267 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | ||
268 | if ( QApplication::desktop()->width() > 300 ) | ||
269 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | ||
270 | syncPrefsGroup->addRadio(i18n("24:00")); | ||
271 | syncPrefsGroup->addRadio(i18n("12:00am")); | ||
272 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | ||
273 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
274 | ++iii; | ||
275 | |||
276 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | ||
277 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | ||
278 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | ||
279 | ++iii; | ||
280 | |||
281 | |||
282 | tabWidget->addTab( topFrame, i18n( "Locale" ) ); | ||
283 | |||
284 | } | ||
285 | |||
286 | |||
287 | void KDEPIMConfigWidget::setupTimeZoneTab() | ||
288 | { | ||
289 | QWidget *topFrame = new QWidget( this ); | ||
290 | QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2); | ||
291 | topLayout->setSpacing(KDialog::spacingHint()); | ||
292 | topLayout->setMargin(KDialog::marginHint()); | ||
293 | |||
294 | QHBox *timeZoneBox = new QHBox( topFrame ); | ||
295 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | ||
296 | |||
297 | new QLabel( i18n("Timezone:"), timeZoneBox ); | ||
298 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | ||
299 | if ( QApplication::desktop()->width() < 300 ) { | ||
300 | mTimeZoneCombo->setMaximumWidth(150); | ||
301 | } | ||
302 | |||
303 | QStringList list; | ||
304 | list = KGlobal::locale()->timeZoneList(); | ||
305 | mTimeZoneCombo->insertStringList(list); | ||
306 | |||
307 | // find the currently set time zone and select it | ||
308 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | ||
309 | int nCurrentlySet = 11; | ||
310 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | ||
311 | { | ||
312 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | ||
313 | { | ||
314 | nCurrentlySet = i; | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | ||
319 | int iii = 1; | ||
320 | KPrefsWidBool *sb = | ||
321 | addWidBool(i18n("Timezone has daylight saving"), | ||
322 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | ||
323 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | ||
324 | ++iii; | ||
325 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | ||
326 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
327 | ++iii; | ||
328 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | ||
329 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
330 | ++iii; | ||
331 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | ||
332 | topLayout->addWidget(lab, iii,0); | ||
333 | mStartDateSavingEdit = new KDateEdit(topFrame); | ||
334 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | ||
335 | ++iii; | ||
336 | |||
337 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | ||
338 | topLayout->addWidget(lab, iii,0); | ||
339 | mEndDateSavingEdit = new KDateEdit(topFrame); | ||
340 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | ||
341 | ++iii; | ||
342 | QDate current ( 2001, 1,1); | ||
343 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | ||
344 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | ||
345 | |||
346 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | ||
347 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | ||
348 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | ||
349 | |||
350 | |||
351 | |||
352 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | ||
353 | |||
354 | } | ||
355 | |||
177 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 356 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
178 | { | 357 | { |
179 | // first store the current data | 358 | // first store the current data |
180 | saveEditFieldSettings(); | 359 | saveEditFieldSettings(); |
181 | 360 | ||
182 | // set mCurrentApp | 361 | // set mCurrentApp |
183 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 362 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
184 | 363 | ||
185 | // set mCurrentClient | 364 | // set mCurrentClient |
186 | switch(mCurrentApp) | 365 | switch(mCurrentApp) |
187 | { | 366 | { |
188 | case(ExternalAppHandler::EMAIL): | 367 | case(ExternalAppHandler::EMAIL): |
189 | mCurrentClient = mEmailClient; | 368 | mCurrentClient = mEmailClient; |
190 | break; | 369 | break; |
191 | case(ExternalAppHandler::PHONE): | 370 | case(ExternalAppHandler::PHONE): |
192 | mCurrentClient = mPhoneClient; | 371 | mCurrentClient = mPhoneClient; |
193 | break; | 372 | break; |
194 | case(ExternalAppHandler::SMS): | 373 | case(ExternalAppHandler::SMS): |
195 | mCurrentClient = mSMSClient; | 374 | mCurrentClient = mSMSClient; |
196 | break; | 375 | break; |
197 | case(ExternalAppHandler::FAX): | 376 | case(ExternalAppHandler::FAX): |
198 | mCurrentClient = mFaxClient; | 377 | mCurrentClient = mFaxClient; |
199 | break; | 378 | break; |
200 | case(ExternalAppHandler::PAGER): | 379 | case(ExternalAppHandler::PAGER): |
201 | mCurrentClient = mPagerClient; | 380 | mCurrentClient = mPagerClient; |
202 | break; | 381 | break; |
203 | case(ExternalAppHandler::SIP): | 382 | case(ExternalAppHandler::SIP): |
204 | mCurrentClient = mSipClient; | 383 | mCurrentClient = mSipClient; |
205 | break; | 384 | break; |
206 | default: | 385 | default: |
207 | return; | 386 | return; |
208 | } | 387 | } |
209 | 388 | ||
210 | // and at last update the widgets | 389 | // and at last update the widgets |
211 | updateClientWidgets(); | 390 | updateClientWidgets(); |
212 | } | 391 | } |
213 | 392 | ||
214 | 393 | ||
215 | 394 | ||
216 | void KDEPIMConfigWidget::client_changed( int newClient ) | 395 | void KDEPIMConfigWidget::client_changed( int newClient ) |
217 | { | 396 | { |
218 | if (newClient == mCurrentClient) | 397 | if (newClient == mCurrentClient) |
219 | return; | 398 | return; |
220 | 399 | ||
221 | // first store the current data | 400 | // first store the current data |
222 | saveEditFieldSettings(); | 401 | saveEditFieldSettings(); |
223 | 402 | ||
224 | 403 | ||
225 | //then reset the clientvariable | 404 | //then reset the clientvariable |
226 | mCurrentClient = newClient; | 405 | mCurrentClient = newClient; |
227 | 406 | ||
228 | // and at last update the widgets | 407 | // and at last update the widgets |
229 | updateClientWidgets(); | 408 | updateClientWidgets(); |
230 | 409 | ||
231 | modified(); | 410 | KPrefsWidget::modified(); |
232 | } | 411 | } |
233 | 412 | ||
234 | void KDEPIMConfigWidget::saveEditFieldSettings() | 413 | void KDEPIMConfigWidget::saveEditFieldSettings() |
235 | { | 414 | { |
236 | 415 | ||
237 | switch(mCurrentApp) | 416 | switch(mCurrentApp) |
238 | { | 417 | { |
239 | case(ExternalAppHandler::EMAIL): | 418 | case(ExternalAppHandler::EMAIL): |
240 | mEmailClient = mClient->currentItem(); | 419 | mEmailClient = mClient->currentItem(); |
241 | break; | 420 | break; |
242 | case(ExternalAppHandler::PHONE): | 421 | case(ExternalAppHandler::PHONE): |
243 | mPhoneClient= mClient->currentItem(); | 422 | mPhoneClient= mClient->currentItem(); |
244 | break; | 423 | break; |
245 | case(ExternalAppHandler::SMS): | 424 | case(ExternalAppHandler::SMS): |
246 | mSMSClient = mClient->currentItem(); | 425 | mSMSClient = mClient->currentItem(); |
247 | break; | 426 | break; |
248 | case(ExternalAppHandler::FAX): | 427 | case(ExternalAppHandler::FAX): |
249 | mFaxClient = mClient->currentItem(); | 428 | mFaxClient = mClient->currentItem(); |
250 | break; | 429 | break; |
251 | case(ExternalAppHandler::PAGER): | 430 | case(ExternalAppHandler::PAGER): |
252 | mPagerClient = mClient->currentItem(); | 431 | mPagerClient = mClient->currentItem(); |
253 | break; | 432 | break; |
254 | case(ExternalAppHandler::SIP): | 433 | case(ExternalAppHandler::SIP): |
255 | mSipClient = mClient->currentItem(); | 434 | mSipClient = mClient->currentItem(); |
256 | break; | 435 | break; |
257 | default: | 436 | default: |
258 | return; | 437 | return; |
259 | } | 438 | } |
260 | 439 | ||
261 | //store the current data back to the apropriate membervariables if we had set it to "other" | 440 | //store the current data back to the apropriate membervariables if we had set it to "other" |
262 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 441 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
263 | { | 442 | { |
264 | mEmailOtherChannel = mChannel->text(); | 443 | mEmailOtherChannel = mChannel->text(); |
265 | mEmailOtherMessage = mMessage->text(); | 444 | mEmailOtherMessage = mMessage->text(); |
266 | mEmailOtherMessageParameters = mParameters->text(); | 445 | mEmailOtherMessageParameters = mParameters->text(); |
267 | mEmailOtherMessage2 = mMessage2->text(); | 446 | mEmailOtherMessage2 = mMessage2->text(); |
268 | mEmailOtherMessageParameters2 = mParameters2->text(); | 447 | mEmailOtherMessageParameters2 = mParameters2->text(); |
269 | } | 448 | } |
270 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 449 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
271 | { | 450 | { |
272 | mPhoneOtherChannel = mChannel->text(); | 451 | mPhoneOtherChannel = mChannel->text(); |
273 | mPhoneOtherMessage = mMessage->text(); | 452 | mPhoneOtherMessage = mMessage->text(); |
274 | mPhoneOtherMessageParameters = mParameters->text(); | 453 | mPhoneOtherMessageParameters = mParameters->text(); |
275 | } | 454 | } |
276 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 455 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
277 | { | 456 | { |
278 | mSMSOtherChannel = mChannel->text(); | 457 | mSMSOtherChannel = mChannel->text(); |
279 | mSMSOtherMessage = mMessage->text(); | 458 | mSMSOtherMessage = mMessage->text(); |
280 | mSMSOtherMessageParameters = mParameters->text(); | 459 | mSMSOtherMessageParameters = mParameters->text(); |
281 | } | 460 | } |
282 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 461 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
283 | { | 462 | { |
284 | mFaxOtherChannel = mChannel->text(); | 463 | mFaxOtherChannel = mChannel->text(); |
285 | mFaxOtherMessage = mMessage->text(); | 464 | mFaxOtherMessage = mMessage->text(); |
286 | mFaxOtherMessageParameters = mParameters->text(); | 465 | mFaxOtherMessageParameters = mParameters->text(); |
287 | } | 466 | } |
288 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 467 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
289 | { | 468 | { |
290 | mPagerOtherChannel = mChannel->text(); | 469 | mPagerOtherChannel = mChannel->text(); |
291 | mPagerOtherMessage = mMessage->text(); | 470 | mPagerOtherMessage = mMessage->text(); |
292 | mPagerOtherMessageParameters = mParameters->text(); | 471 | mPagerOtherMessageParameters = mParameters->text(); |
293 | } | 472 | } |
294 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 473 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
295 | { | 474 | { |
296 | mSipOtherChannel = mChannel->text(); | 475 | mSipOtherChannel = mChannel->text(); |
297 | mSipOtherMessage = mMessage->text(); | 476 | mSipOtherMessage = mMessage->text(); |
298 | mSipOtherMessageParameters = mParameters->text(); | 477 | mSipOtherMessageParameters = mParameters->text(); |
299 | } | 478 | } |
300 | 479 | ||
301 | 480 | ||
302 | } | 481 | } |
303 | 482 | ||
304 | void KDEPIMConfigWidget::updateClientWidgets() | 483 | void KDEPIMConfigWidget::updateClientWidgets() |
305 | { | 484 | { |
306 | bool blocked = signalsBlocked(); | 485 | bool blocked = signalsBlocked(); |
307 | blockSignals( true ); | 486 | blockSignals( true ); |
308 | 487 | ||
309 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 488 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
310 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 489 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
311 | if (it == mExternalAppsMap.end()) | 490 | if (it == mExternalAppsMap.end()) |
312 | return; | 491 | return; |
313 | 492 | ||
314 | // update group box | 493 | // update group box |
315 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 494 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
316 | 495 | ||
317 | //update the entries in the client combobox | 496 | //update the entries in the client combobox |
318 | mClient->clear(); | 497 | mClient->clear(); |
319 | 498 | ||
320 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 499 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
321 | DefaultAppItem* dai; | 500 | DefaultAppItem* dai; |
322 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 501 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
323 | { | 502 | { |
324 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 503 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
325 | 504 | ||
326 | if (dai->_id == mCurrentClient) | 505 | if (dai->_id == mCurrentClient) |
327 | { | 506 | { |
@@ -351,254 +530,242 @@ void KDEPIMConfigWidget::updateClientWidgets() | |||
351 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 530 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
352 | { | 531 | { |
353 | mChannel->setText(mSMSOtherChannel); | 532 | mChannel->setText(mSMSOtherChannel); |
354 | mMessage->setText(mSMSOtherMessage); | 533 | mMessage->setText(mSMSOtherMessage); |
355 | mParameters->setText(mSMSOtherMessageParameters); | 534 | mParameters->setText(mSMSOtherMessageParameters); |
356 | } | 535 | } |
357 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 536 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
358 | { | 537 | { |
359 | mChannel->setText(mFaxOtherChannel); | 538 | mChannel->setText(mFaxOtherChannel); |
360 | mMessage->setText(mFaxOtherMessage); | 539 | mMessage->setText(mFaxOtherMessage); |
361 | mParameters->setText(mFaxOtherMessageParameters); | 540 | mParameters->setText(mFaxOtherMessageParameters); |
362 | } | 541 | } |
363 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 542 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
364 | { | 543 | { |
365 | mChannel->setText(mPagerOtherChannel); | 544 | mChannel->setText(mPagerOtherChannel); |
366 | mMessage->setText(mPagerOtherMessage); | 545 | mMessage->setText(mPagerOtherMessage); |
367 | mParameters->setText(mPagerOtherMessageParameters); | 546 | mParameters->setText(mPagerOtherMessageParameters); |
368 | } | 547 | } |
369 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 548 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
370 | { | 549 | { |
371 | mChannel->setText(mSipOtherChannel); | 550 | mChannel->setText(mSipOtherChannel); |
372 | mMessage->setText(mSipOtherMessage); | 551 | mMessage->setText(mSipOtherMessage); |
373 | mParameters->setText(mSipOtherMessageParameters); | 552 | mParameters->setText(mSipOtherMessageParameters); |
374 | } | 553 | } |
375 | } | 554 | } |
376 | 555 | ||
377 | } | 556 | } |
378 | 557 | ||
379 | bool readonly; | 558 | bool readonly; |
380 | bool enabled; | 559 | bool enabled; |
381 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 560 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
382 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 561 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
383 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 562 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
384 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 563 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
385 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 564 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
386 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) | 565 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) |
387 | { | 566 | { |
388 | readonly = false; | 567 | readonly = false; |
389 | } | 568 | } |
390 | else | 569 | else |
391 | { | 570 | { |
392 | readonly = true; | 571 | readonly = true; |
393 | } | 572 | } |
394 | 573 | ||
395 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) | 574 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) |
396 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) | 575 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) |
397 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) | 576 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) |
398 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) | 577 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) |
399 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) | 578 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) |
400 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) | 579 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) |
401 | { | 580 | { |
402 | enabled = false; | 581 | enabled = false; |
403 | } | 582 | } |
404 | else | 583 | else |
405 | { | 584 | { |
406 | enabled = true; | 585 | enabled = true; |
407 | } | 586 | } |
408 | 587 | ||
409 | 588 | ||
410 | mChannel->setReadOnly(readonly); | 589 | mChannel->setReadOnly(readonly); |
411 | mMessage->setReadOnly(readonly); | 590 | mMessage->setReadOnly(readonly); |
412 | mParameters->setReadOnly(readonly); | 591 | mParameters->setReadOnly(readonly); |
413 | mMessage2->setReadOnly(readonly); | 592 | mMessage2->setReadOnly(readonly); |
414 | mParameters2->setReadOnly(readonly); | 593 | mParameters2->setReadOnly(readonly); |
415 | 594 | ||
416 | mChannel->setEnabled(enabled); | 595 | mChannel->setEnabled(enabled); |
417 | mMessage->setEnabled(enabled); | 596 | mMessage->setEnabled(enabled); |
418 | mParameters->setEnabled(enabled); | 597 | mParameters->setEnabled(enabled); |
419 | mMessage2->setEnabled(enabled); | 598 | mMessage2->setEnabled(enabled); |
420 | mParameters2->setEnabled(enabled); | 599 | mParameters2->setEnabled(enabled); |
421 | 600 | ||
422 | 601 | ||
423 | 602 | ||
424 | mClient->setCurrentItem(mCurrentClient); | 603 | mClient->setCurrentItem(mCurrentClient); |
425 | 604 | ||
426 | 605 | ||
427 | // enable/disable the extra message/parameter field | 606 | // enable/disable the extra message/parameter field |
428 | if (mCurrentApp == ExternalAppHandler::EMAIL) | 607 | if (mCurrentApp == ExternalAppHandler::EMAIL) |
429 | { | 608 | { |
430 | } | 609 | } |
431 | else | 610 | else |
432 | { | 611 | { |
433 | mMessage2->setText( "" ); | 612 | mMessage2->setText( "" ); |
434 | mParameters2->setText( "" ); | 613 | mParameters2->setText( "" ); |
435 | } | 614 | } |
436 | 615 | ||
437 | if (enabled == true) { | 616 | if (enabled == true) { |
438 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 617 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
439 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 618 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
440 | } | 619 | } |
441 | 620 | ||
442 | 621 | ||
443 | blockSignals( blocked ); | 622 | blockSignals( blocked ); |
444 | 623 | ||
445 | } | 624 | } |
446 | 625 | ||
447 | 626 | void KDEPIMConfigWidget::usrReadConfig() | |
448 | |||
449 | |||
450 | void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs) | ||
451 | { | 627 | { |
628 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | ||
629 | |||
452 | bool blocked = signalsBlocked(); | 630 | bool blocked = signalsBlocked(); |
453 | blockSignals( true ); | 631 | blockSignals( true ); |
454 | 632 | ||
633 | QString dummy = prefs->mUserDateFormatLong; | ||
634 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
635 | dummy = prefs->mUserDateFormatShort; | ||
636 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
637 | |||
638 | QDate current ( 2001, 1,1); | ||
639 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); | ||
640 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); | ||
641 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); | ||
642 | |||
643 | |||
644 | |||
645 | |||
455 | mEmailClient = prefs->mEmailClient; | 646 | mEmailClient = prefs->mEmailClient; |
456 | mEmailOtherChannel = prefs->mEmailOtherChannel; | 647 | mEmailOtherChannel = prefs->mEmailOtherChannel; |
457 | mEmailOtherMessage = prefs->mEmailOtherMessage; | 648 | mEmailOtherMessage = prefs->mEmailOtherMessage; |
458 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; | 649 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; |
459 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; | 650 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; |
460 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; | 651 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; |
461 | 652 | ||
462 | mPhoneClient = prefs->mPhoneClient; | 653 | mPhoneClient = prefs->mPhoneClient; |
463 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; | 654 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; |
464 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; | 655 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; |
465 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; | 656 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; |
466 | 657 | ||
467 | mFaxClient = prefs->mFaxClient; | 658 | mFaxClient = prefs->mFaxClient; |
468 | mFaxOtherChannel = prefs->mFaxOtherChannel; | 659 | mFaxOtherChannel = prefs->mFaxOtherChannel; |
469 | mFaxOtherMessage = prefs->mFaxOtherMessage; | 660 | mFaxOtherMessage = prefs->mFaxOtherMessage; |
470 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; | 661 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; |
471 | 662 | ||
472 | mSMSClient = prefs->mSMSClient; | 663 | mSMSClient = prefs->mSMSClient; |
473 | mSMSOtherChannel = prefs->mSMSOtherChannel; | 664 | mSMSOtherChannel = prefs->mSMSOtherChannel; |
474 | mSMSOtherMessage = prefs->mSMSOtherMessage; | 665 | mSMSOtherMessage = prefs->mSMSOtherMessage; |
475 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; | 666 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; |
476 | 667 | ||
477 | mPagerClient = prefs->mPagerClient; | 668 | mPagerClient = prefs->mPagerClient; |
478 | mPagerOtherChannel = prefs->mPagerOtherChannel; | 669 | mPagerOtherChannel = prefs->mPagerOtherChannel; |
479 | mPagerOtherMessage = prefs->mPagerOtherMessage; | 670 | mPagerOtherMessage = prefs->mPagerOtherMessage; |
480 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; | 671 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; |
481 | 672 | ||
482 | mSipClient = prefs->mPagerClient; | 673 | mSipClient = prefs->mPagerClient; |
483 | mSipOtherChannel = prefs->mSipOtherChannel; | 674 | mSipOtherChannel = prefs->mSipOtherChannel; |
484 | mSipOtherMessage = prefs->mSipOtherMessage; | 675 | mSipOtherMessage = prefs->mSipOtherMessage; |
485 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; | 676 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; |
486 | 677 | ||
487 | mCurrentApp = ExternalAppHandler::EMAIL; | 678 | mCurrentApp = ExternalAppHandler::EMAIL; |
488 | mCurrentClient = mEmailClient; | 679 | mCurrentClient = mEmailClient; |
489 | 680 | ||
490 | updateClientWidgets(); | 681 | updateClientWidgets(); |
491 | 682 | ||
492 | blockSignals( blocked ); | 683 | blockSignals( blocked ); |
493 | 684 | ||
494 | emit changed( false ); | ||
495 | |||
496 | } | 685 | } |
497 | 686 | ||
498 | void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs) | 687 | void KDEPIMConfigWidget::usrWriteConfig() |
499 | { | 688 | { |
689 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | ||
690 | |||
500 | saveEditFieldSettings(); | 691 | saveEditFieldSettings(); |
501 | 692 | ||
693 | |||
694 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | ||
695 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | ||
696 | |||
697 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); | ||
698 | QDate date; | ||
699 | date = mStartDateSavingEdit->date(); | ||
700 | int sub = 0; | ||
701 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
702 | sub = 1; | ||
703 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; | ||
704 | date = mEndDateSavingEdit->date(); | ||
705 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
706 | sub = 1; | ||
707 | else | ||
708 | sub = 0; | ||
709 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; | ||
710 | |||
711 | |||
502 | prefs->mEmailClient = mEmailClient; | 712 | prefs->mEmailClient = mEmailClient; |
503 | prefs->mEmailOtherChannel = mEmailOtherChannel; | 713 | prefs->mEmailOtherChannel = mEmailOtherChannel; |
504 | prefs->mEmailOtherMessage = mEmailOtherMessage; | 714 | prefs->mEmailOtherMessage = mEmailOtherMessage; |
505 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; | 715 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; |
506 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; | 716 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; |
507 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; | 717 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; |
508 | 718 | ||
509 | prefs->mPhoneClient = mPhoneClient; | 719 | prefs->mPhoneClient = mPhoneClient; |
510 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; | 720 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; |
511 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; | 721 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; |
512 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; | 722 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; |
513 | 723 | ||
514 | prefs->mFaxClient = mFaxClient; | 724 | prefs->mFaxClient = mFaxClient; |
515 | prefs->mFaxOtherChannel = mFaxOtherChannel; | 725 | prefs->mFaxOtherChannel = mFaxOtherChannel; |
516 | prefs->mFaxOtherMessage = mFaxOtherMessage; | 726 | prefs->mFaxOtherMessage = mFaxOtherMessage; |
517 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; | 727 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; |
518 | 728 | ||
519 | prefs->mSMSClient = mSMSClient; | 729 | prefs->mSMSClient = mSMSClient; |
520 | prefs->mSMSOtherChannel = mSMSOtherChannel; | 730 | prefs->mSMSOtherChannel = mSMSOtherChannel; |
521 | prefs->mSMSOtherMessage = mSMSOtherMessage; | 731 | prefs->mSMSOtherMessage = mSMSOtherMessage; |
522 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; | 732 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; |
523 | 733 | ||
524 | prefs->mPagerClient = mPagerClient; | 734 | prefs->mPagerClient = mPagerClient; |
525 | prefs->mPagerOtherChannel = mPagerOtherChannel; | 735 | prefs->mPagerOtherChannel = mPagerOtherChannel; |
526 | prefs->mPagerOtherMessage = mPagerOtherMessage; | 736 | prefs->mPagerOtherMessage = mPagerOtherMessage; |
527 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; | 737 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; |
528 | 738 | ||
529 | 739 | ||
530 | prefs->mSipClient = mSipClient; | 740 | prefs->mSipClient = mSipClient; |
531 | prefs->mSipOtherChannel = mSipOtherChannel; | 741 | prefs->mSipOtherChannel = mSipOtherChannel; |
532 | prefs->mSipOtherMessage = mSipOtherMessage; | 742 | prefs->mSipOtherMessage = mSipOtherMessage; |
533 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; | 743 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; |
534 | 744 | ||
535 | prefs->writeConfig(); | ||
536 | |||
537 | //release the cache that other views can access the changed values instantanious | 745 | //release the cache that other views can access the changed values instantanious |
538 | ExternalAppHandler::instance()->loadConfig(); | 746 | ExternalAppHandler::instance()->loadConfig(); |
539 | 747 | ||
540 | emit changed( false ); | ||
541 | } | 748 | } |
542 | 749 | ||
543 | void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs) | ||
544 | { | ||
545 | |||
546 | DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC); | ||
547 | |||
548 | mEmailClient = dai->_id; | ||
549 | mEmailOtherChannel = dai->_channel; | ||
550 | mEmailOtherMessage = dai->_message; | ||
551 | mEmailOtherMessageParameters = dai->_parameters; | ||
552 | mEmailOtherMessage2 = dai->_message2; | ||
553 | mEmailOtherMessageParameters2 = dai->_parameters2; | ||
554 | |||
555 | |||
556 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC); | ||
557 | |||
558 | mPhoneClient = dai->_id; | ||
559 | mPhoneOtherChannel = dai->_channel; | ||
560 | mPhoneOtherMessage = dai->_message; | ||
561 | mPhoneOtherMessageParameters = dai->_parameters; | ||
562 | |||
563 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC); | ||
564 | |||
565 | mFaxClient = dai->_id; | ||
566 | mFaxOtherChannel = dai->_channel; | ||
567 | mFaxOtherMessage = dai->_message; | ||
568 | mFaxOtherMessageParameters = dai->_parameters; | ||
569 | 750 | ||
570 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC); | 751 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, |
571 | 752 | const QStringList *tags) | |
572 | mSMSClient = dai->_id; | ||
573 | mSMSOtherChannel = dai->_channel; | ||
574 | mSMSOtherMessage = dai->_message; | ||
575 | mSMSOtherMessageParameters = dai->_parameters; | ||
576 | |||
577 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC); | ||
578 | |||
579 | mPagerClient = dai->_id; | ||
580 | mPagerOtherChannel = dai->_channel; | ||
581 | mPagerOtherMessage = dai->_message; | ||
582 | mPagerOtherMessageParameters = dai->_parameters; | ||
583 | |||
584 | |||
585 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC); | ||
586 | |||
587 | mSipClient = dai->_id; | ||
588 | mSipOtherChannel = dai->_channel; | ||
589 | mSipOtherMessage = dai->_message; | ||
590 | mSipOtherMessageParameters = dai->_parameters; | ||
591 | |||
592 | |||
593 | emit changed( true ); | ||
594 | } | ||
595 | |||
596 | void KDEPIMConfigWidget::modified() | ||
597 | { | 753 | { |
598 | emit changed( true ); | 754 | if (tags) { |
755 | int i = tags->findIndex(text); | ||
756 | if (i > 0) combo->setCurrentItem(i); | ||
757 | } else { | ||
758 | for(int i=0;i<combo->count();++i) { | ||
759 | if (combo->text(i) == text) { | ||
760 | combo->setCurrentItem(i); | ||
761 | break; | ||
762 | } | ||
763 | } | ||
764 | } | ||
599 | } | 765 | } |
600 | 766 | ||
767 | |||
601 | void KDEPIMConfigWidget::textChanged( const QString& text ) | 768 | void KDEPIMConfigWidget::textChanged( const QString& text ) |
602 | { | 769 | { |
603 | emit changed( true ); | 770 | emit changed( true ); |
604 | } | 771 | } |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h index e3cfd81..6f26513 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.h +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h | |||
@@ -1,145 +1,154 @@ | |||
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 <qwidget.h> | 34 | #include <kprefswidget.h> |
35 | #include <qmap.h> | 35 | #include <qmap.h> |
36 | 36 | ||
37 | #include "externalapphandler.h" | 37 | #include "externalapphandler.h" |
38 | 38 | ||
39 | 39 | ||
40 | /* | ||
41 | class QCheckBox; | ||
42 | class QListViewItem; | ||
43 | class QPushButton; | ||
44 | class KListView; | ||
45 | */ | ||
46 | class QComboBox; | 40 | class QComboBox; |
47 | class QLineEdit; | 41 | class QLineEdit; |
48 | class KPimGlobalPrefs; | 42 | class KPimGlobalPrefs; |
49 | class QGroupBox; | 43 | class QGroupBox; |
44 | class QTabWidget; | ||
45 | class KDateEdit; | ||
50 | 46 | ||
51 | class KDEPIMConfigWidget : public QWidget | 47 | class KDEPIMConfigWidget : public KPrefsWidget |
52 | { | 48 | { |
53 | Q_OBJECT | 49 | Q_OBJECT |
54 | 50 | ||
55 | public: | 51 | public: |
56 | KDEPIMConfigWidget( QWidget *parent, const char *name = 0 ); | 52 | KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 ); |
57 | |||
58 | void restoreSettings(KPimGlobalPrefs* prefs); | ||
59 | void saveSettings(KPimGlobalPrefs* prefs); | ||
60 | void defaults(KPimGlobalPrefs* prefs); | ||
61 | |||
62 | signals: | ||
63 | void changed( bool ); | ||
64 | |||
65 | 53 | ||
66 | public slots: | 54 | public slots: |
67 | void modified(); | ||
68 | void textChanged( const QString& text ); | 55 | void textChanged( const QString& text ); |
69 | 56 | ||
57 | protected: | ||
58 | /** Implement this to read custom configuration widgets. */ | ||
59 | virtual void usrReadConfig(); | ||
60 | /** Implement this to write custom configuration widgets. */ | ||
61 | virtual void usrWriteConfig(); | ||
70 | 62 | ||
71 | 63 | ||
72 | private slots: | 64 | private slots: |
73 | // void configureExtension(); | 65 | // void configureExtension(); |
74 | // void selectionChanged( QListViewItem* ); | 66 | // void selectionChanged( QListViewItem* ); |
75 | // void itemClicked( QListViewItem* ); | 67 | // void itemClicked( QListViewItem* ); |
76 | void client_changed( int newClient ); | 68 | void client_changed( int newClient ); |
77 | void externalapp_changed( int newApp ); | 69 | void externalapp_changed( int newApp ); |
78 | 70 | ||
79 | private: | 71 | private: |
72 | void setupExternalAppTab(); | ||
73 | void setupLocaleDateTab(); | ||
74 | void setupLocaleTab(); | ||
75 | void setupTimeZoneTab(); | ||
76 | |||
77 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | ||
78 | |||
79 | |||
80 | void saveEditFieldSettings(); | 80 | void saveEditFieldSettings(); |
81 | void updateClientWidgets(); | 81 | void updateClientWidgets(); |
82 | 82 | ||
83 | QTabWidget *tabWidget; | ||
84 | |||
85 | |||
86 | QLineEdit* mUserDateFormatShort; | ||
87 | QLineEdit* mUserDateFormatLong; | ||
88 | QComboBox* mTimeZoneCombo; | ||
89 | KDateEdit* mStartDateSavingEdit; | ||
90 | KDateEdit* mEndDateSavingEdit; | ||
91 | |||
83 | // void restoreExtensionSettings(); | 92 | // void restoreExtensionSettings(); |
84 | // void saveExtensionSettings(); | 93 | // void saveExtensionSettings(); |
85 | 94 | ||
86 | // KListView *mExtensionView; | 95 | // KListView *mExtensionView; |
87 | 96 | ||
88 | // QCheckBox *mNameParsing; | 97 | // QCheckBox *mNameParsing; |
89 | // QCheckBox *mViewsSingleClickBox; | 98 | // QCheckBox *mViewsSingleClickBox; |
90 | // QPushButton *mConfigureButton; | 99 | // QPushButton *mConfigureButton; |
91 | QComboBox* mExternalApps; | 100 | QComboBox* mExternalApps; |
92 | QGroupBox* mExternalAppGroupBox; | 101 | QGroupBox* mExternalAppGroupBox; |
93 | 102 | ||
94 | 103 | ||
95 | QComboBox* mClient; | 104 | QComboBox* mClient; |
96 | QLineEdit* mChannel; | 105 | QLineEdit* mChannel; |
97 | QLineEdit* mMessage; | 106 | QLineEdit* mMessage; |
98 | QLineEdit* mParameters; | 107 | QLineEdit* mParameters; |
99 | QLineEdit* mMessage2; | 108 | QLineEdit* mMessage2; |
100 | QLineEdit* mParameters2; | 109 | QLineEdit* mParameters2; |
101 | 110 | ||
102 | ExternalAppHandler::Types mCurrentApp; | 111 | ExternalAppHandler::Types mCurrentApp; |
103 | int mCurrentClient; | 112 | int mCurrentClient; |
104 | 113 | ||
105 | 114 | ||
106 | int mEmailClient; | 115 | int mEmailClient; |
107 | QString mEmailOtherChannel; | 116 | QString mEmailOtherChannel; |
108 | QString mEmailOtherMessage; | 117 | QString mEmailOtherMessage; |
109 | QString mEmailOtherMessageParameters; | 118 | QString mEmailOtherMessageParameters; |
110 | QString mEmailOtherMessage2; | 119 | QString mEmailOtherMessage2; |
111 | QString mEmailOtherMessageParameters2; | 120 | QString mEmailOtherMessageParameters2; |
112 | 121 | ||
113 | int mPhoneClient; | 122 | int mPhoneClient; |
114 | QString mPhoneOtherChannel; | 123 | QString mPhoneOtherChannel; |
115 | QString mPhoneOtherMessage; | 124 | QString mPhoneOtherMessage; |
116 | QString mPhoneOtherMessageParameters; | 125 | QString mPhoneOtherMessageParameters; |
117 | 126 | ||
118 | int mFaxClient; | 127 | int mFaxClient; |
119 | QString mFaxOtherChannel; | 128 | QString mFaxOtherChannel; |
120 | QString mFaxOtherMessage; | 129 | QString mFaxOtherMessage; |
121 | QString mFaxOtherMessageParameters; | 130 | QString mFaxOtherMessageParameters; |
122 | 131 | ||
123 | int mSMSClient; | 132 | int mSMSClient; |
124 | QString mSMSOtherChannel; | 133 | QString mSMSOtherChannel; |
125 | QString mSMSOtherMessage; | 134 | QString mSMSOtherMessage; |
126 | QString mSMSOtherMessageParameters; | 135 | QString mSMSOtherMessageParameters; |
127 | 136 | ||
128 | int mPagerClient; | 137 | int mPagerClient; |
129 | QString mPagerOtherChannel; | 138 | QString mPagerOtherChannel; |
130 | QString mPagerOtherMessage; | 139 | QString mPagerOtherMessage; |
131 | QString mPagerOtherMessageParameters; | 140 | QString mPagerOtherMessageParameters; |
132 | 141 | ||
133 | int mSipClient; | 142 | int mSipClient; |
134 | QString mSipOtherChannel; | 143 | QString mSipOtherChannel; |
135 | QString mSipOtherMessage; | 144 | QString mSipOtherMessage; |
136 | QString mSipOtherMessageParameters; | 145 | QString mSipOtherMessageParameters; |
137 | 146 | ||
138 | 147 | ||
139 | 148 | ||
140 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; | 149 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; |
141 | 150 | ||
142 | // AddresseeWidget *mAddresseeWidget; | 151 | // AddresseeWidget *mAddresseeWidget; |
143 | }; | 152 | }; |
144 | 153 | ||
145 | #endif | 154 | #endif |