summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
Unidiff
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp6
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 1b4652a..9e4db74 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -97,190 +97,196 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
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( "Show edit dialog on 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 contacts" ), 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 mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" );
146 boxLayout->addWidget( mAskForDelete );
147
145 mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" ); 148 mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" );
146 boxLayout->addWidget( mAskForQuit ); 149 boxLayout->addWidget( mAskForQuit );
147 150
148 layout->addWidget( vBox ); 151 layout->addWidget( vBox );
149 152
150 tabWidget->addTab( generalPage, i18n( "General" ) ); 153 tabWidget->addTab( generalPage, i18n( "General" ) );
151 154
152 // Extension page 155 // Extension page
153 QWidget *extensionPage = new QWidget( this ); 156 QWidget *extensionPage = new QWidget( this );
154 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 157 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
155 KDialog::spacingHintSmall() ); 158 KDialog::spacingHintSmall() );
156 159
157 //extensions groupbox 160 //extensions groupbox
158 161
159 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 162 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
160 boxLayout = new QVBoxLayout( groupBox->layout() ); 163 boxLayout = new QVBoxLayout( groupBox->layout() );
161 boxLayout->setAlignment( Qt::AlignTop ); 164 boxLayout->setAlignment( Qt::AlignTop );
162 boxLayout->setMargin(KDialog::marginHintSmall()); 165 boxLayout->setMargin(KDialog::marginHintSmall());
163 boxLayout->setSpacing(KDialog::spacingHintSmall()); 166 boxLayout->setSpacing(KDialog::spacingHintSmall());
164 groupBox->layout()->setMargin(1) ; 167 groupBox->layout()->setMargin(1) ;
165 groupBox->layout()->setSpacing(0); 168 groupBox->layout()->setSpacing(0);
166 mExtensionView = new KListView( groupBox ); 169 mExtensionView = new KListView( groupBox );
167 mExtensionView->setAllColumnsShowFocus( true ); 170 mExtensionView->setAllColumnsShowFocus( true );
168 mExtensionView->addColumn( i18n( "Name" ) ); 171 mExtensionView->addColumn( i18n( "Name" ) );
169 mExtensionView->addColumn( i18n( "Description" ) ); 172 mExtensionView->addColumn( i18n( "Description" ) );
170 //mExtensionView->setMaximumHeight(80); 173 //mExtensionView->setMaximumHeight(80);
171 174
172 boxLayout->addWidget( mExtensionView ); 175 boxLayout->addWidget( mExtensionView );
173 176
174 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 177 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
175 mConfigureButton->setEnabled( false ); 178 mConfigureButton->setEnabled( false );
176 boxLayout->addWidget( mConfigureButton ); 179 boxLayout->addWidget( mConfigureButton );
177 180
178 extensionLayout->addWidget( groupBox ); 181 extensionLayout->addWidget( groupBox );
179 182
180 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 183 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
181 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 184 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
182 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 185 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
183 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 186 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
184 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 187 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
185 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 188 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
186 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 189 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
187 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 190 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
191 connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
188 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 192 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
189 SLOT( selectionChanged( QListViewItem* ) ) ); 193 SLOT( selectionChanged( QListViewItem* ) ) );
190 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 194 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
191 SLOT( itemClicked( QListViewItem* ) ) ); 195 SLOT( itemClicked( QListViewItem* ) ) );
192 connect( mConfigureButton, SIGNAL( clicked() ), 196 connect( mConfigureButton, SIGNAL( clicked() ),
193 SLOT( configureExtension() ) ); 197 SLOT( configureExtension() ) );
194 198
195 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 199 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
196 200
197 // Addressee page 201 // Addressee page
198 mAddresseeWidget = new AddresseeWidget( this ); 202 mAddresseeWidget = new AddresseeWidget( this );
199 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 203 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
200 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 204 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
201 205
202} 206}
203 207
204void KABConfigWidget::usrReadConfig() 208void KABConfigWidget::usrReadConfig()
205{ 209{
206 KABPrefs* prefs = KABPrefs::instance(); 210 KABPrefs* prefs = KABPrefs::instance();
207 211
208 bool blocked = signalsBlocked(); 212 bool blocked = signalsBlocked();
209 blockSignals( true ); 213 blockSignals( true );
210 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); 214 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
211 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 215 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
212 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 216 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
213 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 217 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
214 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); 218 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard );
215 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); 219 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch );
216 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 220 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
217 mAskForQuit->setChecked( prefs->mAskForQuit ); 221 mAskForQuit->setChecked( prefs->mAskForQuit );
222 mAskForDelete->setChecked( prefs->mAskForDelete );
218 223
219 mAddresseeWidget->restoreSettings(); 224 mAddresseeWidget->restoreSettings();
220 225
221 restoreExtensionSettings(); 226 restoreExtensionSettings();
222 227
223 blockSignals( blocked ); 228 blockSignals( blocked );
224 229
225} 230}
226 231
227void KABConfigWidget::usrWriteConfig() 232void KABConfigWidget::usrWriteConfig()
228{ 233{
229 KABPrefs* prefs = KABPrefs::instance(); 234 KABPrefs* prefs = KABPrefs::instance();
230 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); 235 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked();
231 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 236 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
232 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 237 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
233 prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); 238 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
234 prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); 239 prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked();
235 prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); 240 prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked();
236 241
237 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 242 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
238 prefs->mAskForQuit = mAskForQuit->isChecked(); 243 prefs->mAskForQuit = mAskForQuit->isChecked();
244 prefs->mAskForDelete = mAskForDelete->isChecked();
239 245
240 mAddresseeWidget->saveSettings(); 246 mAddresseeWidget->saveSettings();
241 247
242 saveExtensionSettings(); 248 saveExtensionSettings();
243 249
244} 250}
245 251
246void KABConfigWidget::restoreExtensionSettings() 252void KABConfigWidget::restoreExtensionSettings()
247{ 253{
248 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 254 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
249 255
250 mExtensionView->clear(); 256 mExtensionView->clear();
251 257
252#ifndef KAB_EMBEDDED 258#ifndef KAB_EMBEDDED
253 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 259 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
254 KTrader::OfferList::ConstIterator it; 260 KTrader::OfferList::ConstIterator it;
255 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 261 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
256 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 262 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
257 continue; 263 continue;
258 264
259 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 265 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
260 item->setService( *it ); 266 item->setService( *it );
261 if ( activeExtensions.contains( item->factory()->identifier() ) ) 267 if ( activeExtensions.contains( item->factory()->identifier() ) )
262 item->setOn( true ); 268 item->setOn( true );
263 } 269 }
264#else //KAB_EMBEDDED 270#else //KAB_EMBEDDED
265 ExtensionFactory *extensionFactory = new MergeFactory(); 271 ExtensionFactory *extensionFactory = new MergeFactory();
266 272
267 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 273 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
268 274
269 item->setFactory( extensionFactory ); 275 item->setFactory( extensionFactory );
270 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 276 if ( activeExtensions.contains( extensionFactory->identifier() ) )
271 item->setOn( true ); 277 item->setOn( true );
272 278
273 279
274 280
275 extensionFactory = new DistributionListFactory(); 281 extensionFactory = new DistributionListFactory();
276 282
277 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 283 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
278 284
279 item->setFactory( extensionFactory ); 285 item->setFactory( extensionFactory );
280 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 286 if ( activeExtensions.contains( extensionFactory->identifier() ) )
281 item->setOn( true ); 287 item->setOn( true );
282 288
283 289
284#endif //KAB_EMBEDDED 290#endif //KAB_EMBEDDED
285 291
286} 292}
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index a172e97..f2a6b1b 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -24,54 +24,55 @@
24#ifndef KABCONFIGWIDGET_H 24#ifndef KABCONFIGWIDGET_H
25#define KABCONFIGWIDGET_H 25#define KABCONFIGWIDGET_H
26 26
27#include <kprefswidget.h> 27#include <kprefswidget.h>
28 28
29class QCheckBox; 29class QCheckBox;
30class QListViewItem; 30class QListViewItem;
31class QPushButton; 31class QPushButton;
32class QComboBox; 32class QComboBox;
33class QLineEdit; 33class QLineEdit;
34class KListView; 34class KListView;
35class KABPrefs; 35class KABPrefs;
36 36
37class AddresseeWidget; 37class AddresseeWidget;
38 38
39class KABConfigWidget : public KPrefsWidget 39class KABConfigWidget : public KPrefsWidget
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43 public: 43 public:
44 KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); 44 KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 );
45 45
46 protected: 46 protected:
47 /** Implement this to read custom configuration widgets. */ 47 /** Implement this to read custom configuration widgets. */
48 virtual void usrReadConfig(); 48 virtual void usrReadConfig();
49 /** Implement this to write custom configuration widgets. */ 49 /** Implement this to write custom configuration widgets. */
50 virtual void usrWriteConfig(); 50 virtual void usrWriteConfig();
51 51
52 52
53 53
54 private slots: 54 private slots:
55 void configureExtension(); 55 void configureExtension();
56 void selectionChanged( QListViewItem* ); 56 void selectionChanged( QListViewItem* );
57 void itemClicked( QListViewItem* ); 57 void itemClicked( QListViewItem* );
58 58
59 private: 59 private:
60 void restoreExtensionSettings(); 60 void restoreExtensionSettings();
61 void saveExtensionSettings(); 61 void saveExtensionSettings();
62 62
63 KListView *mExtensionView; 63 KListView *mExtensionView;
64 QCheckBox *mSearchReturnBox; 64 QCheckBox *mSearchReturnBox;
65 QCheckBox *mNameParsing; 65 QCheckBox *mNameParsing;
66 QCheckBox *mViewsSingleClickBox; 66 QCheckBox *mViewsSingleClickBox;
67 QCheckBox *mAutoSearchWithWildcardBox; 67 QCheckBox *mAutoSearchWithWildcardBox;
68 QCheckBox *mHideSearchOnSwitchBox; 68 QCheckBox *mHideSearchOnSwitchBox;
69 QCheckBox *mMultipleViewsAtOnce; 69 QCheckBox *mMultipleViewsAtOnce;
70 QCheckBox *mAskForQuit; 70 QCheckBox *mAskForQuit;
71 QCheckBox *mMenuBarBox; 71 QCheckBox *mMenuBarBox;
72 QCheckBox *mAskForDelete;
72 QPushButton *mConfigureButton; 73 QPushButton *mConfigureButton;
73 74
74 AddresseeWidget *mAddresseeWidget; 75 AddresseeWidget *mAddresseeWidget;
75}; 76};
76 77
77#endif 78#endif