-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 8a4dd3d..1b4652a 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -1,418 +1,418 @@ | |||
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 | #include <kglobalsettings.h> | 58 | #include <kglobalsettings.h> |
59 | 59 | ||
60 | class ExtensionItem : public QCheckListItem | 60 | class ExtensionItem : public QCheckListItem |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | 63 | ||
64 | #ifndef KAB_EMBEDDED | 64 | #ifndef KAB_EMBEDDED |
65 | ExtensionItem( QListView *parent, const QString &text ); | 65 | ExtensionItem( QListView *parent, const QString &text ); |
66 | void setService( const KService::Ptr &ptr ); | 66 | void setService( const KService::Ptr &ptr ); |
67 | #else //KAB_EMBEDDED | 67 | #else //KAB_EMBEDDED |
68 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); | 68 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); |
69 | void setFactory( ExtensionFactory* fac ); | 69 | void setFactory( ExtensionFactory* fac ); |
70 | #endif //KAB_EMBEDDED | 70 | #endif //KAB_EMBEDDED |
71 | 71 | ||
72 | bool configWidgetAvailable() const; | 72 | bool configWidgetAvailable() const; |
73 | ExtensionFactory *factory() const; | 73 | ExtensionFactory *factory() const; |
74 | 74 | ||
75 | virtual QString text( int column ) const; | 75 | virtual QString text( int column ) const; |
76 | 76 | ||
77 | private: | 77 | private: |
78 | #ifndef KAB_EMBEDDED | 78 | #ifndef KAB_EMBEDDED |
79 | KService::Ptr mPtr; | 79 | KService::Ptr mPtr; |
80 | #else //KAB_EMBEDDED | 80 | #else //KAB_EMBEDDED |
81 | ExtensionFactory* mFactory; | 81 | ExtensionFactory* mFactory; |
82 | QString mName; | 82 | QString mName; |
83 | QString mComment; | 83 | QString mComment; |
84 | 84 | ||
85 | #endif //KAB_EMBEDDED | 85 | #endif //KAB_EMBEDDED |
86 | 86 | ||
87 | }; | 87 | }; |
88 | 88 | ||
89 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) | 89 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) |
90 | : KPrefsWidget( prefs, parent, name ) | 90 | : KPrefsWidget( prefs, parent, name ) |
91 | { | 91 | { |
92 | 92 | ||
93 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 93 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
94 | KDialog::spacingHintSmall() ); | 94 | KDialog::spacingHintSmall() ); |
95 | 95 | ||
96 | QTabWidget *tabWidget = new QTabWidget( this ); | 96 | QTabWidget *tabWidget = new QTabWidget( this ); |
97 | topLayout->addWidget( tabWidget ); | 97 | topLayout->addWidget( tabWidget ); |
98 | 98 | ||
99 | // General page | 99 | // General page |
100 | QWidget *generalPage = new QWidget( this ); | 100 | QWidget *generalPage = new QWidget( this ); |
101 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 101 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
102 | KDialog::spacingHintSmall() ); | 102 | KDialog::spacingHintSmall() ); |
103 | 103 | ||
104 | 104 | ||
105 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); | 105 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); |
106 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); | 106 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); |
107 | KPrefsWidFont *detailsFont = | 107 | KPrefsWidFont *detailsFont = |
108 | addWidFont(i18n("phone:123"),i18n("Details view font"), | 108 | addWidFont(i18n("phone:123"),i18n("Details view font"), |
109 | &(KABPrefs::instance()->mDetailsFont),hBox); | 109 | &(KABPrefs::instance()->mDetailsFont),hBox); |
110 | hboxLayout->addWidget(detailsFont->label()); | 110 | hboxLayout->addWidget(detailsFont->label()); |
111 | hboxLayout->addWidget(detailsFont->preview()); | 111 | hboxLayout->addWidget(detailsFont->preview()); |
112 | hboxLayout->addWidget(detailsFont->button()); | 112 | hboxLayout->addWidget(detailsFont->button()); |
113 | hboxLayout->setMargin(KDialog::marginHintSmall() ); | 113 | hboxLayout->setMargin(KDialog::marginHintSmall() ); |
114 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); | 114 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); |
115 | //hBox->setBackgroundColor( black); | 115 | //hBox->setBackgroundColor( black); |
116 | layout->addWidget( hBox ); | 116 | layout->addWidget( hBox ); |
117 | 117 | ||
118 | //general groupbox | 118 | //general groupbox |
119 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); | 119 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); |
120 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); | 120 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); |
121 | boxLayout->setAlignment( Qt::AlignTop ); | 121 | boxLayout->setAlignment( Qt::AlignTop ); |
122 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 122 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
123 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 123 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
124 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); | 124 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); |
125 | boxLayout->addWidget( mMenuBarBox ); | 125 | boxLayout->addWidget( mMenuBarBox ); |
126 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 126 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
127 | boxLayout->addWidget( mSearchReturnBox ); | 127 | boxLayout->addWidget( mSearchReturnBox ); |
128 | mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); | 128 | mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); |
129 | boxLayout->addWidget( mAutoSearchWithWildcardBox); | 129 | boxLayout->addWidget( mAutoSearchWithWildcardBox); |
130 | mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); | 130 | mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); |
131 | boxLayout->addWidget( mHideSearchOnSwitchBox ); | 131 | boxLayout->addWidget( mHideSearchOnSwitchBox ); |
132 | 132 | ||
133 | #ifdef DESKTOP_VERSION | 133 | #ifdef DESKTOP_VERSION |
134 | mHideSearchOnSwitchBox->hide(); | 134 | mHideSearchOnSwitchBox->hide(); |
135 | #endif | 135 | #endif |
136 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); | 136 | mViewsSingleClickBox = new QCheckBox( i18n( "Show edit dialog on single click" ), vBox, "msingle" ); |
137 | boxLayout->addWidget( mViewsSingleClickBox ); | 137 | boxLayout->addWidget( mViewsSingleClickBox ); |
138 | 138 | ||
139 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); | 139 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new contacts" ), vBox, "mparse" ); |
140 | boxLayout->addWidget( mNameParsing ); | 140 | boxLayout->addWidget( mNameParsing ); |
141 | 141 | ||
142 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); | 142 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); |
143 | boxLayout->addWidget( mMultipleViewsAtOnce ); | 143 | boxLayout->addWidget( mMultipleViewsAtOnce ); |
144 | 144 | ||
145 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); | 145 | mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" ); |
146 | boxLayout->addWidget( mAskForQuit ); | 146 | boxLayout->addWidget( mAskForQuit ); |
147 | 147 | ||
148 | layout->addWidget( vBox ); | 148 | layout->addWidget( vBox ); |
149 | 149 | ||
150 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 150 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
151 | 151 | ||
152 | // Extension page | 152 | // Extension page |
153 | QWidget *extensionPage = new QWidget( this ); | 153 | QWidget *extensionPage = new QWidget( this ); |
154 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), | 154 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), |
155 | KDialog::spacingHintSmall() ); | 155 | KDialog::spacingHintSmall() ); |
156 | 156 | ||
157 | //extensions groupbox | 157 | //extensions groupbox |
158 | 158 | ||
159 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); | 159 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); |
160 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 160 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
161 | boxLayout->setAlignment( Qt::AlignTop ); | 161 | boxLayout->setAlignment( Qt::AlignTop ); |
162 | boxLayout->setMargin(KDialog::marginHintSmall()); | 162 | boxLayout->setMargin(KDialog::marginHintSmall()); |
163 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | 163 | boxLayout->setSpacing(KDialog::spacingHintSmall()); |
164 | groupBox->layout()->setMargin(1) ; | 164 | groupBox->layout()->setMargin(1) ; |
165 | groupBox->layout()->setSpacing(0); | 165 | groupBox->layout()->setSpacing(0); |
166 | mExtensionView = new KListView( groupBox ); | 166 | mExtensionView = new KListView( groupBox ); |
167 | mExtensionView->setAllColumnsShowFocus( true ); | 167 | mExtensionView->setAllColumnsShowFocus( true ); |
168 | mExtensionView->addColumn( i18n( "Name" ) ); | 168 | mExtensionView->addColumn( i18n( "Name" ) ); |
169 | mExtensionView->addColumn( i18n( "Description" ) ); | 169 | mExtensionView->addColumn( i18n( "Description" ) ); |
170 | //mExtensionView->setMaximumHeight(80); | 170 | //mExtensionView->setMaximumHeight(80); |
171 | 171 | ||
172 | boxLayout->addWidget( mExtensionView ); | 172 | boxLayout->addWidget( mExtensionView ); |
173 | 173 | ||
174 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | 174 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); |
175 | mConfigureButton->setEnabled( false ); | 175 | mConfigureButton->setEnabled( false ); |
176 | boxLayout->addWidget( mConfigureButton ); | 176 | boxLayout->addWidget( mConfigureButton ); |
177 | 177 | ||
178 | extensionLayout->addWidget( groupBox ); | 178 | extensionLayout->addWidget( groupBox ); |
179 | 179 | ||
180 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 180 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
181 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 181 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
182 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 182 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
183 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 183 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
184 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 184 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
185 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 185 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
186 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 186 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
187 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 187 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
188 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 188 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
189 | SLOT( selectionChanged( QListViewItem* ) ) ); | 189 | SLOT( selectionChanged( QListViewItem* ) ) ); |
190 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 190 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
191 | SLOT( itemClicked( QListViewItem* ) ) ); | 191 | SLOT( itemClicked( QListViewItem* ) ) ); |
192 | connect( mConfigureButton, SIGNAL( clicked() ), | 192 | connect( mConfigureButton, SIGNAL( clicked() ), |
193 | SLOT( configureExtension() ) ); | 193 | SLOT( configureExtension() ) ); |
194 | 194 | ||
195 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); | 195 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); |
196 | 196 | ||
197 | // Addressee page | 197 | // Addressee page |
198 | mAddresseeWidget = new AddresseeWidget( this ); | 198 | mAddresseeWidget = new AddresseeWidget( this ); |
199 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 199 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
200 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 200 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
201 | 201 | ||
202 | } | 202 | } |
203 | 203 | ||
204 | void KABConfigWidget::usrReadConfig() | 204 | void KABConfigWidget::usrReadConfig() |
205 | { | 205 | { |
206 | KABPrefs* prefs = KABPrefs::instance(); | 206 | KABPrefs* prefs = KABPrefs::instance(); |
207 | 207 | ||
208 | bool blocked = signalsBlocked(); | 208 | bool blocked = signalsBlocked(); |
209 | blockSignals( true ); | 209 | blockSignals( true ); |
210 | mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); | 210 | mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); |
211 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); | 211 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); |
212 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); | 212 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); |
213 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); | 213 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); |
214 | mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); | 214 | mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); |
215 | mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); | 215 | mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); |
216 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); | 216 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); |
217 | mAskForQuit->setChecked( prefs->mAskForQuit ); | 217 | mAskForQuit->setChecked( prefs->mAskForQuit ); |
218 | 218 | ||
219 | mAddresseeWidget->restoreSettings(); | 219 | mAddresseeWidget->restoreSettings(); |
220 | 220 | ||
221 | restoreExtensionSettings(); | 221 | restoreExtensionSettings(); |
222 | 222 | ||
223 | blockSignals( blocked ); | 223 | blockSignals( blocked ); |
224 | 224 | ||
225 | } | 225 | } |
226 | 226 | ||
227 | void KABConfigWidget::usrWriteConfig() | 227 | void KABConfigWidget::usrWriteConfig() |
228 | { | 228 | { |
229 | KABPrefs* prefs = KABPrefs::instance(); | 229 | KABPrefs* prefs = KABPrefs::instance(); |
230 | prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); | 230 | prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); |
231 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); | 231 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); |
232 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 232 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
233 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); | 233 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); |
234 | prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); | 234 | prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); |
235 | prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); | 235 | prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); |
236 | 236 | ||
237 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); | 237 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); |
238 | prefs->mAskForQuit = mAskForQuit->isChecked(); | 238 | prefs->mAskForQuit = mAskForQuit->isChecked(); |
239 | 239 | ||
240 | mAddresseeWidget->saveSettings(); | 240 | mAddresseeWidget->saveSettings(); |
241 | 241 | ||
242 | saveExtensionSettings(); | 242 | saveExtensionSettings(); |
243 | 243 | ||
244 | } | 244 | } |
245 | 245 | ||
246 | void KABConfigWidget::restoreExtensionSettings() | 246 | void KABConfigWidget::restoreExtensionSettings() |
247 | { | 247 | { |
248 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 248 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
249 | 249 | ||
250 | mExtensionView->clear(); | 250 | mExtensionView->clear(); |
251 | 251 | ||
252 | #ifndef KAB_EMBEDDED | 252 | #ifndef KAB_EMBEDDED |
253 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 253 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
254 | KTrader::OfferList::ConstIterator it; | 254 | KTrader::OfferList::ConstIterator it; |
255 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 255 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
256 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 256 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
257 | continue; | 257 | continue; |
258 | 258 | ||
259 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); | 259 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); |
260 | item->setService( *it ); | 260 | item->setService( *it ); |
261 | if ( activeExtensions.contains( item->factory()->identifier() ) ) | 261 | if ( activeExtensions.contains( item->factory()->identifier() ) ) |
262 | item->setOn( true ); | 262 | item->setOn( true ); |
263 | } | 263 | } |
264 | #else //KAB_EMBEDDED | 264 | #else //KAB_EMBEDDED |
265 | ExtensionFactory *extensionFactory = new MergeFactory(); | 265 | ExtensionFactory *extensionFactory = new MergeFactory(); |
266 | 266 | ||
267 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); | 267 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); |
268 | 268 | ||
269 | item->setFactory( extensionFactory ); | 269 | item->setFactory( extensionFactory ); |
270 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 270 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
271 | item->setOn( true ); | 271 | item->setOn( true ); |
272 | 272 | ||
273 | 273 | ||
274 | 274 | ||
275 | extensionFactory = new DistributionListFactory(); | 275 | extensionFactory = new DistributionListFactory(); |
276 | 276 | ||
277 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); | 277 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); |
278 | 278 | ||
279 | item->setFactory( extensionFactory ); | 279 | item->setFactory( extensionFactory ); |
280 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 280 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
281 | item->setOn( true ); | 281 | item->setOn( true ); |
282 | 282 | ||
283 | 283 | ||
284 | #endif //KAB_EMBEDDED | 284 | #endif //KAB_EMBEDDED |
285 | 285 | ||
286 | } | 286 | } |
287 | 287 | ||
288 | void KABConfigWidget::saveExtensionSettings() | 288 | void KABConfigWidget::saveExtensionSettings() |
289 | { | 289 | { |
290 | QStringList activeExtensions; | 290 | QStringList activeExtensions; |
291 | 291 | ||
292 | QPtrList<QListViewItem> list; | 292 | QPtrList<QListViewItem> list; |
293 | QListViewItemIterator it( mExtensionView ); | 293 | QListViewItemIterator it( mExtensionView ); |
294 | while ( it.current() ) { | 294 | while ( it.current() ) { |
295 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); | 295 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); |
296 | if ( item ) { | 296 | if ( item ) { |
297 | if ( item->isOn() ) | 297 | if ( item->isOn() ) |
298 | activeExtensions.append( item->factory()->identifier() ); | 298 | activeExtensions.append( item->factory()->identifier() ); |
299 | } | 299 | } |
300 | ++it; | 300 | ++it; |
301 | } | 301 | } |
302 | 302 | ||
303 | KABPrefs::instance()->mActiveExtensions = activeExtensions; | 303 | KABPrefs::instance()->mActiveExtensions = activeExtensions; |
304 | } | 304 | } |
305 | 305 | ||
306 | void KABConfigWidget::configureExtension() | 306 | void KABConfigWidget::configureExtension() |
307 | { | 307 | { |
308 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); | 308 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); |
309 | if ( !item ) | 309 | if ( !item ) |
310 | return; | 310 | return; |
311 | 311 | ||
312 | #ifndef KAB_EMBEDDED | 312 | #ifndef KAB_EMBEDDED |
313 | KConfig config( "kaddressbookrc" ); | 313 | KConfig config( "kaddressbookrc" ); |
314 | #else //KAB_EMBEDDED | 314 | #else //KAB_EMBEDDED |
315 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 315 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
316 | #endif //KAB_EMBEDDED | 316 | #endif //KAB_EMBEDDED |
317 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); | 317 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); |
318 | 318 | ||
319 | ExtensionConfigDialog dlg( item->factory(), &config, this ); | 319 | ExtensionConfigDialog dlg( item->factory(), &config, this ); |
320 | dlg.exec(); | 320 | dlg.exec(); |
321 | 321 | ||
322 | config.sync(); | 322 | config.sync(); |
323 | } | 323 | } |
324 | 324 | ||
325 | void KABConfigWidget::selectionChanged( QListViewItem *i ) | 325 | void KABConfigWidget::selectionChanged( QListViewItem *i ) |
326 | { | 326 | { |
327 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); | 327 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); |
328 | if ( !item ) | 328 | if ( !item ) |
329 | return; | 329 | return; |
330 | 330 | ||
331 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); | 331 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); |
332 | } | 332 | } |
333 | 333 | ||
334 | void KABConfigWidget::itemClicked( QListViewItem *item ) | 334 | void KABConfigWidget::itemClicked( QListViewItem *item ) |
335 | { | 335 | { |
336 | if ( item != 0 ) | 336 | if ( item != 0 ) |
337 | modified(); | 337 | modified(); |
338 | } | 338 | } |
339 | 339 | ||
340 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
341 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) | 341 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) |
342 | : QCheckListItem( parent, text, CheckBox ) | 342 | : QCheckListItem( parent, text, CheckBox ) |
343 | { | 343 | { |
344 | } | 344 | } |
345 | 345 | ||
346 | void ExtensionItem::setService( const KService::Ptr &ptr ) | 346 | void ExtensionItem::setService( const KService::Ptr &ptr ) |
347 | { | 347 | { |
348 | mPtr = ptr; | 348 | mPtr = ptr; |
349 | } | 349 | } |
350 | #else //KAB_EMBEDDED | 350 | #else //KAB_EMBEDDED |
351 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) | 351 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) |
352 | : QCheckListItem( parent, text, CheckBox ) | 352 | : QCheckListItem( parent, text, CheckBox ) |
353 | { | 353 | { |
354 | mName = name; | 354 | mName = name; |
355 | mComment = comment; | 355 | mComment = comment; |
356 | } | 356 | } |
357 | 357 | ||
358 | 358 | ||
359 | void ExtensionItem::setFactory( ExtensionFactory* fac ) | 359 | void ExtensionItem::setFactory( ExtensionFactory* fac ) |
360 | { | 360 | { |
361 | mFactory = fac; | 361 | mFactory = fac; |
362 | } | 362 | } |
363 | #endif //KAB_EMBEDDED | 363 | #endif //KAB_EMBEDDED |
364 | 364 | ||
365 | bool ExtensionItem::configWidgetAvailable() const | 365 | bool ExtensionItem::configWidgetAvailable() const |
366 | { | 366 | { |
367 | #ifndef KAB_EMBEDDED | 367 | #ifndef KAB_EMBEDDED |
368 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 368 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
369 | if ( !factory ) | 369 | if ( !factory ) |
370 | return false; | 370 | return false; |
371 | 371 | ||
372 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); | 372 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); |
373 | if ( !extensionFactory ) | 373 | if ( !extensionFactory ) |
374 | return false; | 374 | return false; |
375 | 375 | ||
376 | return extensionFactory->configureWidgetAvailable(); | 376 | return extensionFactory->configureWidgetAvailable(); |
377 | #else //KAB_EMBEDDED | 377 | #else //KAB_EMBEDDED |
378 | return mFactory->configureWidgetAvailable(); | 378 | return mFactory->configureWidgetAvailable(); |
379 | #endif //KAB_EMBEDDED | 379 | #endif //KAB_EMBEDDED |
380 | 380 | ||
381 | } | 381 | } |
382 | 382 | ||
383 | ExtensionFactory *ExtensionItem::factory() const | 383 | ExtensionFactory *ExtensionItem::factory() const |
384 | { | 384 | { |
385 | #ifndef KAB_EMBEDDED | 385 | #ifndef KAB_EMBEDDED |
386 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 386 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
387 | if ( !factory ) | 387 | if ( !factory ) |
388 | return 0; | 388 | return 0; |
389 | 389 | ||
390 | return static_cast<ExtensionFactory*>( factory ); | 390 | return static_cast<ExtensionFactory*>( factory ); |
391 | #else //KAB_EMBEDDED | 391 | #else //KAB_EMBEDDED |
392 | return mFactory; | 392 | return mFactory; |
393 | #endif //KAB_EMBEDDED | 393 | #endif //KAB_EMBEDDED |
394 | } | 394 | } |
395 | 395 | ||
396 | QString ExtensionItem::text( int column ) const | 396 | QString ExtensionItem::text( int column ) const |
397 | { | 397 | { |
398 | #ifndef KAB_EMBEDDED | 398 | #ifndef KAB_EMBEDDED |
399 | if ( column == 0 ) | 399 | if ( column == 0 ) |
400 | return mPtr->name(); | 400 | return mPtr->name(); |
401 | else if ( column == 1 ) | 401 | else if ( column == 1 ) |
402 | return mPtr->comment(); | 402 | return mPtr->comment(); |
403 | else | 403 | else |
404 | return QString::null; | 404 | return QString::null; |
405 | #else //KAB_EMBEDDED | 405 | #else //KAB_EMBEDDED |
406 | if ( column == 0 ) | 406 | if ( column == 0 ) |
407 | return mName; | 407 | return mName; |
408 | else if ( column == 1 ) | 408 | else if ( column == 1 ) |
409 | return mComment; | 409 | return mComment; |
410 | else | 410 | else |
411 | return QString::null; | 411 | return QString::null; |
412 | #endif //KAB_EMBEDDED | 412 | #endif //KAB_EMBEDDED |
413 | } | 413 | } |
414 | 414 | ||
415 | #ifndef KAB_EMBEDDED | 415 | #ifndef KAB_EMBEDDED |
416 | #include "kabconfigwidget.moc" | 416 | #include "kabconfigwidget.moc" |
417 | #endif //KAB_EMBEDDED | 417 | #endif //KAB_EMBEDDED |
418 | 418 | ||