summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
authorzautrix <zautrix>2004-10-27 21:34:55 (UTC)
committer zautrix <zautrix>2004-10-27 21:34:55 (UTC)
commit9c88346fc757fd1dc54b3fca151a2a610159d8cf (patch) (unidiff)
tree4a5de97ba71ce66eea914d55923d88aff3515c93 /kaddressbook/kcmconfigs
parent7f3cc07fab5f5f6ddd402c458341f1df3a144e2c (diff)
downloadkdepimpi-9c88346fc757fd1dc54b3fca151a2a610159d8cf.zip
kdepimpi-9c88346fc757fd1dc54b3fca151a2a610159d8cf.tar.gz
kdepimpi-9c88346fc757fd1dc54b3fca151a2a610159d8cf.tar.bz2
several fixes
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp7
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 936d052..8bf9bb0 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -74,188 +74,191 @@ class ExtensionItem : public QCheckListItem
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
88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) 88KABConfigWidget::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
103 QWidget *hBox = new QWidget( generalPage, "qhbox" ); 103 QWidget *hBox = new QWidget( generalPage, "qhbox" );
104 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); 104 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox);
105 KPrefsWidFont *detailsFont = 105 KPrefsWidFont *detailsFont =
106 addWidFont(i18n("phone:123"),i18n("Details view font"), 106 addWidFont(i18n("phone:123"),i18n("Details view font"),
107 &(KABPrefs::instance()->mDetailsFont),hBox); 107 &(KABPrefs::instance()->mDetailsFont),hBox);
108 hboxLayout->addWidget(detailsFont->label()); 108 hboxLayout->addWidget(detailsFont->label());
109 hboxLayout->addWidget(detailsFont->preview()); 109 hboxLayout->addWidget(detailsFont->preview());
110 hboxLayout->addWidget(detailsFont->button()); 110 hboxLayout->addWidget(detailsFont->button());
111 hboxLayout->setMargin(KDialog::marginHintSmall() ); 111 hboxLayout->setMargin(KDialog::marginHintSmall() );
112 hboxLayout->setSpacing(KDialog::spacingHintSmall()); 112 hboxLayout->setSpacing(KDialog::spacingHintSmall());
113 //hBox->setBackgroundColor( black); 113 //hBox->setBackgroundColor( black);
114 layout->addWidget( hBox ); 114 layout->addWidget( hBox );
115 115
116 //general groupbox 116 //general groupbox
117 QWidget *vBox = new QWidget( generalPage, "qvbox" ); 117 QWidget *vBox = new QWidget( generalPage, "qvbox" );
118 QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); 118 QVBoxLayout *boxLayout = new QVBoxLayout( vBox );
119 boxLayout->setAlignment( Qt::AlignTop ); 119 boxLayout->setAlignment( Qt::AlignTop );
120 boxLayout->setMargin(KDialog::marginHintSmall() ); 120 boxLayout->setMargin(KDialog::marginHintSmall() );
121 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 121 boxLayout->setSpacing( KDialog::spacingHintSmall() );
122 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" );
123 boxLayout->addWidget( mMenuBarBox );
122 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 124 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
123 boxLayout->addWidget( mSearchReturnBox ); 125 boxLayout->addWidget( mSearchReturnBox );
124 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); 126 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
125 boxLayout->addWidget( mViewsSingleClickBox ); 127 boxLayout->addWidget( mViewsSingleClickBox );
126 128
127 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); 129 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
128 boxLayout->addWidget( mNameParsing ); 130 boxLayout->addWidget( mNameParsing );
129 131
130 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 132 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
131 boxLayout->addWidget( mMultipleViewsAtOnce ); 133 boxLayout->addWidget( mMultipleViewsAtOnce );
132 134
133 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); 135 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
134 boxLayout->addWidget( mAskForQuit ); 136 boxLayout->addWidget( mAskForQuit );
135 137
136 layout->addWidget( vBox ); 138 layout->addWidget( vBox );
137 139
138 tabWidget->addTab( generalPage, i18n( "General" ) ); 140 tabWidget->addTab( generalPage, i18n( "General" ) );
139 141
140 // Extension page 142 // Extension page
141 QWidget *extensionPage = new QWidget( this ); 143 QWidget *extensionPage = new QWidget( this );
142 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 144 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
143 KDialog::spacingHintSmall() ); 145 KDialog::spacingHintSmall() );
144 146
145 //extensions groupbox 147 //extensions groupbox
146 148
147 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 149 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
148 boxLayout = new QVBoxLayout( groupBox->layout() ); 150 boxLayout = new QVBoxLayout( groupBox->layout() );
149 boxLayout->setAlignment( Qt::AlignTop ); 151 boxLayout->setAlignment( Qt::AlignTop );
150 boxLayout->setMargin(KDialog::marginHintSmall()); 152 boxLayout->setMargin(KDialog::marginHintSmall());
151 boxLayout->setSpacing(KDialog::spacingHintSmall()); 153 boxLayout->setSpacing(KDialog::spacingHintSmall());
152 groupBox->layout()->setMargin(1) ; 154 groupBox->layout()->setMargin(1) ;
153 groupBox->layout()->setSpacing(0); 155 groupBox->layout()->setSpacing(0);
154 mExtensionView = new KListView( groupBox ); 156 mExtensionView = new KListView( groupBox );
155 mExtensionView->setAllColumnsShowFocus( true ); 157 mExtensionView->setAllColumnsShowFocus( true );
156 mExtensionView->addColumn( i18n( "Name" ) ); 158 mExtensionView->addColumn( i18n( "Name" ) );
157 mExtensionView->addColumn( i18n( "Description" ) ); 159 mExtensionView->addColumn( i18n( "Description" ) );
158 mExtensionView->setMaximumHeight(80); 160 mExtensionView->setMaximumHeight(80);
159 161
160 boxLayout->addWidget( mExtensionView ); 162 boxLayout->addWidget( mExtensionView );
161 163
162 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 164 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
163 mConfigureButton->setEnabled( false ); 165 mConfigureButton->setEnabled( false );
164 boxLayout->addWidget( mConfigureButton ); 166 boxLayout->addWidget( mConfigureButton );
165 167
166 extensionLayout->addWidget( groupBox ); 168 extensionLayout->addWidget( groupBox );
167 169
170 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
168 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 171 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
169 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 172 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
170 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 173 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
171 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 174 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
172 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 175 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
173 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 176 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
174 SLOT( selectionChanged( QListViewItem* ) ) ); 177 SLOT( selectionChanged( QListViewItem* ) ) );
175 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 178 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
176 SLOT( itemClicked( QListViewItem* ) ) ); 179 SLOT( itemClicked( QListViewItem* ) ) );
177 connect( mConfigureButton, SIGNAL( clicked() ), 180 connect( mConfigureButton, SIGNAL( clicked() ),
178 SLOT( configureExtension() ) ); 181 SLOT( configureExtension() ) );
179 182
180 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 183 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
181 184
182 // Addressee page 185 // Addressee page
183 mAddresseeWidget = new AddresseeWidget( this ); 186 mAddresseeWidget = new AddresseeWidget( this );
184 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 187 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
185 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 188 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
186 189
187} 190}
188 191
189void KABConfigWidget::usrReadConfig() 192void KABConfigWidget::usrReadConfig()
190{ 193{
191 KABPrefs* prefs = KABPrefs::instance(); 194 KABPrefs* prefs = KABPrefs::instance();
192 195
193 bool blocked = signalsBlocked(); 196 bool blocked = signalsBlocked();
194 blockSignals( true ); 197 blockSignals( true );
195 198 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
196 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 199 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
197 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 200 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
198 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 201 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
199 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 202 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
200 mAskForQuit->setChecked( prefs->mAskForQuit ); 203 mAskForQuit->setChecked( prefs->mAskForQuit );
201 204
202 mAddresseeWidget->restoreSettings(); 205 mAddresseeWidget->restoreSettings();
203 206
204 restoreExtensionSettings(); 207 restoreExtensionSettings();
205 208
206 blockSignals( blocked ); 209 blockSignals( blocked );
207 210
208} 211}
209 212
210void KABConfigWidget::usrWriteConfig() 213void KABConfigWidget::usrWriteConfig()
211{ 214{
212 KABPrefs* prefs = KABPrefs::instance(); 215 KABPrefs* prefs = KABPrefs::instance();
213 216 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked();
214 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 217 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
215 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 218 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
216 prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); 219 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
217 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 220 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
218 prefs->mAskForQuit = mAskForQuit->isChecked(); 221 prefs->mAskForQuit = mAskForQuit->isChecked();
219 222
220 mAddresseeWidget->saveSettings(); 223 mAddresseeWidget->saveSettings();
221 224
222 saveExtensionSettings(); 225 saveExtensionSettings();
223 226
224} 227}
225 228
226void KABConfigWidget::restoreExtensionSettings() 229void KABConfigWidget::restoreExtensionSettings()
227{ 230{
228 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 231 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
229 232
230 mExtensionView->clear(); 233 mExtensionView->clear();
231 234
232#ifndef KAB_EMBEDDED 235#ifndef KAB_EMBEDDED
233 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 236 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
234 KTrader::OfferList::ConstIterator it; 237 KTrader::OfferList::ConstIterator it;
235 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 238 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
236 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 239 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
237 continue; 240 continue;
238 241
239 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 242 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
240 item->setService( *it ); 243 item->setService( *it );
241 if ( activeExtensions.contains( item->factory()->identifier() ) ) 244 if ( activeExtensions.contains( item->factory()->identifier() ) )
242 item->setOn( true ); 245 item->setOn( true );
243 } 246 }
244#else //KAB_EMBEDDED 247#else //KAB_EMBEDDED
245 ExtensionFactory *extensionFactory = new MergeFactory(); 248 ExtensionFactory *extensionFactory = new MergeFactory();
246 249
247 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 250 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
248 251
249 item->setFactory( extensionFactory ); 252 item->setFactory( extensionFactory );
250 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 253 if ( activeExtensions.contains( extensionFactory->identifier() ) )
251 item->setOn( true ); 254 item->setOn( true );
252 255
253 256
254 257
255 extensionFactory = new DistributionListFactory(); 258 extensionFactory = new DistributionListFactory();
256 259
257 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 260 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
258 261
259 item->setFactory( extensionFactory ); 262 item->setFactory( extensionFactory );
260 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 263 if ( activeExtensions.contains( extensionFactory->identifier() ) )
261 item->setOn( true ); 264 item->setOn( true );
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 1e71fd1..08d71b4 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -21,55 +21,55 @@
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
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 *mMultipleViewsAtOnce; 67 QCheckBox *mMultipleViewsAtOnce;
68 QCheckBox *mAskForQuit; 68 QCheckBox *mAskForQuit;
69 69 QCheckBox *mMenuBarBox;
70 QPushButton *mConfigureButton; 70 QPushButton *mConfigureButton;
71 71
72 AddresseeWidget *mAddresseeWidget; 72 AddresseeWidget *mAddresseeWidget;
73}; 73};
74 74
75#endif 75#endif