-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 167 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 48 |
2 files changed, 164 insertions, 51 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 38c7946..1bac26f 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -1,24 +1,24 @@ | |||
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> |
@@ -28,4 +28,8 @@ | |||
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | ||
31 | #include <qlineedit.h> | ||
32 | #include <qlabel.h> | ||
33 | #include <qfile.h> | ||
30 | 34 | ||
31 | #include <kconfig.h> | 35 | #include <kconfig.h> |
@@ -76,7 +80,7 @@ class ExtensionItem : public QCheckListItem | |||
76 | QString mName; | 80 | QString mName; |
77 | QString mComment; | 81 | QString mComment; |
78 | 82 | ||
79 | #endif //KAB_EMBEDDED | 83 | #endif //KAB_EMBEDDED |
80 | 84 | ||
81 | }; | 85 | }; |
82 | 86 | ||
@@ -94,5 +98,5 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
94 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 98 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
95 | KDialog::spacingHintSmall() ); | 99 | KDialog::spacingHintSmall() ); |
96 | 100 | //general groupbox | |
97 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); | 101 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); |
98 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); | 102 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); |
@@ -110,4 +114,7 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
110 | layout->addWidget( groupBox ); | 114 | layout->addWidget( groupBox ); |
111 | 115 | ||
116 | |||
117 | //extensions groupbox | ||
118 | |||
112 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); | 119 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); |
113 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 120 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
@@ -122,5 +129,5 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
122 | mExtensionView->addColumn( i18n( "Description" ) ); | 129 | mExtensionView->addColumn( i18n( "Description" ) ); |
123 | mExtensionView->setMaximumHeight(80); | 130 | mExtensionView->setMaximumHeight(80); |
124 | 131 | ||
125 | boxLayout->addWidget( mExtensionView ); | 132 | boxLayout->addWidget( mExtensionView ); |
126 | 133 | ||
@@ -146,6 +153,94 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
146 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 153 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
147 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 154 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
155 | |||
156 | // mailclient page | ||
157 | QWidget *mailclientPage = new QWidget( this ); | ||
158 | layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(), | ||
159 | KDialog::spacingHintSmall() ); | ||
160 | |||
161 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage ); | ||
162 | boxLayout = new QVBoxLayout( groupBox->layout() ); | ||
163 | boxLayout->setAlignment( Qt::AlignTop ); | ||
164 | // boxLayout->setMargin(KDialog::marginHintSmall() ); | ||
165 | // groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; | ||
166 | // groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); | ||
167 | // boxLayout->setSpacing( KDialog::spacingHintSmall() ); | ||
168 | |||
169 | mEmailClient = new QComboBox( groupBox ); | ||
170 | mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI ); | ||
171 | mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA ); | ||
172 | mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE ); | ||
173 | mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER ); | ||
174 | boxLayout->addWidget( mEmailClient ); | ||
175 | |||
176 | connect( mEmailClient, SIGNAL( activated( int ) ), | ||
177 | this, SLOT (emailclient_changed( int ) ) ); | ||
178 | |||
179 | QLabel* lab = new QLabel( i18n("Channel:"), groupBox); | ||
180 | boxLayout->addWidget( lab ); | ||
181 | mEmailChannel = new QLineEdit(groupBox); | ||
182 | mEmailChannel->setReadOnly(true); | ||
183 | boxLayout->addWidget( mEmailChannel ); | ||
184 | |||
185 | layout->addWidget( groupBox ); | ||
186 | tabWidget->addTab( mailclientPage, i18n( "Mail" ) ); | ||
187 | |||
188 | |||
189 | |||
148 | } | 190 | } |
149 | 191 | ||
192 | |||
193 | |||
194 | void KABConfigWidget::emailclient_changed( int newClient ) | ||
195 | { | ||
196 | if (newClient == KABPrefs::OTHER) | ||
197 | mEmailChannel->setReadOnly(false); | ||
198 | else | ||
199 | mEmailChannel->setReadOnly(true); | ||
200 | |||
201 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | ||
202 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | ||
203 | |||
204 | if (opiepath.isEmpty()) | ||
205 | opiepath = qtopiapath; | ||
206 | |||
207 | QString text = mEmailChannel->text(); | ||
208 | |||
209 | if (newClient == KABPrefs::OPIE) | ||
210 | { | ||
211 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | ||
212 | text = "QPE/Application/opiemail"; | ||
213 | else | ||
214 | text = "FILENOTFOUND: " + opiepath + "/bin/opiemail"; | ||
215 | } | ||
216 | else if (newClient == KABPrefs::QTOPIA) | ||
217 | { | ||
218 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) | ||
219 | text = "QPE/Application/qtmail"; | ||
220 | else | ||
221 | text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail"; | ||
222 | |||
223 | } | ||
224 | else if (newClient == KABPrefs::OMPI) | ||
225 | { | ||
226 | if ( QFile::exists( qtopiapath + "/bin/ompi" )) | ||
227 | text = "QPE/Application/ompi"; | ||
228 | else if ( QFile::exists( opiepath + "/bin/ompi" )) | ||
229 | text = "QPE/Application/ompi"; | ||
230 | else | ||
231 | text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi"; | ||
232 | |||
233 | } | ||
234 | else | ||
235 | { | ||
236 | //do nothing if we choosed other | ||
237 | } | ||
238 | |||
239 | mEmailChannel->setText( text ); | ||
240 | |||
241 | |||
242 | } | ||
243 | |||
244 | |||
150 | void KABConfigWidget::restoreSettings() | 245 | void KABConfigWidget::restoreSettings() |
151 | { | 246 | { |
@@ -155,4 +250,8 @@ void KABConfigWidget::restoreSettings() | |||
155 | mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); | 250 | mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); |
156 | mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); | 251 | mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); |
252 | |||
253 | mEmailChannel->setText( KABPrefs::instance()->mEmailChannel ); | ||
254 | mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient); | ||
255 | |||
157 | mAddresseeWidget->restoreSettings(); | 256 | mAddresseeWidget->restoreSettings(); |
158 | 257 | ||
@@ -168,4 +267,8 @@ void KABConfigWidget::saveSettings() | |||
168 | KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); | 267 | KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); |
169 | KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 268 | KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
269 | |||
270 | KABPrefs::instance()->mEmailClient = mEmailClient->currentItem(); | ||
271 | KABPrefs::instance()->mEmailChannel = mEmailChannel->text(); | ||
272 | |||
170 | mAddresseeWidget->saveSettings(); | 273 | mAddresseeWidget->saveSettings(); |
171 | 274 | ||
@@ -181,4 +284,8 @@ void KABConfigWidget::defaults() | |||
181 | mViewsSingleClickBox->setChecked( false ); | 284 | mViewsSingleClickBox->setChecked( false ); |
182 | 285 | ||
286 | mEmailClient->setCurrentItem(KABPrefs::OMPI); | ||
287 | emailclient_changed( KABPrefs::OMPI ); | ||
288 | |||
289 | |||
183 | emit changed( true ); | 290 | emit changed( true ); |
184 | } | 291 | } |
@@ -211,22 +318,22 @@ void KABConfigWidget::restoreExtensionSettings() | |||
211 | 318 | ||
212 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); | 319 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); |
213 | 320 | ||
214 | item->setFactory( extensionFactory ); | 321 | item->setFactory( extensionFactory ); |
215 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 322 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
216 | item->setOn( true ); | 323 | item->setOn( true ); |
217 | |||
218 | 324 | ||
219 | 325 | ||
326 | |||
220 | extensionFactory = new DistributionListFactory(); | 327 | extensionFactory = new DistributionListFactory(); |
221 | 328 | ||
222 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); | 329 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); |
223 | 330 | ||
224 | item->setFactory( extensionFactory ); | 331 | item->setFactory( extensionFactory ); |
225 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 332 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
226 | item->setOn( true ); | 333 | item->setOn( true ); |
227 | 334 | ||
228 | 335 | ||
229 | #endif //KAB_EMBEDDED | 336 | #endif //KAB_EMBEDDED |
230 | 337 | ||
231 | } | 338 | } |
232 | 339 | ||
@@ -318,5 +425,5 @@ bool ExtensionItem::configWidgetAvailable() const | |||
318 | if ( !extensionFactory ) | 425 | if ( !extensionFactory ) |
319 | return false; | 426 | return false; |
320 | 427 | ||
321 | return extensionFactory->configureWidgetAvailable(); | 428 | return extensionFactory->configureWidgetAvailable(); |
322 | #else //KAB_EMBEDDED | 429 | #else //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 0f36d9e..9d1363b 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h | |||
@@ -1,24 +1,24 @@ | |||
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 | #ifndef KABCONFIGWIDGET_H | 24 | #ifndef KABCONFIGWIDGET_H |
@@ -30,5 +30,6 @@ class QCheckBox; | |||
30 | class QListViewItem; | 30 | class QListViewItem; |
31 | class QPushButton; | 31 | class QPushButton; |
32 | 32 | class QComboBox; | |
33 | class QLineEdit; | ||
33 | class KListView; | 34 | class KListView; |
34 | 35 | ||
@@ -38,8 +39,8 @@ class KABConfigWidget : public QWidget | |||
38 | { | 39 | { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | 41 | ||
41 | public: | 42 | public: |
42 | KABConfigWidget( QWidget *parent, const char *name = 0 ); | 43 | KABConfigWidget( QWidget *parent, const char *name = 0 ); |
43 | 44 | ||
44 | void restoreSettings(); | 45 | void restoreSettings(); |
45 | void saveSettings(); | 46 | void saveSettings(); |
@@ -52,8 +53,11 @@ class KABConfigWidget : public QWidget | |||
52 | void modified(); | 53 | void modified(); |
53 | 54 | ||
55 | |||
56 | |||
54 | private slots: | 57 | private slots: |
55 | void configureExtension(); | 58 | void configureExtension(); |
56 | void selectionChanged( QListViewItem* ); | 59 | void selectionChanged( QListViewItem* ); |
57 | void itemClicked( QListViewItem* ); | 60 | void itemClicked( QListViewItem* ); |
61 | void emailclient_changed( int newClient ); | ||
58 | 62 | ||
59 | private: | 63 | private: |
@@ -66,4 +70,6 @@ class KABConfigWidget : public QWidget | |||
66 | QCheckBox *mViewsSingleClickBox; | 70 | QCheckBox *mViewsSingleClickBox; |
67 | QPushButton *mConfigureButton; | 71 | QPushButton *mConfigureButton; |
72 | QComboBox* mEmailClient; | ||
73 | QLineEdit* mEmailChannel; | ||
68 | 74 | ||
69 | AddresseeWidget *mAddresseeWidget; | 75 | AddresseeWidget *mAddresseeWidget; |