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.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 3ad2f74..986c9b8 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -102,142 +102,157 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
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" ); 122 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" );
123 boxLayout->addWidget( mMenuBarBox ); 123 boxLayout->addWidget( mMenuBarBox );
124 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" );
125 boxLayout->addWidget( mSearchReturnBox ); 125 boxLayout->addWidget( mSearchReturnBox );
126 mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" );
127 boxLayout->addWidget( mAutoSearchWithWildcardBox);
128 mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" );
129 boxLayout->addWidget( mHideSearchOnSwitchBox );
130
131#ifdef DESKTOP_VERSION
132 mHideSearchOnSwitchBox->hide();
133#endif
126 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); 134 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
127 boxLayout->addWidget( mViewsSingleClickBox ); 135 boxLayout->addWidget( mViewsSingleClickBox );
128 136
129 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); 137 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
130 boxLayout->addWidget( mNameParsing ); 138 boxLayout->addWidget( mNameParsing );
131 139
132 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 140 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
133 boxLayout->addWidget( mMultipleViewsAtOnce ); 141 boxLayout->addWidget( mMultipleViewsAtOnce );
134 142
135 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); 143 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
136 boxLayout->addWidget( mAskForQuit ); 144 boxLayout->addWidget( mAskForQuit );
137 145
138 layout->addWidget( vBox ); 146 layout->addWidget( vBox );
139 147
140 tabWidget->addTab( generalPage, i18n( "General" ) ); 148 tabWidget->addTab( generalPage, i18n( "General" ) );
141 149
142 // Extension page 150 // Extension page
143 QWidget *extensionPage = new QWidget( this ); 151 QWidget *extensionPage = new QWidget( this );
144 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 152 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
145 KDialog::spacingHintSmall() ); 153 KDialog::spacingHintSmall() );
146 154
147 //extensions groupbox 155 //extensions groupbox
148 156
149 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 157 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
150 boxLayout = new QVBoxLayout( groupBox->layout() ); 158 boxLayout = new QVBoxLayout( groupBox->layout() );
151 boxLayout->setAlignment( Qt::AlignTop ); 159 boxLayout->setAlignment( Qt::AlignTop );
152 boxLayout->setMargin(KDialog::marginHintSmall()); 160 boxLayout->setMargin(KDialog::marginHintSmall());
153 boxLayout->setSpacing(KDialog::spacingHintSmall()); 161 boxLayout->setSpacing(KDialog::spacingHintSmall());
154 groupBox->layout()->setMargin(1) ; 162 groupBox->layout()->setMargin(1) ;
155 groupBox->layout()->setSpacing(0); 163 groupBox->layout()->setSpacing(0);
156 mExtensionView = new KListView( groupBox ); 164 mExtensionView = new KListView( groupBox );
157 mExtensionView->setAllColumnsShowFocus( true ); 165 mExtensionView->setAllColumnsShowFocus( true );
158 mExtensionView->addColumn( i18n( "Name" ) ); 166 mExtensionView->addColumn( i18n( "Name" ) );
159 mExtensionView->addColumn( i18n( "Description" ) ); 167 mExtensionView->addColumn( i18n( "Description" ) );
160 //mExtensionView->setMaximumHeight(80); 168 //mExtensionView->setMaximumHeight(80);
161 169
162 boxLayout->addWidget( mExtensionView ); 170 boxLayout->addWidget( mExtensionView );
163 171
164 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 172 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
165 mConfigureButton->setEnabled( false ); 173 mConfigureButton->setEnabled( false );
166 boxLayout->addWidget( mConfigureButton ); 174 boxLayout->addWidget( mConfigureButton );
167 175
168 extensionLayout->addWidget( groupBox ); 176 extensionLayout->addWidget( groupBox );
169 177
170 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 178 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
171 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 179 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
172 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 180 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
173 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 181 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
182 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
183 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
174 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 184 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
175 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 185 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
176 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 186 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
177 SLOT( selectionChanged( QListViewItem* ) ) ); 187 SLOT( selectionChanged( QListViewItem* ) ) );
178 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 188 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
179 SLOT( itemClicked( QListViewItem* ) ) ); 189 SLOT( itemClicked( QListViewItem* ) ) );
180 connect( mConfigureButton, SIGNAL( clicked() ), 190 connect( mConfigureButton, SIGNAL( clicked() ),
181 SLOT( configureExtension() ) ); 191 SLOT( configureExtension() ) );
182 192
183 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 193 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
184 194
185 // Addressee page 195 // Addressee page
186 mAddresseeWidget = new AddresseeWidget( this ); 196 mAddresseeWidget = new AddresseeWidget( this );
187 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 197 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
188 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 198 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
189 199
190} 200}
191 201
192void KABConfigWidget::usrReadConfig() 202void KABConfigWidget::usrReadConfig()
193{ 203{
194 KABPrefs* prefs = KABPrefs::instance(); 204 KABPrefs* prefs = KABPrefs::instance();
195 205
196 bool blocked = signalsBlocked(); 206 bool blocked = signalsBlocked();
197 blockSignals( true ); 207 blockSignals( true );
198 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); 208 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
199 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 209 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
200 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 210 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
201 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 211 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
212 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard );
213 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch );
202 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 214 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
203 mAskForQuit->setChecked( prefs->mAskForQuit ); 215 mAskForQuit->setChecked( prefs->mAskForQuit );
204 216
205 mAddresseeWidget->restoreSettings(); 217 mAddresseeWidget->restoreSettings();
206 218
207 restoreExtensionSettings(); 219 restoreExtensionSettings();
208 220
209 blockSignals( blocked ); 221 blockSignals( blocked );
210 222
211} 223}
212 224
213void KABConfigWidget::usrWriteConfig() 225void KABConfigWidget::usrWriteConfig()
214{ 226{
215 KABPrefs* prefs = KABPrefs::instance(); 227 KABPrefs* prefs = KABPrefs::instance();
216 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); 228 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked();
217 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 229 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
218 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 230 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
219 prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); 231 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
232 prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked();
233 prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked();
234
220 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 235 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
221 prefs->mAskForQuit = mAskForQuit->isChecked(); 236 prefs->mAskForQuit = mAskForQuit->isChecked();
222 237
223 mAddresseeWidget->saveSettings(); 238 mAddresseeWidget->saveSettings();
224 239
225 saveExtensionSettings(); 240 saveExtensionSettings();
226 241
227} 242}
228 243
229void KABConfigWidget::restoreExtensionSettings() 244void KABConfigWidget::restoreExtensionSettings()
230{ 245{
231 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 246 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
232 247
233 mExtensionView->clear(); 248 mExtensionView->clear();
234 249
235#ifndef KAB_EMBEDDED 250#ifndef KAB_EMBEDDED
236 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 251 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
237 KTrader::OfferList::ConstIterator it; 252 KTrader::OfferList::ConstIterator it;
238 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 253 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
239 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 254 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
240 continue; 255 continue;
241 256
242 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 257 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
243 item->setService( *it ); 258 item->setService( *it );