summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-28 00:21:13 (UTC)
committer ulf69 <ulf69>2004-10-28 00:21:13 (UTC)
commit621a8505690485db909a573f83433873197595c0 (patch) (unidiff)
tree1a37fcbdbf439b1d0411ee4d40973fce521be6ea
parent0b7fefe9f97ced1e4b2d93d26e12385aadb7b7e9 (diff)
downloadkdepimpi-621a8505690485db909a573f83433873197595c0.zip
kdepimpi-621a8505690485db909a573f83433873197595c0.tar.gz
kdepimpi-621a8505690485db909a573f83433873197595c0.tar.bz2
implemented "nextView" QCop message to toggle between table and detailview
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d1dcb6e..638abc9 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -157,384 +157,393 @@ $Id$
157#endif 157#endif
158// sync includes 158// sync includes
159#include <libkdepim/ksyncprofile.h> 159#include <libkdepim/ksyncprofile.h>
160#include <libkdepim/ksyncprefsdialog.h> 160#include <libkdepim/ksyncprefsdialog.h>
161 161
162class KAex2phonePrefs : public QDialog 162class KAex2phonePrefs : public QDialog
163{ 163{
164 public: 164 public:
165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
166 QDialog( parent, name, true ) 166 QDialog( parent, name, true )
167 { 167 {
168 setCaption( i18n("Export to phone options") ); 168 setCaption( i18n("Export to phone options") );
169 QVBoxLayout* lay = new QVBoxLayout( this ); 169 QVBoxLayout* lay = new QVBoxLayout( this );
170 lay->setSpacing( 3 ); 170 lay->setSpacing( 3 );
171 lay->setMargin( 3 ); 171 lay->setMargin( 3 );
172 QLabel *lab; 172 QLabel *lab;
173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
174 lab->setAlignment (AlignHCenter ); 174 lab->setAlignment (AlignHCenter );
175 QHBox* temphb; 175 QHBox* temphb;
176 temphb = new QHBox( this ); 176 temphb = new QHBox( this );
177 new QLabel( i18n("I/O device: "), temphb ); 177 new QLabel( i18n("I/O device: "), temphb );
178 mPhoneDevice = new QLineEdit( temphb); 178 mPhoneDevice = new QLineEdit( temphb);
179 lay->addWidget( temphb ); 179 lay->addWidget( temphb );
180 temphb = new QHBox( this ); 180 temphb = new QHBox( this );
181 new QLabel( i18n("Connection: "), temphb ); 181 new QLabel( i18n("Connection: "), temphb );
182 mPhoneConnection = new QLineEdit( temphb); 182 mPhoneConnection = new QLineEdit( temphb);
183 lay->addWidget( temphb ); 183 lay->addWidget( temphb );
184 temphb = new QHBox( this ); 184 temphb = new QHBox( this );
185 new QLabel( i18n("Model(opt.): "), temphb ); 185 new QLabel( i18n("Model(opt.): "), temphb );
186 mPhoneModel = new QLineEdit( temphb); 186 mPhoneModel = new QLineEdit( temphb);
187 lay->addWidget( temphb ); 187 lay->addWidget( temphb );
188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
189 // lay->addWidget( mWriteToSim ); 189 // lay->addWidget( mWriteToSim );
190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
191 lab->setAlignment (AlignHCenter ); 191 lab->setAlignment (AlignHCenter );
192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
193 lay->addWidget( ok ); 193 lay->addWidget( ok );
194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
195 lay->addWidget( cancel ); 195 lay->addWidget( cancel );
196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
198 resize( 220, 240 ); 198 resize( 220, 240 );
199 199
200 } 200 }
201 201
202public: 202public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
205}; 205};
206 206
207 207
208bool pasteWithNewUid = true; 208bool pasteWithNewUid = true;
209 209
210#ifdef KAB_EMBEDDED 210#ifdef KAB_EMBEDDED
211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
215#else //KAB_EMBEDDED 215#else //KAB_EMBEDDED
216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
219 mReadWrite( readWrite ), mModified( false ) 219 mReadWrite( readWrite ), mModified( false )
220#endif //KAB_EMBEDDED 220#endif //KAB_EMBEDDED
221{ 221{
222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
223 // syncManager->setBlockSave(false); 223 // syncManager->setBlockSave(false);
224 mExtensionBarSplitter = 0; 224 mExtensionBarSplitter = 0;
225 mIsPart = !parent->inherits( "KAddressBookMain" ); 225 mIsPart = !parent->inherits( "KAddressBookMain" );
226 mAddressBook = KABC::StdAddressBook::self(); 226 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 227 KABC::StdAddressBook::setAutomaticSave( false );
228 228
229#ifndef KAB_EMBEDDED 229#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
232 232
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 234 SLOT( addressBookChanged() ) );
235 235
236#if 0 236#if 0
237 // LP moved to addressbook init method 237 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 239 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 241 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 243 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 245 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 247 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 249 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 251 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 253 "X-Anniversary", "KADDRESSBOOK" );
254 254
255 //US added this field to become compatible with Opie/qtopia addressbook 255 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 256 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
258 "X-Gender", "KADDRESSBOOK" ); 258 "X-Gender", "KADDRESSBOOK" );
259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
260 "X-Children", "KADDRESSBOOK" ); 260 "X-Children", "KADDRESSBOOK" );
261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
262 "X-FreeBusyUrl", "KADDRESSBOOK" ); 262 "X-FreeBusyUrl", "KADDRESSBOOK" );
263#endif 263#endif
264 initGUI(); 264 initGUI();
265 265
266 mIncSearchWidget->setFocus(); 266 mIncSearchWidget->setFocus();
267 267
268 268
269 connect( mViewManager, SIGNAL( selected( const QString& ) ), 269 connect( mViewManager, SIGNAL( selected( const QString& ) ),
270 SLOT( setContactSelected( const QString& ) ) ); 270 SLOT( setContactSelected( const QString& ) ) );
271 connect( mViewManager, SIGNAL( executed( const QString& ) ), 271 connect( mViewManager, SIGNAL( executed( const QString& ) ),
272 SLOT( executeContact( const QString& ) ) ); 272 SLOT( executeContact( const QString& ) ) );
273 273
274 connect( mViewManager, SIGNAL( deleteRequest( ) ), 274 connect( mViewManager, SIGNAL( deleteRequest( ) ),
275 SLOT( deleteContacts( ) ) ); 275 SLOT( deleteContacts( ) ) );
276 connect( mViewManager, SIGNAL( modified() ), 276 connect( mViewManager, SIGNAL( modified() ),
277 SLOT( setModified() ) ); 277 SLOT( setModified() ) );
278 278
279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 281
282 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
284 284
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
289 289
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
292 292
293 293
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
297 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 297 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
298 298
299 299
300#ifndef KAB_EMBEDDED 300#ifndef KAB_EMBEDDED
301 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 301 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
302 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 302 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
303 303
304 connect( mDetails, SIGNAL( browse( const QString& ) ), 304 connect( mDetails, SIGNAL( browse( const QString& ) ),
305 SLOT( browse( const QString& ) ) ); 305 SLOT( browse( const QString& ) ) );
306 306
307 307
308 mAddressBookService = new KAddressBookService( this ); 308 mAddressBookService = new KAddressBookService( this );
309 309
310#endif //KAB_EMBEDDED 310#endif //KAB_EMBEDDED
311 311
312 mMessageTimer = new QTimer( this ); 312 mMessageTimer = new QTimer( this );
313 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 313 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
314 mEditorDialog = 0; 314 mEditorDialog = 0;
315 createAddresseeEditorDialog( this ); 315 createAddresseeEditorDialog( this );
316 setModified( false ); 316 setModified( false );
317 mBRdisabled = false; 317 mBRdisabled = false;
318#ifndef DESKTOP_VERSION 318#ifndef DESKTOP_VERSION
319 infrared = 0; 319 infrared = 0;
320#endif 320#endif
321 //toggleBeamReceive( ); 321 //toggleBeamReceive( );
322} 322}
323 323
324KABCore::~KABCore() 324KABCore::~KABCore()
325{ 325{
326 // save(); 326 // save();
327 //saveSettings(); 327 //saveSettings();
328 //KABPrefs::instance()->writeConfig(); 328 //KABPrefs::instance()->writeConfig();
329 delete AddresseeConfig::instance(); 329 delete AddresseeConfig::instance();
330 mAddressBook = 0; 330 mAddressBook = 0;
331 KABC::StdAddressBook::close(); 331 KABC::StdAddressBook::close();
332 332
333 delete syncManager; 333 delete syncManager;
334#ifndef DESKTOP_VERSION 334#ifndef DESKTOP_VERSION
335 if ( infrared ) 335 if ( infrared )
336 delete infrared; 336 delete infrared;
337#endif 337#endif
338} 338}
339void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 339void KABCore::receive( const QCString& cmsg, const QByteArray& data )
340{ 340{
341 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 341 qDebug("KA: QCOP message received: %s ", cmsg.data() );
342 if ( cmsg == "setDocument(QString)" ) { 342 if ( cmsg == "setDocument(QString)" ) {
343 QDataStream stream( data, IO_ReadOnly ); 343 QDataStream stream( data, IO_ReadOnly );
344 QString fileName; 344 QString fileName;
345 stream >> fileName; 345 stream >> fileName;
346 recieve( fileName ); 346 recieve( fileName );
347 return; 347 return;
348 } 348 }
349 else if ( cmsg == "nextView()" )
350 {
351 //toggle between details/ no details
352 bool b = !mActionDetails->isChecked();
353 setDetailsVisible( b );
354 mActionDetails->setChecked( b );
355 }
356
357
349} 358}
350void KABCore::toggleBeamReceive( ) 359void KABCore::toggleBeamReceive( )
351{ 360{
352 if ( mBRdisabled ) 361 if ( mBRdisabled )
353 return; 362 return;
354#ifndef DESKTOP_VERSION 363#ifndef DESKTOP_VERSION
355 if ( infrared ) { 364 if ( infrared ) {
356 qDebug("AB disable BeamReceive "); 365 qDebug("AB disable BeamReceive ");
357 delete infrared; 366 delete infrared;
358 infrared = 0; 367 infrared = 0;
359 mActionBR->setChecked(false); 368 mActionBR->setChecked(false);
360 return; 369 return;
361 } 370 }
362 qDebug("AB enable BeamReceive "); 371 qDebug("AB enable BeamReceive ");
363 mActionBR->setChecked(true); 372 mActionBR->setChecked(true);
364 373
365 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 374 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
366 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 375 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
367#endif 376#endif
368} 377}
369 378
370 379
371void KABCore::disableBR(bool b) 380void KABCore::disableBR(bool b)
372{ 381{
373#ifndef DESKTOP_VERSION 382#ifndef DESKTOP_VERSION
374 if ( b ) { 383 if ( b ) {
375 if ( infrared ) { 384 if ( infrared ) {
376 toggleBeamReceive( ); 385 toggleBeamReceive( );
377 } 386 }
378 mBRdisabled = true; 387 mBRdisabled = true;
379 } else { 388 } else {
380 if ( mBRdisabled ) { 389 if ( mBRdisabled ) {
381 mBRdisabled = false; 390 mBRdisabled = false;
382 //toggleBeamReceive( ); 391 //toggleBeamReceive( );
383 } 392 }
384 } 393 }
385#endif 394#endif
386 395
387} 396}
388void KABCore::recieve( QString fn ) 397void KABCore::recieve( QString fn )
389{ 398{
390 //qDebug("KABCore::recieve "); 399 //qDebug("KABCore::recieve ");
391 int count = mAddressBook->importFromFile( fn, true ); 400 int count = mAddressBook->importFromFile( fn, true );
392 if ( count ) 401 if ( count )
393 setModified( true ); 402 setModified( true );
394 mViewManager->refreshView(); 403 mViewManager->refreshView();
395 message(i18n("%1 contact(s) received!").arg( count )); 404 message(i18n("%1 contact(s) received!").arg( count ));
396 topLevelWidget()->showMaximized(); 405 topLevelWidget()->showMaximized();
397 topLevelWidget()->raise(); 406 topLevelWidget()->raise();
398} 407}
399void KABCore::restoreSettings() 408void KABCore::restoreSettings()
400{ 409{
401 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 410 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
402 411
403 bool state; 412 bool state;
404 413
405 if (mMultipleViewsAtOnce) 414 if (mMultipleViewsAtOnce)
406 state = KABPrefs::instance()->mDetailsPageVisible; 415 state = KABPrefs::instance()->mDetailsPageVisible;
407 else 416 else
408 state = false; 417 state = false;
409 418
410 mActionDetails->setChecked( state ); 419 mActionDetails->setChecked( state );
411 setDetailsVisible( state ); 420 setDetailsVisible( state );
412 421
413 state = KABPrefs::instance()->mJumpButtonBarVisible; 422 state = KABPrefs::instance()->mJumpButtonBarVisible;
414 423
415 mActionJumpBar->setChecked( state ); 424 mActionJumpBar->setChecked( state );
416 setJumpButtonBarVisible( state ); 425 setJumpButtonBarVisible( state );
417/*US 426/*US
418 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 427 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
419 if ( splitterSize.count() == 0 ) { 428 if ( splitterSize.count() == 0 ) {
420 splitterSize.append( width() / 2 ); 429 splitterSize.append( width() / 2 );
421 splitterSize.append( width() / 2 ); 430 splitterSize.append( width() / 2 );
422 } 431 }
423 mMiniSplitter->setSizes( splitterSize ); 432 mMiniSplitter->setSizes( splitterSize );
424 if ( mExtensionBarSplitter ) { 433 if ( mExtensionBarSplitter ) {
425 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 434 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
426 if ( splitterSize.count() == 0 ) { 435 if ( splitterSize.count() == 0 ) {
427 splitterSize.append( width() / 2 ); 436 splitterSize.append( width() / 2 );
428 splitterSize.append( width() / 2 ); 437 splitterSize.append( width() / 2 );
429 } 438 }
430 mExtensionBarSplitter->setSizes( splitterSize ); 439 mExtensionBarSplitter->setSizes( splitterSize );
431 440
432 } 441 }
433*/ 442*/
434 mViewManager->restoreSettings(); 443 mViewManager->restoreSettings();
435 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 444 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
436 mExtensionManager->restoreSettings(); 445 mExtensionManager->restoreSettings();
437#ifdef DESKTOP_VERSION 446#ifdef DESKTOP_VERSION
438 int wid = width(); 447 int wid = width();
439 if ( wid < 10 ) 448 if ( wid < 10 )
440 wid = 400; 449 wid = 400;
441#else 450#else
442 int wid = QApplication::desktop()->width(); 451 int wid = QApplication::desktop()->width();
443 if ( wid < 640 ) 452 if ( wid < 640 )
444 wid = QApplication::desktop()->height(); 453 wid = QApplication::desktop()->height();
445#endif 454#endif
446 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 455 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
447 if ( true /*splitterSize.count() == 0*/ ) { 456 if ( true /*splitterSize.count() == 0*/ ) {
448 splitterSize.append( wid / 2 ); 457 splitterSize.append( wid / 2 );
449 splitterSize.append( wid / 2 ); 458 splitterSize.append( wid / 2 );
450 } 459 }
451 mMiniSplitter->setSizes( splitterSize ); 460 mMiniSplitter->setSizes( splitterSize );
452 if ( mExtensionBarSplitter ) { 461 if ( mExtensionBarSplitter ) {
453 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 462 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
454 if ( true /*splitterSize.count() == 0*/ ) { 463 if ( true /*splitterSize.count() == 0*/ ) {
455 splitterSize.append( wid / 2 ); 464 splitterSize.append( wid / 2 );
456 splitterSize.append( wid / 2 ); 465 splitterSize.append( wid / 2 );
457 } 466 }
458 mExtensionBarSplitter->setSizes( splitterSize ); 467 mExtensionBarSplitter->setSizes( splitterSize );
459 468
460 } 469 }
461 470
462 471
463} 472}
464 473
465void KABCore::saveSettings() 474void KABCore::saveSettings()
466{ 475{
467 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 476 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
468 if ( mExtensionBarSplitter ) 477 if ( mExtensionBarSplitter )
469 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 478 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
470 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 479 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
471 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 480 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
472#ifndef KAB_EMBEDDED 481#ifndef KAB_EMBEDDED
473 482
474 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 483 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
475 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 484 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
476#endif //KAB_EMBEDDED 485#endif //KAB_EMBEDDED
477 mExtensionManager->saveSettings(); 486 mExtensionManager->saveSettings();
478 mViewManager->saveSettings(); 487 mViewManager->saveSettings();
479 488
480 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 489 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
481} 490}
482 491
483KABC::AddressBook *KABCore::addressBook() const 492KABC::AddressBook *KABCore::addressBook() const
484{ 493{
485 return mAddressBook; 494 return mAddressBook;
486} 495}
487 496
488KConfig *KABCore::config() 497KConfig *KABCore::config()
489{ 498{
490#ifndef KAB_EMBEDDED 499#ifndef KAB_EMBEDDED
491 return KABPrefs::instance()->config(); 500 return KABPrefs::instance()->config();
492#else //KAB_EMBEDDED 501#else //KAB_EMBEDDED
493 return KABPrefs::instance()->getConfig(); 502 return KABPrefs::instance()->getConfig();
494#endif //KAB_EMBEDDED 503#endif //KAB_EMBEDDED
495} 504}
496 505
497KActionCollection *KABCore::actionCollection() const 506KActionCollection *KABCore::actionCollection() const
498{ 507{
499 return mGUIClient->actionCollection(); 508 return mGUIClient->actionCollection();
500} 509}
501 510
502KABC::Field *KABCore::currentSearchField() const 511KABC::Field *KABCore::currentSearchField() const
503{ 512{
504 if (mIncSearchWidget) 513 if (mIncSearchWidget)
505 return mIncSearchWidget->currentField(); 514 return mIncSearchWidget->currentField();
506 else 515 else
507 return 0; 516 return 0;
508} 517}
509 518
510QStringList KABCore::selectedUIDs() const 519QStringList KABCore::selectedUIDs() const
511{ 520{
512 return mViewManager->selectedUids(); 521 return mViewManager->selectedUids();
513} 522}
514 523
515KABC::Resource *KABCore::requestResource( QWidget *parent ) 524KABC::Resource *KABCore::requestResource( QWidget *parent )
516{ 525{
517 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 526 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
518 527
519 QPtrList<KRES::Resource> kresResources; 528 QPtrList<KRES::Resource> kresResources;
520 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 529 QPtrListIterator<KABC::Resource> resIt( kabcResources );
521 KABC::Resource *resource; 530 KABC::Resource *resource;
522 while ( ( resource = resIt.current() ) != 0 ) { 531 while ( ( resource = resIt.current() ) != 0 ) {
523 ++resIt; 532 ++resIt;
524 if ( !resource->readOnly() ) { 533 if ( !resource->readOnly() ) {
525 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 534 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
526 if ( res ) 535 if ( res )
527 kresResources.append( res ); 536 kresResources.append( res );
528 } 537 }
529 } 538 }
530 539
531 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 540 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
532 return static_cast<KABC::Resource*>( res ); 541 return static_cast<KABC::Resource*>( res );
533} 542}
534 543
535#ifndef KAB_EMBEDDED 544#ifndef KAB_EMBEDDED
536KAboutData *KABCore::createAboutData() 545KAboutData *KABCore::createAboutData()
537#else //KAB_EMBEDDED 546#else //KAB_EMBEDDED
538void KABCore::createAboutData() 547void KABCore::createAboutData()
539#endif //KAB_EMBEDDED 548#endif //KAB_EMBEDDED
540{ 549{