summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs/kabconfigwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kcmconfigs/kabconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp7
1 files changed, 5 insertions, 2 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
@@ -98,140 +98,143 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
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;