author | zautrix <zautrix> | 2004-10-19 10:52:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-19 10:52:21 (UTC) |
commit | 4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69 (patch) (unidiff) | |
tree | 8213284e178e82b6ab3a41bae1ef81379704379f | |
parent | b5d1458a283b624980ec64b10b3f7ec1168fc659 (diff) | |
download | kdepimpi-4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69.zip kdepimpi-4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69.tar.gz kdepimpi-4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69.tar.bz2 |
fixed layout problems in config widgets
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 8 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 30 |
2 files changed, 24 insertions, 14 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index c8b68c7..936d052 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -1,398 +1,398 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | 35 | ||
36 | #include <kconfig.h> | 36 | #include <kconfig.h> |
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include <kdialog.h> | 38 | #include <kdialog.h> |
39 | #include <klistview.h> | 39 | #include <klistview.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kglobal.h> | 41 | #include <kglobal.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <ktrader.h> | 46 | #include <ktrader.h> |
47 | #else // KAB_EMBEDDED | 47 | #else // KAB_EMBEDDED |
48 | #include <mergewidget.h> | 48 | #include <mergewidget.h> |
49 | #include <distributionlistwidget.h> | 49 | #include <distributionlistwidget.h> |
50 | #endif // KAB_EMBEDDED | 50 | #endif // KAB_EMBEDDED |
51 | 51 | ||
52 | #include "addresseewidget.h" | 52 | #include "addresseewidget.h" |
53 | #include "extensionconfigdialog.h" | 53 | #include "extensionconfigdialog.h" |
54 | #include "extensionwidget.h" | 54 | #include "extensionwidget.h" |
55 | #include "kabprefs.h" | 55 | #include "kabprefs.h" |
56 | 56 | ||
57 | #include "kabconfigwidget.h" | 57 | #include "kabconfigwidget.h" |
58 | 58 | ||
59 | class ExtensionItem : public QCheckListItem | 59 | class ExtensionItem : public QCheckListItem |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | 62 | ||
63 | #ifndef KAB_EMBEDDED | 63 | #ifndef KAB_EMBEDDED |
64 | ExtensionItem( QListView *parent, const QString &text ); | 64 | ExtensionItem( QListView *parent, const QString &text ); |
65 | void setService( const KService::Ptr &ptr ); | 65 | void setService( const KService::Ptr &ptr ); |
66 | #else //KAB_EMBEDDED | 66 | #else //KAB_EMBEDDED |
67 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); | 67 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); |
68 | void setFactory( ExtensionFactory* fac ); | 68 | void setFactory( ExtensionFactory* fac ); |
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | bool configWidgetAvailable() const; | 71 | bool configWidgetAvailable() const; |
72 | ExtensionFactory *factory() const; | 72 | ExtensionFactory *factory() const; |
73 | 73 | ||
74 | virtual QString text( int column ) const; | 74 | virtual QString text( int column ) const; |
75 | 75 | ||
76 | private: | 76 | private: |
77 | #ifndef KAB_EMBEDDED | 77 | #ifndef KAB_EMBEDDED |
78 | KService::Ptr mPtr; | 78 | KService::Ptr mPtr; |
79 | #else //KAB_EMBEDDED | 79 | #else //KAB_EMBEDDED |
80 | ExtensionFactory* mFactory; | 80 | ExtensionFactory* mFactory; |
81 | QString mName; | 81 | QString mName; |
82 | QString mComment; | 82 | QString mComment; |
83 | 83 | ||
84 | #endif //KAB_EMBEDDED | 84 | #endif //KAB_EMBEDDED |
85 | 85 | ||
86 | }; | 86 | }; |
87 | 87 | ||
88 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) | 88 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) |
89 | : KPrefsWidget( prefs, parent, name ) | 89 | : KPrefsWidget( prefs, parent, name ) |
90 | { | 90 | { |
91 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 91 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
92 | KDialog::spacingHint() ); | 92 | KDialog::spacingHint() ); |
93 | 93 | ||
94 | QTabWidget *tabWidget = new QTabWidget( this ); | 94 | QTabWidget *tabWidget = new QTabWidget( this ); |
95 | topLayout->addWidget( tabWidget ); | 95 | topLayout->addWidget( tabWidget ); |
96 | 96 | ||
97 | // General page | 97 | // General page |
98 | QWidget *generalPage = new QWidget( this ); | 98 | QWidget *generalPage = new QWidget( this ); |
99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
100 | KDialog::spacingHintSmall() ); | 100 | KDialog::spacingHintSmall() ); |
101 | 101 | ||
102 | |||
102 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); | 103 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); |
103 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); | 104 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); |
104 | KPrefsWidFont *detailsFont = | 105 | KPrefsWidFont *detailsFont = |
105 | addWidFont(i18n("phone:123"),i18n("Details view font"), | 106 | addWidFont(i18n("phone:123"),i18n("Details view font"), |
106 | &(KABPrefs::instance()->mDetailsFont),hBox); | 107 | &(KABPrefs::instance()->mDetailsFont),hBox); |
107 | hboxLayout->addWidget(detailsFont->label()); | 108 | hboxLayout->addWidget(detailsFont->label()); |
108 | hboxLayout->addWidget(detailsFont->preview()); | 109 | hboxLayout->addWidget(detailsFont->preview()); |
109 | hboxLayout->addWidget(detailsFont->button()); | 110 | hboxLayout->addWidget(detailsFont->button()); |
110 | hboxLayout->setMargin(KDialog::marginHintSmall() ); | 111 | hboxLayout->setMargin(KDialog::marginHintSmall() ); |
111 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); | 112 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); |
113 | //hBox->setBackgroundColor( black); | ||
112 | layout->addWidget( hBox ); | 114 | layout->addWidget( hBox ); |
113 | 115 | ||
114 | //general groupbox | 116 | //general groupbox |
115 | QVBox *vBox = new QVBox( generalPage, "qvbox" ); | 117 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); |
116 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); | 118 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); |
117 | boxLayout->setAlignment( Qt::AlignTop ); | 119 | boxLayout->setAlignment( Qt::AlignTop ); |
118 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 120 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
119 | vBox->layout()->setMargin(KDialog::marginHintSmall()) ; | ||
120 | vBox->layout()->setSpacing(KDialog::spacingHintSmall()); | ||
121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
122 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 122 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
123 | boxLayout->addWidget( mSearchReturnBox ); | 123 | boxLayout->addWidget( mSearchReturnBox ); |
124 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); | 124 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); |
125 | boxLayout->addWidget( mViewsSingleClickBox ); | 125 | boxLayout->addWidget( mViewsSingleClickBox ); |
126 | 126 | ||
127 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); | 127 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); |
128 | boxLayout->addWidget( mNameParsing ); | 128 | boxLayout->addWidget( mNameParsing ); |
129 | 129 | ||
130 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); | 130 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); |
131 | boxLayout->addWidget( mMultipleViewsAtOnce ); | 131 | boxLayout->addWidget( mMultipleViewsAtOnce ); |
132 | 132 | ||
133 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); | 133 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); |
134 | boxLayout->addWidget( mAskForQuit ); | 134 | boxLayout->addWidget( mAskForQuit ); |
135 | 135 | ||
136 | layout->addWidget( vBox ); | 136 | layout->addWidget( vBox ); |
137 | 137 | ||
138 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 138 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
139 | 139 | ||
140 | // Extension page | 140 | // Extension page |
141 | QWidget *extensionPage = new QWidget( this ); | 141 | QWidget *extensionPage = new QWidget( this ); |
142 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), | 142 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), |
143 | KDialog::spacingHintSmall() ); | 143 | KDialog::spacingHintSmall() ); |
144 | 144 | ||
145 | //extensions groupbox | 145 | //extensions groupbox |
146 | 146 | ||
147 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); | 147 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); |
148 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 148 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
149 | boxLayout->setAlignment( Qt::AlignTop ); | 149 | boxLayout->setAlignment( Qt::AlignTop ); |
150 | boxLayout->setMargin(KDialog::marginHintSmall()); | 150 | boxLayout->setMargin(KDialog::marginHintSmall()); |
151 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | 151 | boxLayout->setSpacing(KDialog::spacingHintSmall()); |
152 | groupBox->layout()->setMargin(1) ; | 152 | groupBox->layout()->setMargin(1) ; |
153 | groupBox->layout()->setSpacing(0); | 153 | groupBox->layout()->setSpacing(0); |
154 | mExtensionView = new KListView( groupBox ); | 154 | mExtensionView = new KListView( groupBox ); |
155 | mExtensionView->setAllColumnsShowFocus( true ); | 155 | mExtensionView->setAllColumnsShowFocus( true ); |
156 | mExtensionView->addColumn( i18n( "Name" ) ); | 156 | mExtensionView->addColumn( i18n( "Name" ) ); |
157 | mExtensionView->addColumn( i18n( "Description" ) ); | 157 | mExtensionView->addColumn( i18n( "Description" ) ); |
158 | mExtensionView->setMaximumHeight(80); | 158 | mExtensionView->setMaximumHeight(80); |
159 | 159 | ||
160 | boxLayout->addWidget( mExtensionView ); | 160 | boxLayout->addWidget( mExtensionView ); |
161 | 161 | ||
162 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | 162 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); |
163 | mConfigureButton->setEnabled( false ); | 163 | mConfigureButton->setEnabled( false ); |
164 | boxLayout->addWidget( mConfigureButton ); | 164 | boxLayout->addWidget( mConfigureButton ); |
165 | 165 | ||
166 | extensionLayout->addWidget( groupBox ); | 166 | extensionLayout->addWidget( groupBox ); |
167 | 167 | ||
168 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 168 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
169 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 169 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
170 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 170 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
171 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 171 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
172 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 172 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
173 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 173 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
174 | SLOT( selectionChanged( QListViewItem* ) ) ); | 174 | SLOT( selectionChanged( QListViewItem* ) ) ); |
175 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 175 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
176 | SLOT( itemClicked( QListViewItem* ) ) ); | 176 | SLOT( itemClicked( QListViewItem* ) ) ); |
177 | connect( mConfigureButton, SIGNAL( clicked() ), | 177 | connect( mConfigureButton, SIGNAL( clicked() ), |
178 | SLOT( configureExtension() ) ); | 178 | SLOT( configureExtension() ) ); |
179 | 179 | ||
180 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); | 180 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); |
181 | 181 | ||
182 | // Addressee page | 182 | // Addressee page |
183 | mAddresseeWidget = new AddresseeWidget( this ); | 183 | mAddresseeWidget = new AddresseeWidget( this ); |
184 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 184 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
185 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 185 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
186 | 186 | ||
187 | } | 187 | } |
188 | 188 | ||
189 | void KABConfigWidget::usrReadConfig() | 189 | void KABConfigWidget::usrReadConfig() |
190 | { | 190 | { |
191 | KABPrefs* prefs = KABPrefs::instance(); | 191 | KABPrefs* prefs = KABPrefs::instance(); |
192 | 192 | ||
193 | bool blocked = signalsBlocked(); | 193 | bool blocked = signalsBlocked(); |
194 | blockSignals( true ); | 194 | blockSignals( true ); |
195 | 195 | ||
196 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); | 196 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); |
197 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); | 197 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); |
198 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); | 198 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); |
199 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); | 199 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); |
200 | mAskForQuit->setChecked( prefs->mAskForQuit ); | 200 | mAskForQuit->setChecked( prefs->mAskForQuit ); |
201 | 201 | ||
202 | mAddresseeWidget->restoreSettings(); | 202 | mAddresseeWidget->restoreSettings(); |
203 | 203 | ||
204 | restoreExtensionSettings(); | 204 | restoreExtensionSettings(); |
205 | 205 | ||
206 | blockSignals( blocked ); | 206 | blockSignals( blocked ); |
207 | 207 | ||
208 | } | 208 | } |
209 | 209 | ||
210 | void KABConfigWidget::usrWriteConfig() | 210 | void KABConfigWidget::usrWriteConfig() |
211 | { | 211 | { |
212 | KABPrefs* prefs = KABPrefs::instance(); | 212 | KABPrefs* prefs = KABPrefs::instance(); |
213 | 213 | ||
214 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); | 214 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); |
215 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 215 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
216 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); | 216 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); |
217 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); | 217 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); |
218 | prefs->mAskForQuit = mAskForQuit->isChecked(); | 218 | prefs->mAskForQuit = mAskForQuit->isChecked(); |
219 | 219 | ||
220 | mAddresseeWidget->saveSettings(); | 220 | mAddresseeWidget->saveSettings(); |
221 | 221 | ||
222 | saveExtensionSettings(); | 222 | saveExtensionSettings(); |
223 | 223 | ||
224 | } | 224 | } |
225 | 225 | ||
226 | void KABConfigWidget::restoreExtensionSettings() | 226 | void KABConfigWidget::restoreExtensionSettings() |
227 | { | 227 | { |
228 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 228 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
229 | 229 | ||
230 | mExtensionView->clear(); | 230 | mExtensionView->clear(); |
231 | 231 | ||
232 | #ifndef KAB_EMBEDDED | 232 | #ifndef KAB_EMBEDDED |
233 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 233 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
234 | KTrader::OfferList::ConstIterator it; | 234 | KTrader::OfferList::ConstIterator it; |
235 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 235 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
236 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 236 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
237 | continue; | 237 | continue; |
238 | 238 | ||
239 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); | 239 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); |
240 | item->setService( *it ); | 240 | item->setService( *it ); |
241 | if ( activeExtensions.contains( item->factory()->identifier() ) ) | 241 | if ( activeExtensions.contains( item->factory()->identifier() ) ) |
242 | item->setOn( true ); | 242 | item->setOn( true ); |
243 | } | 243 | } |
244 | #else //KAB_EMBEDDED | 244 | #else //KAB_EMBEDDED |
245 | ExtensionFactory *extensionFactory = new MergeFactory(); | 245 | ExtensionFactory *extensionFactory = new MergeFactory(); |
246 | 246 | ||
247 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); | 247 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); |
248 | 248 | ||
249 | item->setFactory( extensionFactory ); | 249 | item->setFactory( extensionFactory ); |
250 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 250 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
251 | item->setOn( true ); | 251 | item->setOn( true ); |
252 | 252 | ||
253 | 253 | ||
254 | 254 | ||
255 | extensionFactory = new DistributionListFactory(); | 255 | extensionFactory = new DistributionListFactory(); |
256 | 256 | ||
257 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); | 257 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); |
258 | 258 | ||
259 | item->setFactory( extensionFactory ); | 259 | item->setFactory( extensionFactory ); |
260 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 260 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
261 | item->setOn( true ); | 261 | item->setOn( true ); |
262 | 262 | ||
263 | 263 | ||
264 | #endif //KAB_EMBEDDED | 264 | #endif //KAB_EMBEDDED |
265 | 265 | ||
266 | } | 266 | } |
267 | 267 | ||
268 | void KABConfigWidget::saveExtensionSettings() | 268 | void KABConfigWidget::saveExtensionSettings() |
269 | { | 269 | { |
270 | QStringList activeExtensions; | 270 | QStringList activeExtensions; |
271 | 271 | ||
272 | QPtrList<QListViewItem> list; | 272 | QPtrList<QListViewItem> list; |
273 | QListViewItemIterator it( mExtensionView ); | 273 | QListViewItemIterator it( mExtensionView ); |
274 | while ( it.current() ) { | 274 | while ( it.current() ) { |
275 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); | 275 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); |
276 | if ( item ) { | 276 | if ( item ) { |
277 | if ( item->isOn() ) | 277 | if ( item->isOn() ) |
278 | activeExtensions.append( item->factory()->identifier() ); | 278 | activeExtensions.append( item->factory()->identifier() ); |
279 | } | 279 | } |
280 | ++it; | 280 | ++it; |
281 | } | 281 | } |
282 | 282 | ||
283 | KABPrefs::instance()->mActiveExtensions = activeExtensions; | 283 | KABPrefs::instance()->mActiveExtensions = activeExtensions; |
284 | } | 284 | } |
285 | 285 | ||
286 | void KABConfigWidget::configureExtension() | 286 | void KABConfigWidget::configureExtension() |
287 | { | 287 | { |
288 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); | 288 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); |
289 | if ( !item ) | 289 | if ( !item ) |
290 | return; | 290 | return; |
291 | 291 | ||
292 | #ifndef KAB_EMBEDDED | 292 | #ifndef KAB_EMBEDDED |
293 | KConfig config( "kaddressbookrc" ); | 293 | KConfig config( "kaddressbookrc" ); |
294 | #else //KAB_EMBEDDED | 294 | #else //KAB_EMBEDDED |
295 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 295 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
296 | #endif //KAB_EMBEDDED | 296 | #endif //KAB_EMBEDDED |
297 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); | 297 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); |
298 | 298 | ||
299 | ExtensionConfigDialog dlg( item->factory(), &config, this ); | 299 | ExtensionConfigDialog dlg( item->factory(), &config, this ); |
300 | dlg.exec(); | 300 | dlg.exec(); |
301 | 301 | ||
302 | config.sync(); | 302 | config.sync(); |
303 | } | 303 | } |
304 | 304 | ||
305 | void KABConfigWidget::selectionChanged( QListViewItem *i ) | 305 | void KABConfigWidget::selectionChanged( QListViewItem *i ) |
306 | { | 306 | { |
307 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); | 307 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); |
308 | if ( !item ) | 308 | if ( !item ) |
309 | return; | 309 | return; |
310 | 310 | ||
311 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); | 311 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); |
312 | } | 312 | } |
313 | 313 | ||
314 | void KABConfigWidget::itemClicked( QListViewItem *item ) | 314 | void KABConfigWidget::itemClicked( QListViewItem *item ) |
315 | { | 315 | { |
316 | if ( item != 0 ) | 316 | if ( item != 0 ) |
317 | modified(); | 317 | modified(); |
318 | } | 318 | } |
319 | 319 | ||
320 | #ifndef KAB_EMBEDDED | 320 | #ifndef KAB_EMBEDDED |
321 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) | 321 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) |
322 | : QCheckListItem( parent, text, CheckBox ) | 322 | : QCheckListItem( parent, text, CheckBox ) |
323 | { | 323 | { |
324 | } | 324 | } |
325 | 325 | ||
326 | void ExtensionItem::setService( const KService::Ptr &ptr ) | 326 | void ExtensionItem::setService( const KService::Ptr &ptr ) |
327 | { | 327 | { |
328 | mPtr = ptr; | 328 | mPtr = ptr; |
329 | } | 329 | } |
330 | #else //KAB_EMBEDDED | 330 | #else //KAB_EMBEDDED |
331 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) | 331 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) |
332 | : QCheckListItem( parent, text, CheckBox ) | 332 | : QCheckListItem( parent, text, CheckBox ) |
333 | { | 333 | { |
334 | mName = name; | 334 | mName = name; |
335 | mComment = comment; | 335 | mComment = comment; |
336 | } | 336 | } |
337 | 337 | ||
338 | 338 | ||
339 | void ExtensionItem::setFactory( ExtensionFactory* fac ) | 339 | void ExtensionItem::setFactory( ExtensionFactory* fac ) |
340 | { | 340 | { |
341 | mFactory = fac; | 341 | mFactory = fac; |
342 | } | 342 | } |
343 | #endif //KAB_EMBEDDED | 343 | #endif //KAB_EMBEDDED |
344 | 344 | ||
345 | bool ExtensionItem::configWidgetAvailable() const | 345 | bool ExtensionItem::configWidgetAvailable() const |
346 | { | 346 | { |
347 | #ifndef KAB_EMBEDDED | 347 | #ifndef KAB_EMBEDDED |
348 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 348 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
349 | if ( !factory ) | 349 | if ( !factory ) |
350 | return false; | 350 | return false; |
351 | 351 | ||
352 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); | 352 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); |
353 | if ( !extensionFactory ) | 353 | if ( !extensionFactory ) |
354 | return false; | 354 | return false; |
355 | 355 | ||
356 | return extensionFactory->configureWidgetAvailable(); | 356 | return extensionFactory->configureWidgetAvailable(); |
357 | #else //KAB_EMBEDDED | 357 | #else //KAB_EMBEDDED |
358 | return mFactory->configureWidgetAvailable(); | 358 | return mFactory->configureWidgetAvailable(); |
359 | #endif //KAB_EMBEDDED | 359 | #endif //KAB_EMBEDDED |
360 | 360 | ||
361 | } | 361 | } |
362 | 362 | ||
363 | ExtensionFactory *ExtensionItem::factory() const | 363 | ExtensionFactory *ExtensionItem::factory() const |
364 | { | 364 | { |
365 | #ifndef KAB_EMBEDDED | 365 | #ifndef KAB_EMBEDDED |
366 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 366 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
367 | if ( !factory ) | 367 | if ( !factory ) |
368 | return 0; | 368 | return 0; |
369 | 369 | ||
370 | return static_cast<ExtensionFactory*>( factory ); | 370 | return static_cast<ExtensionFactory*>( factory ); |
371 | #else //KAB_EMBEDDED | 371 | #else //KAB_EMBEDDED |
372 | return mFactory; | 372 | return mFactory; |
373 | #endif //KAB_EMBEDDED | 373 | #endif //KAB_EMBEDDED |
374 | } | 374 | } |
375 | 375 | ||
376 | QString ExtensionItem::text( int column ) const | 376 | QString ExtensionItem::text( int column ) const |
377 | { | 377 | { |
378 | #ifndef KAB_EMBEDDED | 378 | #ifndef KAB_EMBEDDED |
379 | if ( column == 0 ) | 379 | if ( column == 0 ) |
380 | return mPtr->name(); | 380 | return mPtr->name(); |
381 | else if ( column == 1 ) | 381 | else if ( column == 1 ) |
382 | return mPtr->comment(); | 382 | return mPtr->comment(); |
383 | else | 383 | else |
384 | return QString::null; | 384 | return QString::null; |
385 | #else //KAB_EMBEDDED | 385 | #else //KAB_EMBEDDED |
386 | if ( column == 0 ) | 386 | if ( column == 0 ) |
387 | return mName; | 387 | return mName; |
388 | else if ( column == 1 ) | 388 | else if ( column == 1 ) |
389 | return mComment; | 389 | return mComment; |
390 | else | 390 | else |
391 | return QString::null; | 391 | return QString::null; |
392 | #endif //KAB_EMBEDDED | 392 | #endif //KAB_EMBEDDED |
393 | } | 393 | } |
394 | 394 | ||
395 | #ifndef KAB_EMBEDDED | 395 | #ifndef KAB_EMBEDDED |
396 | #include "kabconfigwidget.moc" | 396 | #include "kabconfigwidget.moc" |
397 | #endif //KAB_EMBEDDED | 397 | #endif //KAB_EMBEDDED |
398 | 398 | ||
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 332f975..6de60fa 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,781 +1,791 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KdePim/Pi. | 2 | This file is part of KdePim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qgroupbox.h> | 34 | #include <qgroupbox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qbuttongroup.h> | 37 | #include <qbuttongroup.h> |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qregexp.h> | 39 | #include <qregexp.h> |
40 | 40 | ||
41 | #include <kdialog.h> | 41 | #include <kdialog.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | #include <kdateedit.h> | 43 | #include <kdateedit.h> |
44 | #include <kglobal.h> | 44 | #include <kglobal.h> |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | /*US | 47 | /*US |
48 | #include <qcheckbox.h> | 48 | #include <qcheckbox.h> |
49 | #include <qframe.h> | 49 | #include <qframe.h> |
50 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
51 | #include <qcombobox.h> | 51 | #include <qcombobox.h> |
52 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
53 | #include <qlabel.h> | 53 | #include <qlabel.h> |
54 | #include <qfile.h> | 54 | #include <qfile.h> |
55 | 55 | ||
56 | #include <kconfig.h> | 56 | #include <kconfig.h> |
57 | #include <kdebug.h> | 57 | #include <kdebug.h> |
58 | #include <kdialog.h> | 58 | #include <kdialog.h> |
59 | #include <klistview.h> | 59 | #include <klistview.h> |
60 | #include <klocale.h> | 60 | #include <klocale.h> |
61 | #include <kglobal.h> | 61 | #include <kglobal.h> |
62 | #include <kmessagebox.h> | 62 | #include <kmessagebox.h> |
63 | #include <kstandarddirs.h> | 63 | #include <kstandarddirs.h> |
64 | 64 | ||
65 | #ifndef KAB_EMBEDDED | 65 | #ifndef KAB_EMBEDDED |
66 | #include <ktrader.h> | 66 | #include <ktrader.h> |
67 | #else // KAB_EMBEDDED | 67 | #else // KAB_EMBEDDED |
68 | #include <mergewidget.h> | 68 | #include <mergewidget.h> |
69 | #include <distributionlistwidget.h> | 69 | #include <distributionlistwidget.h> |
70 | #endif // KAB_EMBEDDED | 70 | #endif // KAB_EMBEDDED |
71 | 71 | ||
72 | #include "addresseewidget.h" | 72 | #include "addresseewidget.h" |
73 | #include "extensionconfigdialog.h" | 73 | #include "extensionconfigdialog.h" |
74 | #include "extensionwidget.h" | 74 | #include "extensionwidget.h" |
75 | */ | 75 | */ |
76 | 76 | ||
77 | #include "qapplication.h" | 77 | #include "qapplication.h" |
78 | 78 | ||
79 | #include "kpimglobalprefs.h" | 79 | #include "kpimglobalprefs.h" |
80 | 80 | ||
81 | #include "kdepimconfigwidget.h" | 81 | #include "kdepimconfigwidget.h" |
82 | 82 | ||
83 | 83 | ||
84 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 84 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
85 | : KPrefsWidget(prefs, parent, name ) | 85 | : KPrefsWidget(prefs, parent, name ) |
86 | { | 86 | { |
87 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 87 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
88 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 88 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
89 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 89 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
90 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 90 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
91 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 91 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
92 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 92 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
93 | 93 | ||
94 | 94 | ||
95 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 95 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
96 | KDialog::spacingHint() ); | 96 | KDialog::spacingHint() ); |
97 | 97 | ||
98 | tabWidget = new QTabWidget( this ); | 98 | tabWidget = new QTabWidget( this ); |
99 | topLayout->addWidget( tabWidget ); | 99 | topLayout->addWidget( tabWidget ); |
100 | 100 | ||
101 | 101 | ||
102 | setupLocaleTab(); | 102 | setupLocaleTab(); |
103 | setupLocaleDateTab(); | 103 | setupLocaleDateTab(); |
104 | setupTimeZoneTab(); | 104 | setupTimeZoneTab(); |
105 | setupExternalAppTab(); | 105 | setupExternalAppTab(); |
106 | 106 | ||
107 | } | 107 | } |
108 | void KDEPIMConfigWidget::showTimeZoneTab() | 108 | void KDEPIMConfigWidget::showTimeZoneTab() |
109 | { | 109 | { |
110 | tabWidget->setCurrentPage ( 2 ) ; | 110 | tabWidget->setCurrentPage ( 2 ) ; |
111 | } | 111 | } |
112 | void KDEPIMConfigWidget::setupExternalAppTab() | 112 | void KDEPIMConfigWidget::setupExternalAppTab() |
113 | { | 113 | { |
114 | QWidget *externalAppsPage = new QWidget( this ); | 114 | QWidget *externalAppsPage = new QWidget( this ); |
115 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 115 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
116 | KDialog::spacingHintSmall() ); | 116 | KDialog::spacingHintSmall() ); |
117 | 117 | ||
118 | mExternalApps = new QComboBox( externalAppsPage ); | 118 | mExternalApps = new QComboBox( externalAppsPage ); |
119 | 119 | ||
120 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 120 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
121 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 121 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
122 | mExternalApps->insertItem( it.data(), it.key() ); | 122 | mExternalApps->insertItem( it.data(), it.key() ); |
123 | 123 | ||
124 | layout->addWidget( mExternalApps ); | 124 | layout->addWidget( mExternalApps ); |
125 | 125 | ||
126 | connect( mExternalApps, SIGNAL( activated( int ) ), | 126 | connect( mExternalApps, SIGNAL( activated( int ) ), |
127 | this, SLOT (externalapp_changed( int ) ) ); | 127 | this, SLOT (externalapp_changed( int ) ) ); |
128 | 128 | ||
129 | 129 | ||
130 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 130 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
131 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 131 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
132 | 132 | mExternalAppGroupBox->layout()->setMargin(5); | |
133 | 133 | ||
134 | mClient = new QComboBox( mExternalAppGroupBox ); | 134 | mClient = new QComboBox( mExternalAppGroupBox ); |
135 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 135 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
136 | 136 | ||
137 | connect( mClient, SIGNAL( activated( int ) ), | 137 | connect( mClient, SIGNAL( activated( int ) ), |
138 | this, SLOT (client_changed( int ) ) ); | 138 | this, SLOT (client_changed( int ) ) ); |
139 | 139 | ||
140 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 140 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
141 | boxLayout->addWidget( lab, 1, 0 ); | 141 | boxLayout->addWidget( lab, 1, 0 ); |
142 | mChannel = new QLineEdit(mExternalAppGroupBox); | 142 | mChannel = new QLineEdit(mExternalAppGroupBox); |
143 | mChannel->setReadOnly(true); | 143 | mChannel->setReadOnly(true); |
144 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 144 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
145 | 145 | ||
146 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 146 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
147 | boxLayout->addWidget( lab, 3, 0 ); | 147 | boxLayout->addWidget( lab, 3, 0 ); |
148 | mMessage = new QLineEdit(mExternalAppGroupBox); | 148 | mMessage = new QLineEdit(mExternalAppGroupBox); |
149 | mMessage->setReadOnly(true); | 149 | mMessage->setReadOnly(true); |
150 | boxLayout->addWidget( mMessage , 4, 0); | 150 | boxLayout->addWidget( mMessage , 4, 0); |
151 | 151 | ||
152 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 152 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
153 | boxLayout->addWidget( lab, 3, 1 ); | 153 | boxLayout->addWidget( lab, 3, 1 ); |
154 | mParameters = new QLineEdit(mExternalAppGroupBox); | 154 | mParameters = new QLineEdit(mExternalAppGroupBox); |
155 | mParameters->setReadOnly(true); | 155 | mParameters->setReadOnly(true); |
156 | boxLayout->addWidget( mParameters, 4, 1 ); | 156 | boxLayout->addWidget( mParameters, 4, 1 ); |
157 | 157 | ||
158 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 158 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
159 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 159 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
160 | 160 | ||
161 | |||
161 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 162 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
162 | boxLayout->addWidget( lab, 6, 0 ); | 163 | boxLayout->addWidget( lab, 6, 0 ); |
163 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 164 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
164 | mMessage2->setReadOnly(true); | 165 | mMessage2->setReadOnly(true); |
165 | boxLayout->addWidget( mMessage2 , 7, 0); | 166 | boxLayout->addWidget( mMessage2 , 7, 0); |
166 | 167 | ||
167 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 168 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
168 | boxLayout->addWidget( lab, 6, 1 ); | 169 | boxLayout->addWidget( lab, 6, 1 ); |
169 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 170 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
170 | mParameters2->setReadOnly(true); | 171 | mParameters2->setReadOnly(true); |
171 | boxLayout->addWidget( mParameters2, 7, 1 ); | 172 | boxLayout->addWidget( mParameters2, 7, 1 ); |
172 | 173 | ||
173 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 174 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
174 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 175 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
175 | 176 | ||
176 | 177 | ||
177 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 178 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
178 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 179 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
179 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 180 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
180 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 181 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
181 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 182 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
182 | 183 | ||
183 | 184 | ||
184 | layout->addWidget( mExternalAppGroupBox ); | 185 | layout->addWidget( mExternalAppGroupBox ); |
185 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 186 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
186 | 187 | ||
187 | } | 188 | } |
188 | 189 | ||
189 | 190 | ||
190 | void KDEPIMConfigWidget::setupLocaleDateTab() | 191 | void KDEPIMConfigWidget::setupLocaleDateTab() |
191 | { | 192 | { |
192 | QWidget *topFrame = new QWidget( this ); | 193 | QWidget *topFrame = new QWidget( this ); |
193 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | 194 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); |
194 | 195 | ||
195 | topLayout->setSpacing(KDialog::spacingHint()); | 196 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
196 | topLayout->setMargin(KDialog::marginHint()); | 197 | topLayout->setMargin(KDialog::marginHintSmall()); |
197 | int iii = 0; | 198 | int iii = 0; |
198 | 199 | ||
199 | 200 | ||
200 | KPrefsWidRadios *syncPrefsGroup = | 201 | KPrefsWidRadios *syncPrefsGroup = |
201 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | 202 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); |
202 | QString format; | 203 | QString format; |
203 | if ( QApplication::desktop()->width() < 480 ) | 204 | if ( QApplication::desktop()->width() < 480 ) |
204 | format = "(%d.%m.%Y)"; | 205 | format = "(%d.%m.%Y)"; |
205 | else | 206 | else |
206 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 207 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
207 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 208 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
208 | if ( QApplication::desktop()->width() < 480 ) | 209 | if ( QApplication::desktop()->width() < 480 ) |
209 | format = "(%m.%d.%Y)"; | 210 | format = "(%m.%d.%Y)"; |
210 | else | 211 | else |
211 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 212 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
212 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 213 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
213 | if ( QApplication::desktop()->width() < 480 ) | 214 | if ( QApplication::desktop()->width() < 480 ) |
214 | format = "(%Y-%m-%d)"; | 215 | format = "(%Y-%m-%d)"; |
215 | else | 216 | else |
216 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 217 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
217 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 218 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
218 | syncPrefsGroup->addRadio(i18n("User defined")); | 219 | syncPrefsGroup->addRadio(i18n("User defined")); |
220 | if ( QApplication::desktop()->width() < 480 ) { | ||
221 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | ||
222 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | ||
223 | } | ||
219 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 224 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
220 | ++iii; | 225 | ++iii; |
221 | ++iii; | 226 | ++iii; |
222 | QLabel * lab; | 227 | QLabel * lab; |
223 | mUserDateFormatLong = new QLineEdit(topFrame); | 228 | mUserDateFormatLong = new QLineEdit(topFrame); |
224 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 229 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
225 | topLayout->addWidget(lab ,iii,0); | 230 | topLayout->addWidget(lab ,iii,0); |
226 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 231 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
227 | ++iii; | 232 | ++iii; |
228 | mUserDateFormatShort = new QLineEdit(topFrame); | 233 | mUserDateFormatShort = new QLineEdit(topFrame); |
229 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 234 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
230 | topLayout->addWidget(lab ,iii,0); | 235 | topLayout->addWidget(lab ,iii,0); |
231 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 236 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
232 | ++iii; | 237 | ++iii; |
233 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 238 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
234 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 239 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
235 | ++iii; | 240 | ++iii; |
236 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 241 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
237 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 242 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
238 | ++iii; | 243 | ++iii; |
239 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 244 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
240 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 245 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
241 | ++iii; | 246 | ++iii; |
242 | 247 | ||
243 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 248 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
244 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 249 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
245 | 250 | ||
246 | 251 | ||
247 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | 252 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); |
248 | } | 253 | } |
249 | 254 | ||
250 | void KDEPIMConfigWidget::setupLocaleTab() | 255 | void KDEPIMConfigWidget::setupLocaleTab() |
251 | { | 256 | { |
252 | 257 | ||
253 | QWidget *topFrame = new QWidget( this ); | 258 | QWidget *topFrame = new QWidget( this ); |
254 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 259 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
255 | 260 | ||
256 | topLayout->setSpacing(KDialog::spacingHint()); | 261 | topLayout->setSpacing(KDialog::spacingHint()); |
257 | topLayout->setMargin(KDialog::marginHint()); | 262 | topLayout->setMargin(KDialog::marginHint()); |
258 | int iii = 0; | 263 | int iii = 0; |
259 | KPrefsWidRadios *syncPrefsGroup = | 264 | KPrefsWidRadios *syncPrefsGroup = |
260 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | 265 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); |
261 | syncPrefsGroup->addRadio(i18n("English")); | 266 | syncPrefsGroup->addRadio(i18n("English")); |
262 | syncPrefsGroup->addRadio(i18n("German")); | 267 | syncPrefsGroup->addRadio(i18n("German")); |
263 | syncPrefsGroup->addRadio(i18n("French")); | 268 | syncPrefsGroup->addRadio(i18n("French")); |
264 | syncPrefsGroup->addRadio(i18n("Italian")); | 269 | syncPrefsGroup->addRadio(i18n("Italian")); |
265 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 270 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
266 | if ( QApplication::desktop()->width() < 300 ) | 271 | if ( QApplication::desktop()->width() < 300 ) { |
267 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 272 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
273 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | ||
274 | } | ||
268 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 275 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
269 | ++iii; | 276 | ++iii; |
270 | 277 | ||
271 | syncPrefsGroup = | 278 | syncPrefsGroup = |
272 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | 279 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); |
273 | if ( QApplication::desktop()->width() > 300 ) | 280 | if ( QApplication::desktop()->width() > 300 ) |
274 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 281 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
275 | syncPrefsGroup->addRadio(i18n("24:00")); | 282 | syncPrefsGroup->addRadio(i18n("24:00")); |
276 | syncPrefsGroup->addRadio(i18n("12:00am")); | 283 | syncPrefsGroup->addRadio(i18n("12:00am")); |
277 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 284 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
278 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 285 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
279 | ++iii; | 286 | ++iii; |
280 | 287 | ||
281 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | 288 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), |
282 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | 289 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); |
283 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 290 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
284 | ++iii; | 291 | ++iii; |
285 | 292 | ||
286 | 293 | ||
287 | tabWidget->addTab( topFrame, i18n( "Locale" ) ); | 294 | tabWidget->addTab( topFrame, i18n( "Locale" ) ); |
288 | 295 | ||
289 | } | 296 | } |
290 | 297 | ||
291 | 298 | ||
292 | void KDEPIMConfigWidget::setupTimeZoneTab() | 299 | void KDEPIMConfigWidget::setupTimeZoneTab() |
293 | { | 300 | { |
294 | QWidget *topFrame = new QWidget( this ); | 301 | QWidget *topFrame = new QWidget( this ); |
295 | QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2); | 302 | QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2); |
296 | topLayout->setSpacing(KDialog::spacingHint()); | 303 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
297 | topLayout->setMargin(KDialog::marginHint()); | 304 | topLayout->setMargin(KDialog::marginHintSmall()); |
298 | 305 | ||
299 | QHBox *timeZoneBox = new QHBox( topFrame ); | 306 | QHBox *timeZoneBox = new QHBox( topFrame ); |
300 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 307 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
301 | 308 | ||
302 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 309 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
303 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 310 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
304 | if ( QApplication::desktop()->width() < 300 ) { | 311 | if ( QApplication::desktop()->width() < 300 ) { |
305 | mTimeZoneCombo->setMaximumWidth(150); | 312 | mTimeZoneCombo->setMaximumWidth(150); |
306 | } | 313 | } |
307 | 314 | ||
308 | QStringList list; | 315 | QStringList list; |
309 | list = KGlobal::locale()->timeZoneList(); | 316 | list = KGlobal::locale()->timeZoneList(); |
310 | mTimeZoneCombo->insertStringList(list); | 317 | mTimeZoneCombo->insertStringList(list); |
311 | 318 | ||
312 | // find the currently set time zone and select it | 319 | // find the currently set time zone and select it |
313 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | 320 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; |
314 | int nCurrentlySet = 11; | 321 | int nCurrentlySet = 11; |
315 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 322 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
316 | { | 323 | { |
317 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 324 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
318 | { | 325 | { |
319 | nCurrentlySet = i; | 326 | nCurrentlySet = i; |
320 | break; | 327 | break; |
321 | } | 328 | } |
322 | } | 329 | } |
323 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 330 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
324 | int iii = 1; | 331 | int iii = 1; |
325 | KPrefsWidBool *sb = | 332 | KPrefsWidBool *sb = |
326 | addWidBool(i18n("Add 30 min (+00:30) to selected Timezone"), | 333 | addWidBool(i18n("Add 30 min (+00:30) to selected Timezone"), |
327 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); | 334 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); |
328 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 335 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
329 | ++iii; | 336 | ++iii; |
330 | sb = | 337 | sb = |
331 | addWidBool(i18n("Timezone has daylight saving"), | 338 | addWidBool(i18n("Timezone has daylight saving"), |
332 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | 339 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); |
333 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 340 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
334 | ++iii; | 341 | ++iii; |
335 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 342 | QLabel* lab; |
343 | |||
344 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | ||
336 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 345 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
337 | ++iii; | 346 | ++iii; |
347 | |||
338 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 348 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
339 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 349 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
340 | ++iii; | 350 | ++iii; |
341 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 351 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
342 | topLayout->addWidget(lab, iii,0); | 352 | topLayout->addWidget(lab, iii,0); |
343 | mStartDateSavingEdit = new KDateEdit(topFrame); | 353 | mStartDateSavingEdit = new KDateEdit(topFrame); |
344 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 354 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
345 | ++iii; | 355 | ++iii; |
346 | 356 | ||
347 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 357 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
348 | topLayout->addWidget(lab, iii,0); | 358 | topLayout->addWidget(lab, iii,0); |
349 | mEndDateSavingEdit = new KDateEdit(topFrame); | 359 | mEndDateSavingEdit = new KDateEdit(topFrame); |
350 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 360 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
351 | ++iii; | 361 | ++iii; |
352 | QDate current ( 2001, 1,1); | 362 | QDate current ( 2001, 1,1); |
353 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | 363 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); |
354 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | 364 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); |
355 | 365 | ||
356 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 366 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
357 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 367 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
358 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | 368 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); |
359 | 369 | ||
360 | 370 | ||
361 | 371 | ||
362 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | 372 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); |
363 | 373 | ||
364 | } | 374 | } |
365 | 375 | ||
366 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 376 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
367 | { | 377 | { |
368 | // first store the current data | 378 | // first store the current data |
369 | saveEditFieldSettings(); | 379 | saveEditFieldSettings(); |
370 | 380 | ||
371 | // set mCurrentApp | 381 | // set mCurrentApp |
372 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 382 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
373 | 383 | ||
374 | // set mCurrentClient | 384 | // set mCurrentClient |
375 | switch(mCurrentApp) | 385 | switch(mCurrentApp) |
376 | { | 386 | { |
377 | case(ExternalAppHandler::EMAIL): | 387 | case(ExternalAppHandler::EMAIL): |
378 | mCurrentClient = mEmailClient; | 388 | mCurrentClient = mEmailClient; |
379 | break; | 389 | break; |
380 | case(ExternalAppHandler::PHONE): | 390 | case(ExternalAppHandler::PHONE): |
381 | mCurrentClient = mPhoneClient; | 391 | mCurrentClient = mPhoneClient; |
382 | break; | 392 | break; |
383 | case(ExternalAppHandler::SMS): | 393 | case(ExternalAppHandler::SMS): |
384 | mCurrentClient = mSMSClient; | 394 | mCurrentClient = mSMSClient; |
385 | break; | 395 | break; |
386 | case(ExternalAppHandler::FAX): | 396 | case(ExternalAppHandler::FAX): |
387 | mCurrentClient = mFaxClient; | 397 | mCurrentClient = mFaxClient; |
388 | break; | 398 | break; |
389 | case(ExternalAppHandler::PAGER): | 399 | case(ExternalAppHandler::PAGER): |
390 | mCurrentClient = mPagerClient; | 400 | mCurrentClient = mPagerClient; |
391 | break; | 401 | break; |
392 | case(ExternalAppHandler::SIP): | 402 | case(ExternalAppHandler::SIP): |
393 | mCurrentClient = mSipClient; | 403 | mCurrentClient = mSipClient; |
394 | break; | 404 | break; |
395 | default: | 405 | default: |
396 | return; | 406 | return; |
397 | } | 407 | } |
398 | 408 | ||
399 | // and at last update the widgets | 409 | // and at last update the widgets |
400 | updateClientWidgets(); | 410 | updateClientWidgets(); |
401 | } | 411 | } |
402 | 412 | ||
403 | 413 | ||
404 | 414 | ||
405 | void KDEPIMConfigWidget::client_changed( int newClient ) | 415 | void KDEPIMConfigWidget::client_changed( int newClient ) |
406 | { | 416 | { |
407 | if (newClient == mCurrentClient) | 417 | if (newClient == mCurrentClient) |
408 | return; | 418 | return; |
409 | 419 | ||
410 | // first store the current data | 420 | // first store the current data |
411 | saveEditFieldSettings(); | 421 | saveEditFieldSettings(); |
412 | 422 | ||
413 | 423 | ||
414 | //then reset the clientvariable | 424 | //then reset the clientvariable |
415 | mCurrentClient = newClient; | 425 | mCurrentClient = newClient; |
416 | 426 | ||
417 | // and at last update the widgets | 427 | // and at last update the widgets |
418 | updateClientWidgets(); | 428 | updateClientWidgets(); |
419 | 429 | ||
420 | KPrefsWidget::modified(); | 430 | KPrefsWidget::modified(); |
421 | } | 431 | } |
422 | 432 | ||
423 | void KDEPIMConfigWidget::saveEditFieldSettings() | 433 | void KDEPIMConfigWidget::saveEditFieldSettings() |
424 | { | 434 | { |
425 | 435 | ||
426 | switch(mCurrentApp) | 436 | switch(mCurrentApp) |
427 | { | 437 | { |
428 | case(ExternalAppHandler::EMAIL): | 438 | case(ExternalAppHandler::EMAIL): |
429 | mEmailClient = mClient->currentItem(); | 439 | mEmailClient = mClient->currentItem(); |
430 | break; | 440 | break; |
431 | case(ExternalAppHandler::PHONE): | 441 | case(ExternalAppHandler::PHONE): |
432 | mPhoneClient= mClient->currentItem(); | 442 | mPhoneClient= mClient->currentItem(); |
433 | break; | 443 | break; |
434 | case(ExternalAppHandler::SMS): | 444 | case(ExternalAppHandler::SMS): |
435 | mSMSClient = mClient->currentItem(); | 445 | mSMSClient = mClient->currentItem(); |
436 | break; | 446 | break; |
437 | case(ExternalAppHandler::FAX): | 447 | case(ExternalAppHandler::FAX): |
438 | mFaxClient = mClient->currentItem(); | 448 | mFaxClient = mClient->currentItem(); |
439 | break; | 449 | break; |
440 | case(ExternalAppHandler::PAGER): | 450 | case(ExternalAppHandler::PAGER): |
441 | mPagerClient = mClient->currentItem(); | 451 | mPagerClient = mClient->currentItem(); |
442 | break; | 452 | break; |
443 | case(ExternalAppHandler::SIP): | 453 | case(ExternalAppHandler::SIP): |
444 | mSipClient = mClient->currentItem(); | 454 | mSipClient = mClient->currentItem(); |
445 | break; | 455 | break; |
446 | default: | 456 | default: |
447 | return; | 457 | return; |
448 | } | 458 | } |
449 | 459 | ||
450 | //store the current data back to the apropriate membervariables if we had set it to "other" | 460 | //store the current data back to the apropriate membervariables if we had set it to "other" |
451 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 461 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
452 | { | 462 | { |
453 | mEmailOtherChannel = mChannel->text(); | 463 | mEmailOtherChannel = mChannel->text(); |
454 | mEmailOtherMessage = mMessage->text(); | 464 | mEmailOtherMessage = mMessage->text(); |
455 | mEmailOtherMessageParameters = mParameters->text(); | 465 | mEmailOtherMessageParameters = mParameters->text(); |
456 | mEmailOtherMessage2 = mMessage2->text(); | 466 | mEmailOtherMessage2 = mMessage2->text(); |
457 | mEmailOtherMessageParameters2 = mParameters2->text(); | 467 | mEmailOtherMessageParameters2 = mParameters2->text(); |
458 | } | 468 | } |
459 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 469 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
460 | { | 470 | { |
461 | mPhoneOtherChannel = mChannel->text(); | 471 | mPhoneOtherChannel = mChannel->text(); |
462 | mPhoneOtherMessage = mMessage->text(); | 472 | mPhoneOtherMessage = mMessage->text(); |
463 | mPhoneOtherMessageParameters = mParameters->text(); | 473 | mPhoneOtherMessageParameters = mParameters->text(); |
464 | } | 474 | } |
465 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 475 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
466 | { | 476 | { |
467 | mSMSOtherChannel = mChannel->text(); | 477 | mSMSOtherChannel = mChannel->text(); |
468 | mSMSOtherMessage = mMessage->text(); | 478 | mSMSOtherMessage = mMessage->text(); |
469 | mSMSOtherMessageParameters = mParameters->text(); | 479 | mSMSOtherMessageParameters = mParameters->text(); |
470 | } | 480 | } |
471 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 481 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
472 | { | 482 | { |
473 | mFaxOtherChannel = mChannel->text(); | 483 | mFaxOtherChannel = mChannel->text(); |
474 | mFaxOtherMessage = mMessage->text(); | 484 | mFaxOtherMessage = mMessage->text(); |
475 | mFaxOtherMessageParameters = mParameters->text(); | 485 | mFaxOtherMessageParameters = mParameters->text(); |
476 | } | 486 | } |
477 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 487 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
478 | { | 488 | { |
479 | mPagerOtherChannel = mChannel->text(); | 489 | mPagerOtherChannel = mChannel->text(); |
480 | mPagerOtherMessage = mMessage->text(); | 490 | mPagerOtherMessage = mMessage->text(); |
481 | mPagerOtherMessageParameters = mParameters->text(); | 491 | mPagerOtherMessageParameters = mParameters->text(); |
482 | } | 492 | } |
483 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 493 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
484 | { | 494 | { |
485 | mSipOtherChannel = mChannel->text(); | 495 | mSipOtherChannel = mChannel->text(); |
486 | mSipOtherMessage = mMessage->text(); | 496 | mSipOtherMessage = mMessage->text(); |
487 | mSipOtherMessageParameters = mParameters->text(); | 497 | mSipOtherMessageParameters = mParameters->text(); |
488 | } | 498 | } |
489 | 499 | ||
490 | 500 | ||
491 | } | 501 | } |
492 | 502 | ||
493 | void KDEPIMConfigWidget::updateClientWidgets() | 503 | void KDEPIMConfigWidget::updateClientWidgets() |
494 | { | 504 | { |
495 | bool blocked = signalsBlocked(); | 505 | bool blocked = signalsBlocked(); |
496 | blockSignals( true ); | 506 | blockSignals( true ); |
497 | 507 | ||
498 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 508 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
499 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 509 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
500 | if (it == mExternalAppsMap.end()) | 510 | if (it == mExternalAppsMap.end()) |
501 | return; | 511 | return; |
502 | 512 | ||
503 | // update group box | 513 | // update group box |
504 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 514 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
505 | 515 | ||
506 | //update the entries in the client combobox | 516 | //update the entries in the client combobox |
507 | mClient->clear(); | 517 | mClient->clear(); |
508 | 518 | ||
509 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 519 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
510 | DefaultAppItem* dai; | 520 | DefaultAppItem* dai; |
511 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 521 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
512 | { | 522 | { |
513 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 523 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
514 | 524 | ||
515 | if (dai->_id == mCurrentClient) | 525 | if (dai->_id == mCurrentClient) |
516 | { | 526 | { |
517 | //restore the edit fields with the data of the local membervariables if we had set it to "other". | 527 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
518 | //Otherwise take the default data from externalapphandler. | 528 | //Otherwise take the default data from externalapphandler. |
519 | mChannel->setText(dai->_channel); | 529 | mChannel->setText(dai->_channel); |
520 | mMessage->setText(dai->_message); | 530 | mMessage->setText(dai->_message); |
521 | mParameters->setText(dai->_parameters); | 531 | mParameters->setText(dai->_parameters); |
522 | mMessage2->setText(dai->_message2); | 532 | mMessage2->setText(dai->_message2); |
523 | mParameters2->setText(dai->_parameters2); | 533 | mParameters2->setText(dai->_parameters2); |
524 | 534 | ||
525 | 535 | ||
526 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 536 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
527 | { | 537 | { |
528 | mChannel->setText(mEmailOtherChannel); | 538 | mChannel->setText(mEmailOtherChannel); |
529 | mMessage->setText(mEmailOtherMessage); | 539 | mMessage->setText(mEmailOtherMessage); |
530 | mParameters->setText(mEmailOtherMessageParameters); | 540 | mParameters->setText(mEmailOtherMessageParameters); |
531 | mMessage2->setText(mEmailOtherMessage2); | 541 | mMessage2->setText(mEmailOtherMessage2); |
532 | mParameters2->setText(mEmailOtherMessageParameters2); | 542 | mParameters2->setText(mEmailOtherMessageParameters2); |
533 | } | 543 | } |
534 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 544 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
535 | { | 545 | { |
536 | mChannel->setText(mPhoneOtherChannel); | 546 | mChannel->setText(mPhoneOtherChannel); |
537 | mMessage->setText(mPhoneOtherMessage); | 547 | mMessage->setText(mPhoneOtherMessage); |
538 | mParameters->setText(mPhoneOtherMessageParameters); | 548 | mParameters->setText(mPhoneOtherMessageParameters); |
539 | } | 549 | } |
540 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 550 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
541 | { | 551 | { |
542 | mChannel->setText(mSMSOtherChannel); | 552 | mChannel->setText(mSMSOtherChannel); |
543 | mMessage->setText(mSMSOtherMessage); | 553 | mMessage->setText(mSMSOtherMessage); |
544 | mParameters->setText(mSMSOtherMessageParameters); | 554 | mParameters->setText(mSMSOtherMessageParameters); |
545 | } | 555 | } |
546 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 556 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
547 | { | 557 | { |
548 | mChannel->setText(mFaxOtherChannel); | 558 | mChannel->setText(mFaxOtherChannel); |
549 | mMessage->setText(mFaxOtherMessage); | 559 | mMessage->setText(mFaxOtherMessage); |
550 | mParameters->setText(mFaxOtherMessageParameters); | 560 | mParameters->setText(mFaxOtherMessageParameters); |
551 | } | 561 | } |
552 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 562 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
553 | { | 563 | { |
554 | mChannel->setText(mPagerOtherChannel); | 564 | mChannel->setText(mPagerOtherChannel); |
555 | mMessage->setText(mPagerOtherMessage); | 565 | mMessage->setText(mPagerOtherMessage); |
556 | mParameters->setText(mPagerOtherMessageParameters); | 566 | mParameters->setText(mPagerOtherMessageParameters); |
557 | } | 567 | } |
558 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 568 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
559 | { | 569 | { |
560 | mChannel->setText(mSipOtherChannel); | 570 | mChannel->setText(mSipOtherChannel); |
561 | mMessage->setText(mSipOtherMessage); | 571 | mMessage->setText(mSipOtherMessage); |
562 | mParameters->setText(mSipOtherMessageParameters); | 572 | mParameters->setText(mSipOtherMessageParameters); |
563 | } | 573 | } |
564 | } | 574 | } |
565 | 575 | ||
566 | } | 576 | } |
567 | 577 | ||
568 | bool readonly; | 578 | bool readonly; |
569 | bool enabled; | 579 | bool enabled; |
570 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 580 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
571 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 581 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
572 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 582 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
573 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 583 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
574 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 584 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
575 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) | 585 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) |
576 | { | 586 | { |
577 | readonly = false; | 587 | readonly = false; |
578 | } | 588 | } |
579 | else | 589 | else |
580 | { | 590 | { |
581 | readonly = true; | 591 | readonly = true; |
582 | } | 592 | } |
583 | 593 | ||
584 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) | 594 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) |
585 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) | 595 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) |
586 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) | 596 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) |
587 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) | 597 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) |
588 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) | 598 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) |
589 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) | 599 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) |
590 | { | 600 | { |
591 | enabled = false; | 601 | enabled = false; |
592 | } | 602 | } |
593 | else | 603 | else |
594 | { | 604 | { |
595 | enabled = true; | 605 | enabled = true; |
596 | } | 606 | } |
597 | 607 | ||
598 | 608 | ||
599 | mChannel->setReadOnly(readonly); | 609 | mChannel->setReadOnly(readonly); |
600 | mMessage->setReadOnly(readonly); | 610 | mMessage->setReadOnly(readonly); |
601 | mParameters->setReadOnly(readonly); | 611 | mParameters->setReadOnly(readonly); |
602 | mMessage2->setReadOnly(readonly); | 612 | mMessage2->setReadOnly(readonly); |
603 | mParameters2->setReadOnly(readonly); | 613 | mParameters2->setReadOnly(readonly); |
604 | 614 | ||
605 | mChannel->setEnabled(enabled); | 615 | mChannel->setEnabled(enabled); |
606 | mMessage->setEnabled(enabled); | 616 | mMessage->setEnabled(enabled); |
607 | mParameters->setEnabled(enabled); | 617 | mParameters->setEnabled(enabled); |
608 | mMessage2->setEnabled(enabled); | 618 | mMessage2->setEnabled(enabled); |
609 | mParameters2->setEnabled(enabled); | 619 | mParameters2->setEnabled(enabled); |
610 | 620 | ||
611 | 621 | ||
612 | 622 | ||
613 | mClient->setCurrentItem(mCurrentClient); | 623 | mClient->setCurrentItem(mCurrentClient); |
614 | 624 | ||
615 | 625 | ||
616 | // enable/disable the extra message/parameter field | 626 | // enable/disable the extra message/parameter field |
617 | if (mCurrentApp == ExternalAppHandler::EMAIL) | 627 | if (mCurrentApp == ExternalAppHandler::EMAIL) |
618 | { | 628 | { |
619 | } | 629 | } |
620 | else | 630 | else |
621 | { | 631 | { |
622 | mMessage2->setText( "" ); | 632 | mMessage2->setText( "" ); |
623 | mParameters2->setText( "" ); | 633 | mParameters2->setText( "" ); |
624 | } | 634 | } |
625 | 635 | ||
626 | if (enabled == true) { | 636 | if (enabled == true) { |
627 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 637 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
628 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 638 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
629 | } | 639 | } |
630 | 640 | ||
631 | 641 | ||
632 | blockSignals( blocked ); | 642 | blockSignals( blocked ); |
633 | 643 | ||
634 | } | 644 | } |
635 | 645 | ||
636 | void KDEPIMConfigWidget::usrReadConfig() | 646 | void KDEPIMConfigWidget::usrReadConfig() |
637 | { | 647 | { |
638 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 648 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
639 | 649 | ||
640 | bool blocked = signalsBlocked(); | 650 | bool blocked = signalsBlocked(); |
641 | blockSignals( true ); | 651 | blockSignals( true ); |
642 | 652 | ||
643 | QString dummy = prefs->mUserDateFormatLong; | 653 | QString dummy = prefs->mUserDateFormatLong; |
644 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 654 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
645 | dummy = prefs->mUserDateFormatShort; | 655 | dummy = prefs->mUserDateFormatShort; |
646 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 656 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
647 | 657 | ||
648 | QDate current ( 2001, 1,1); | 658 | QDate current ( 2001, 1,1); |
649 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); | 659 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); |
650 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); | 660 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); |
651 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); | 661 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); |
652 | 662 | ||
653 | 663 | ||
654 | 664 | ||
655 | 665 | ||
656 | mEmailClient = prefs->mEmailClient; | 666 | mEmailClient = prefs->mEmailClient; |
657 | mEmailOtherChannel = prefs->mEmailOtherChannel; | 667 | mEmailOtherChannel = prefs->mEmailOtherChannel; |
658 | mEmailOtherMessage = prefs->mEmailOtherMessage; | 668 | mEmailOtherMessage = prefs->mEmailOtherMessage; |
659 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; | 669 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; |
660 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; | 670 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; |
661 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; | 671 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; |
662 | 672 | ||
663 | mPhoneClient = prefs->mPhoneClient; | 673 | mPhoneClient = prefs->mPhoneClient; |
664 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; | 674 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; |
665 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; | 675 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; |
666 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; | 676 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; |
667 | 677 | ||
668 | mFaxClient = prefs->mFaxClient; | 678 | mFaxClient = prefs->mFaxClient; |
669 | mFaxOtherChannel = prefs->mFaxOtherChannel; | 679 | mFaxOtherChannel = prefs->mFaxOtherChannel; |
670 | mFaxOtherMessage = prefs->mFaxOtherMessage; | 680 | mFaxOtherMessage = prefs->mFaxOtherMessage; |
671 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; | 681 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; |
672 | 682 | ||
673 | mSMSClient = prefs->mSMSClient; | 683 | mSMSClient = prefs->mSMSClient; |
674 | mSMSOtherChannel = prefs->mSMSOtherChannel; | 684 | mSMSOtherChannel = prefs->mSMSOtherChannel; |
675 | mSMSOtherMessage = prefs->mSMSOtherMessage; | 685 | mSMSOtherMessage = prefs->mSMSOtherMessage; |
676 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; | 686 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; |
677 | 687 | ||
678 | mPagerClient = prefs->mPagerClient; | 688 | mPagerClient = prefs->mPagerClient; |
679 | mPagerOtherChannel = prefs->mPagerOtherChannel; | 689 | mPagerOtherChannel = prefs->mPagerOtherChannel; |
680 | mPagerOtherMessage = prefs->mPagerOtherMessage; | 690 | mPagerOtherMessage = prefs->mPagerOtherMessage; |
681 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; | 691 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; |
682 | 692 | ||
683 | mSipClient = prefs->mPagerClient; | 693 | mSipClient = prefs->mPagerClient; |
684 | mSipOtherChannel = prefs->mSipOtherChannel; | 694 | mSipOtherChannel = prefs->mSipOtherChannel; |
685 | mSipOtherMessage = prefs->mSipOtherMessage; | 695 | mSipOtherMessage = prefs->mSipOtherMessage; |
686 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; | 696 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; |
687 | 697 | ||
688 | mCurrentApp = ExternalAppHandler::EMAIL; | 698 | mCurrentApp = ExternalAppHandler::EMAIL; |
689 | mCurrentClient = mEmailClient; | 699 | mCurrentClient = mEmailClient; |
690 | 700 | ||
691 | updateClientWidgets(); | 701 | updateClientWidgets(); |
692 | 702 | ||
693 | blockSignals( blocked ); | 703 | blockSignals( blocked ); |
694 | 704 | ||
695 | } | 705 | } |
696 | 706 | ||
697 | void KDEPIMConfigWidget::usrWriteConfig() | 707 | void KDEPIMConfigWidget::usrWriteConfig() |
698 | { | 708 | { |
699 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 709 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
700 | 710 | ||
701 | saveEditFieldSettings(); | 711 | saveEditFieldSettings(); |
702 | 712 | ||
703 | 713 | ||
704 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 714 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
705 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 715 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
706 | 716 | ||
707 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); | 717 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); |
708 | QDate date; | 718 | QDate date; |
709 | date = mStartDateSavingEdit->date(); | 719 | date = mStartDateSavingEdit->date(); |
710 | int sub = 0; | 720 | int sub = 0; |
711 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 721 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
712 | sub = 1; | 722 | sub = 1; |
713 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; | 723 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; |
714 | date = mEndDateSavingEdit->date(); | 724 | date = mEndDateSavingEdit->date(); |
715 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 725 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
716 | sub = 1; | 726 | sub = 1; |
717 | else | 727 | else |
718 | sub = 0; | 728 | sub = 0; |
719 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; | 729 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; |
720 | 730 | ||
721 | 731 | ||
722 | prefs->mEmailClient = mEmailClient; | 732 | prefs->mEmailClient = mEmailClient; |
723 | prefs->mEmailOtherChannel = mEmailOtherChannel; | 733 | prefs->mEmailOtherChannel = mEmailOtherChannel; |
724 | prefs->mEmailOtherMessage = mEmailOtherMessage; | 734 | prefs->mEmailOtherMessage = mEmailOtherMessage; |
725 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; | 735 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; |
726 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; | 736 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; |
727 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; | 737 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; |
728 | 738 | ||
729 | prefs->mPhoneClient = mPhoneClient; | 739 | prefs->mPhoneClient = mPhoneClient; |
730 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; | 740 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; |
731 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; | 741 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; |
732 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; | 742 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; |
733 | 743 | ||
734 | prefs->mFaxClient = mFaxClient; | 744 | prefs->mFaxClient = mFaxClient; |
735 | prefs->mFaxOtherChannel = mFaxOtherChannel; | 745 | prefs->mFaxOtherChannel = mFaxOtherChannel; |
736 | prefs->mFaxOtherMessage = mFaxOtherMessage; | 746 | prefs->mFaxOtherMessage = mFaxOtherMessage; |
737 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; | 747 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; |
738 | 748 | ||
739 | prefs->mSMSClient = mSMSClient; | 749 | prefs->mSMSClient = mSMSClient; |
740 | prefs->mSMSOtherChannel = mSMSOtherChannel; | 750 | prefs->mSMSOtherChannel = mSMSOtherChannel; |
741 | prefs->mSMSOtherMessage = mSMSOtherMessage; | 751 | prefs->mSMSOtherMessage = mSMSOtherMessage; |
742 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; | 752 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; |
743 | 753 | ||
744 | prefs->mPagerClient = mPagerClient; | 754 | prefs->mPagerClient = mPagerClient; |
745 | prefs->mPagerOtherChannel = mPagerOtherChannel; | 755 | prefs->mPagerOtherChannel = mPagerOtherChannel; |
746 | prefs->mPagerOtherMessage = mPagerOtherMessage; | 756 | prefs->mPagerOtherMessage = mPagerOtherMessage; |
747 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; | 757 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; |
748 | 758 | ||
749 | 759 | ||
750 | prefs->mSipClient = mSipClient; | 760 | prefs->mSipClient = mSipClient; |
751 | prefs->mSipOtherChannel = mSipOtherChannel; | 761 | prefs->mSipOtherChannel = mSipOtherChannel; |
752 | prefs->mSipOtherMessage = mSipOtherMessage; | 762 | prefs->mSipOtherMessage = mSipOtherMessage; |
753 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; | 763 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; |
754 | 764 | ||
755 | //release the cache that other views can access the changed values instantanious | 765 | //release the cache that other views can access the changed values instantanious |
756 | ExternalAppHandler::instance()->loadConfig(); | 766 | ExternalAppHandler::instance()->loadConfig(); |
757 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 767 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
758 | } | 768 | } |
759 | 769 | ||
760 | 770 | ||
761 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, | 771 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, |
762 | const QStringList *tags) | 772 | const QStringList *tags) |
763 | { | 773 | { |
764 | if (tags) { | 774 | if (tags) { |
765 | int i = tags->findIndex(text); | 775 | int i = tags->findIndex(text); |
766 | if (i > 0) combo->setCurrentItem(i); | 776 | if (i > 0) combo->setCurrentItem(i); |
767 | } else { | 777 | } else { |
768 | for(int i=0;i<combo->count();++i) { | 778 | for(int i=0;i<combo->count();++i) { |
769 | if (combo->text(i) == text) { | 779 | if (combo->text(i) == text) { |
770 | combo->setCurrentItem(i); | 780 | combo->setCurrentItem(i); |
771 | break; | 781 | break; |
772 | } | 782 | } |
773 | } | 783 | } |
774 | } | 784 | } |
775 | } | 785 | } |
776 | 786 | ||
777 | 787 | ||
778 | void KDEPIMConfigWidget::textChanged( const QString& text ) | 788 | void KDEPIMConfigWidget::textChanged( const QString& text ) |
779 | { | 789 | { |
780 | emit changed( true ); | 790 | emit changed( true ); |
781 | } | 791 | } |