summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 77321aa..af12f2b 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -219,403 +219,403 @@ class KABFormatPrefs : public QDialog
219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
220 company = new QRadioButton(i18n("Organization: MI6"), format ); 220 company = new QRadioButton(i18n("Organization: MI6"), format );
221 simple->setChecked( true ); 221 simple->setChecked( true );
222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
223 lay->addWidget( setCompany ); 223 lay->addWidget( setCompany );
224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
225 lay->addWidget( ok ); 225 lay->addWidget( ok );
226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
227 lay->addWidget( cancel ); 227 lay->addWidget( cancel );
228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
230 //resize( 200, 200 ); 230 //resize( 200, 200 );
231 231
232 } 232 }
233public: 233public:
234 QRadioButton* simple, *full, *reverse, *company; 234 QRadioButton* simple, *full, *reverse, *company;
235 QCheckBox* setCompany; 235 QCheckBox* setCompany;
236}; 236};
237 237
238 238
239 239
240class KAex2phonePrefs : public QDialog 240class KAex2phonePrefs : public QDialog
241{ 241{
242 public: 242 public:
243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
244 QDialog( parent, name, true ) 244 QDialog( parent, name, true )
245 { 245 {
246 setCaption( i18n("Export to phone options") ); 246 setCaption( i18n("Export to phone options") );
247 QVBoxLayout* lay = new QVBoxLayout( this ); 247 QVBoxLayout* lay = new QVBoxLayout( this );
248 lay->setSpacing( 3 ); 248 lay->setSpacing( 3 );
249 lay->setMargin( 3 ); 249 lay->setMargin( 3 );
250 QLabel *lab; 250 QLabel *lab;
251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
252 lab->setAlignment (AlignHCenter ); 252 lab->setAlignment (AlignHCenter );
253 QHBox* temphb; 253 QHBox* temphb;
254 temphb = new QHBox( this ); 254 temphb = new QHBox( this );
255 new QLabel( i18n("I/O device: "), temphb ); 255 new QLabel( i18n("I/O device: "), temphb );
256 mPhoneDevice = new QLineEdit( temphb); 256 mPhoneDevice = new QLineEdit( temphb);
257 lay->addWidget( temphb ); 257 lay->addWidget( temphb );
258 temphb = new QHBox( this ); 258 temphb = new QHBox( this );
259 new QLabel( i18n("Connection: "), temphb ); 259 new QLabel( i18n("Connection: "), temphb );
260 mPhoneConnection = new QLineEdit( temphb); 260 mPhoneConnection = new QLineEdit( temphb);
261 lay->addWidget( temphb ); 261 lay->addWidget( temphb );
262 temphb = new QHBox( this ); 262 temphb = new QHBox( this );
263 new QLabel( i18n("Model(opt.): "), temphb ); 263 new QLabel( i18n("Model(opt.): "), temphb );
264 mPhoneModel = new QLineEdit( temphb); 264 mPhoneModel = new QLineEdit( temphb);
265 lay->addWidget( temphb ); 265 lay->addWidget( temphb );
266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
267 // lay->addWidget( mWriteToSim ); 267 // lay->addWidget( mWriteToSim );
268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
269 lab->setAlignment (AlignHCenter); 269 lab->setAlignment (AlignHCenter);
270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
271 lay->addWidget( ok ); 271 lay->addWidget( ok );
272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
273 lay->addWidget( cancel ); 273 lay->addWidget( cancel );
274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
276 resize( 220, 240 ); 276 resize( 220, 240 );
277 277
278 } 278 }
279 279
280public: 280public:
281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
282 QCheckBox* mWriteToSim; 282 QCheckBox* mWriteToSim;
283}; 283};
284 284
285 285
286bool pasteWithNewUid = true; 286bool pasteWithNewUid = true;
287 287
288#ifdef KAB_EMBEDDED 288#ifdef KAB_EMBEDDED
289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
293#else //KAB_EMBEDDED 293#else //KAB_EMBEDDED
294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
297 mReadWrite( readWrite ), mModified( false ) 297 mReadWrite( readWrite ), mModified( false )
298#endif //KAB_EMBEDDED 298#endif //KAB_EMBEDDED
299{ 299{
300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
301 // syncManager->setBlockSave(false); 301 // syncManager->setBlockSave(false);
302 mIncSearchWidget = 0; 302 mIncSearchWidget = 0;
303 mMiniSplitter = 0; 303 mMiniSplitter = 0;
304 mExtensionBarSplitter = 0; 304 mExtensionBarSplitter = 0;
305 mIsPart = !parent->inherits( "KAddressBookMain" ); 305 mIsPart = !parent->inherits( "KAddressBookMain" );
306 mAddressBook = KABC::StdAddressBook::selfNoLoad(); 306 mAddressBook = KABC::StdAddressBook::selfNoLoad();
307 KABC::StdAddressBook::setAutomaticSave( false ); 307 KABC::StdAddressBook::setAutomaticSave( false );
308 308
309#ifndef KAB_EMBEDDED 309#ifndef KAB_EMBEDDED
310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
311#endif //KAB_EMBEDDED 311#endif //KAB_EMBEDDED
312 312
313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
314 SLOT( addressBookChanged() ) ); 314 SLOT( addressBookChanged() ) );
315 315
316#if 0 316#if 0
317 // LR moved to addressbook init method 317 // LR moved to addressbook init method
318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
319 "X-Department", "KADDRESSBOOK" ); 319 "X-Department", "KADDRESSBOOK" );
320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
321 "X-Profession", "KADDRESSBOOK" ); 321 "X-Profession", "KADDRESSBOOK" );
322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
323 "X-AssistantsName", "KADDRESSBOOK" ); 323 "X-AssistantsName", "KADDRESSBOOK" );
324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
325 "X-ManagersName", "KADDRESSBOOK" ); 325 "X-ManagersName", "KADDRESSBOOK" );
326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
327 "X-SpousesName", "KADDRESSBOOK" ); 327 "X-SpousesName", "KADDRESSBOOK" );
328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
329 "X-Office", "KADDRESSBOOK" ); 329 "X-Office", "KADDRESSBOOK" );
330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
331 "X-IMAddress", "KADDRESSBOOK" ); 331 "X-IMAddress", "KADDRESSBOOK" );
332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
333 "X-Anniversary", "KADDRESSBOOK" ); 333 "X-Anniversary", "KADDRESSBOOK" );
334 334
335 //US added this field to become compatible with Opie/qtopia addressbook 335 //US added this field to become compatible with Opie/qtopia addressbook
336 // values can be "female" or "male" or "". An empty field represents undefined. 336 // values can be "female" or "male" or "". An empty field represents undefined.
337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
338 "X-Gender", "KADDRESSBOOK" ); 338 "X-Gender", "KADDRESSBOOK" );
339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
340 "X-Children", "KADDRESSBOOK" ); 340 "X-Children", "KADDRESSBOOK" );
341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
342 "X-FreeBusyUrl", "KADDRESSBOOK" ); 342 "X-FreeBusyUrl", "KADDRESSBOOK" );
343#endif 343#endif
344 initGUI(); 344 initGUI();
345 345
346 mIncSearchWidget->setFocus(); 346 mIncSearchWidget->setFocus();
347 347
348 348
349 connect( mViewManager, SIGNAL( selected( const QString& ) ), 349 connect( mViewManager, SIGNAL( selected( const QString& ) ),
350 SLOT( setContactSelected( const QString& ) ) ); 350 SLOT( setContactSelected( const QString& ) ) );
351 connect( mViewManager, SIGNAL( executed( const QString& ) ), 351 connect( mViewManager, SIGNAL( executed( const QString& ) ),
352 SLOT( executeContact( const QString& ) ) ); 352 SLOT( executeContact( const QString& ) ) );
353 353
354 connect( mViewManager, SIGNAL( deleteRequest( ) ), 354 connect( mViewManager, SIGNAL( deleteRequest( ) ),
355 SLOT( deleteContacts( ) ) ); 355 SLOT( deleteContacts( ) ) );
356 connect( mViewManager, SIGNAL( modified() ), 356 connect( mViewManager, SIGNAL( modified() ),
357 SLOT( setModified() ) ); 357 SLOT( setModified() ) );
358 358
359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
361 361
362 connect( mXXPortManager, SIGNAL( modified() ), 362 connect( mXXPortManager, SIGNAL( modified() ),
363 SLOT( setModified() ) ); 363 SLOT( setModified() ) );
364 364
365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
366 SLOT( incrementalSearchJump( const QString& ) ) ); 366 SLOT( incrementalSearchJump( const QString& ) ) );
367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
368 mJumpButtonBar, SLOT( recreateButtons() ) ); 368 mJumpButtonBar, SLOT( recreateButtons() ) );
369 369
370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
371 SLOT( sendMail( const QString& ) ) ); 371 SLOT( sendMail( const QString& ) ) );
372 372
373 373
374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
375 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&))); 375 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&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync())); 378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync()));
379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
380 380
381 381
382#ifndef KAB_EMBEDDED 382#ifndef KAB_EMBEDDED
383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
384 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 384 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
385 385
386 connect( mDetails, SIGNAL( browse( const QString& ) ), 386 connect( mDetails, SIGNAL( browse( const QString& ) ),
387 SLOT( browse( const QString& ) ) ); 387 SLOT( browse( const QString& ) ) );
388 388
389 389
390 mAddressBookService = new KAddressBookService( this ); 390 mAddressBookService = new KAddressBookService( this );
391 391
392#endif //KAB_EMBEDDED 392#endif //KAB_EMBEDDED
393 393
394 mMessageTimer = new QTimer( this ); 394 mMessageTimer = new QTimer( this );
395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
396 mEditorDialog = 0; 396 mEditorDialog = 0;
397 createAddresseeEditorDialog( this ); 397 createAddresseeEditorDialog( this );
398 setModified( false ); 398 setModified( false );
399 mBRdisabled = false; 399 mBRdisabled = false;
400#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
401 infrared = 0; 401 infrared = 0;
402#endif 402#endif
403 //toggleBeamReceive( ); 403 //toggleBeamReceive( );
404 mMainWindow->toolBar()->show(); 404 mMainWindow->toolBar()->show();
405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
406 //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 406 //QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
407 QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); 407 QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() ));
408} 408}
409void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data ) 409void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data )
410{ 410{
411 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 411 //qDebug("KO: QCOP start message received: %s ", cmsg.data() );
412 mCStringMess = cmsg; 412 mCStringMess = cmsg;
413 mByteData = data; 413 mByteData = data;
414} 414}
415 415
416void KABCore::loadDataAfterStart() 416void KABCore::loadDataAfterStart()
417{ 417{
418 qDebug("KABCore::loadDataAfterStart() "); 418 //qDebug("KABCore::loadDataAfterStart() ");
419 ((StdAddressBook*)mAddressBook)->init( true ); 419 ((StdAddressBook*)mAddressBook)->init( true );
420 mViewManager->refreshView(); 420 mViewManager->refreshView();
421 421
422#ifndef DESKTOP_VERSION 422#ifndef DESKTOP_VERSION
423 disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & ))); 423 disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & )));
424 424
425 QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 425 QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
426 if ( !mCStringMess.isEmpty() ) 426 if ( !mCStringMess.isEmpty() )
427 ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); 427 ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData );
428#endif 428#endif
429 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 429 // QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
430 setCaptionBack(); 430 setCaptionBack();
431} 431}
432void KABCore::updateToolBar() 432void KABCore::updateToolBar()
433{ 433{
434 static int iii = 0; 434 static int iii = 0;
435 ++iii; 435 ++iii;
436 mMainWindow->toolBar()->repaintMe(); 436 mMainWindow->toolBar()->repaintMe();
437 if ( iii < 4 ) 437 if ( iii < 4 )
438 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 438 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
439} 439}
440KABCore::~KABCore() 440KABCore::~KABCore()
441{ 441{
442 // save(); 442 // save();
443 //saveSettings(); 443 //saveSettings();
444 //KABPrefs::instance()->writeConfig(); 444 //KABPrefs::instance()->writeConfig();
445 delete AddresseeConfig::instance(); 445 delete AddresseeConfig::instance();
446 mAddressBook = 0; 446 mAddressBook = 0;
447 KABC::StdAddressBook::close(); 447 KABC::StdAddressBook::close();
448 448
449 delete syncManager; 449 delete syncManager;
450#ifndef DESKTOP_VERSION 450#ifndef DESKTOP_VERSION
451 if ( infrared ) 451 if ( infrared )
452 delete infrared; 452 delete infrared;
453#endif 453#endif
454} 454}
455void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 455void KABCore::receive( const QCString& cmsg, const QByteArray& data )
456{ 456{
457 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 457 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
458 if ( cmsg == "setDocument(QString)" ) { 458 if ( cmsg == "setDocument(QString)" ) {
459 QDataStream stream( data, IO_ReadOnly ); 459 QDataStream stream( data, IO_ReadOnly );
460 QString fileName; 460 QString fileName;
461 stream >> fileName; 461 stream >> fileName;
462 recieve( fileName ); 462 recieve( fileName );
463 return; 463 return;
464 } 464 }
465} 465}
466void KABCore::toggleBeamReceive( ) 466void KABCore::toggleBeamReceive( )
467{ 467{
468 if ( mBRdisabled ) 468 if ( mBRdisabled )
469 return; 469 return;
470#ifndef DESKTOP_VERSION 470#ifndef DESKTOP_VERSION
471 if ( infrared ) { 471 if ( infrared ) {
472 qDebug("KA: AB disable BeamReceive "); 472 qDebug("KA: AB disable BeamReceive ");
473 delete infrared; 473 delete infrared;
474 infrared = 0; 474 infrared = 0;
475 mActionBR->setChecked(false); 475 mActionBR->setChecked(false);
476 return; 476 return;
477 } 477 }
478 qDebug("KA: AB enable BeamReceive "); 478 qDebug("KA: AB enable BeamReceive ");
479 mActionBR->setChecked(true); 479 mActionBR->setChecked(true);
480 480
481 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 481 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
482 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 482 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
483#endif 483#endif
484} 484}
485 485
486 486
487void KABCore::disableBR(bool b) 487void KABCore::disableBR(bool b)
488{ 488{
489#ifndef DESKTOP_VERSION 489#ifndef DESKTOP_VERSION
490 if ( b ) { 490 if ( b ) {
491 if ( infrared ) { 491 if ( infrared ) {
492 toggleBeamReceive( ); 492 toggleBeamReceive( );
493 } 493 }
494 mBRdisabled = true; 494 mBRdisabled = true;
495 } else { 495 } else {
496 if ( mBRdisabled ) { 496 if ( mBRdisabled ) {
497 mBRdisabled = false; 497 mBRdisabled = false;
498 //toggleBeamReceive( ); 498 //toggleBeamReceive( );
499 } 499 }
500 } 500 }
501#endif 501#endif
502 502
503} 503}
504void KABCore::recieve( QString fn ) 504void KABCore::recieve( QString fn )
505{ 505{
506 //qDebug("KABCore::recieve "); 506 //qDebug("KABCore::recieve ");
507 int count = mAddressBook->importFromFile( fn, true ); 507 int count = mAddressBook->importFromFile( fn, true );
508 if ( count ) 508 if ( count )
509 setModified( true ); 509 setModified( true );
510 mViewManager->refreshView(); 510 mViewManager->refreshView();
511 message(i18n("%1 contact(s) received!").arg( count )); 511 message(i18n("%1 contact(s) received!").arg( count ));
512 topLevelWidget()->showMaximized(); 512 topLevelWidget()->showMaximized();
513 topLevelWidget()->raise(); 513 topLevelWidget()->raise();
514} 514}
515void KABCore::restoreSettings() 515void KABCore::restoreSettings()
516{ 516{
517 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 517 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
518 518
519 bool state; 519 bool state;
520 520
521 if (mMultipleViewsAtOnce) 521 if (mMultipleViewsAtOnce)
522 state = KABPrefs::instance()->mDetailsPageVisible; 522 state = KABPrefs::instance()->mDetailsPageVisible;
523 else 523 else
524 state = false; 524 state = false;
525 525
526 mActionDetails->setChecked( state ); 526 mActionDetails->setChecked( state );
527 setDetailsVisible( state ); 527 setDetailsVisible( state );
528 528
529 state = KABPrefs::instance()->mJumpButtonBarVisible; 529 state = KABPrefs::instance()->mJumpButtonBarVisible;
530 530
531 mActionJumpBar->setChecked( state ); 531 mActionJumpBar->setChecked( state );
532 setJumpButtonBarVisible( state ); 532 setJumpButtonBarVisible( state );
533/*US 533/*US
534 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 534 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
535 if ( splitterSize.count() == 0 ) { 535 if ( splitterSize.count() == 0 ) {
536 splitterSize.append( width() / 2 ); 536 splitterSize.append( width() / 2 );
537 splitterSize.append( width() / 2 ); 537 splitterSize.append( width() / 2 );
538 } 538 }
539 mMiniSplitter->setSizes( splitterSize ); 539 mMiniSplitter->setSizes( splitterSize );
540 if ( mExtensionBarSplitter ) { 540 if ( mExtensionBarSplitter ) {
541 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 541 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
542 if ( splitterSize.count() == 0 ) { 542 if ( splitterSize.count() == 0 ) {
543 splitterSize.append( width() / 2 ); 543 splitterSize.append( width() / 2 );
544 splitterSize.append( width() / 2 ); 544 splitterSize.append( width() / 2 );
545 } 545 }
546 mExtensionBarSplitter->setSizes( splitterSize ); 546 mExtensionBarSplitter->setSizes( splitterSize );
547 547
548 } 548 }
549*/ 549*/
550 mViewManager->restoreSettings(); 550 mViewManager->restoreSettings();
551 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 551 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
552 mExtensionManager->restoreSettings(); 552 mExtensionManager->restoreSettings();
553#ifdef DESKTOP_VERSION 553#ifdef DESKTOP_VERSION
554 int wid = width(); 554 int wid = width();
555 if ( wid < 10 ) 555 if ( wid < 10 )
556 wid = 400; 556 wid = 400;
557#else 557#else
558 int wid = QApplication::desktop()->width(); 558 int wid = QApplication::desktop()->width();
559 if ( wid < 640 ) 559 if ( wid < 640 )
560 wid = QApplication::desktop()->height(); 560 wid = QApplication::desktop()->height();
561#endif 561#endif
562 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 562 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
563 if ( true /*splitterSize.count() == 0*/ ) { 563 if ( true /*splitterSize.count() == 0*/ ) {
564 splitterSize.append( wid / 2 ); 564 splitterSize.append( wid / 2 );
565 splitterSize.append( wid / 2 ); 565 splitterSize.append( wid / 2 );
566 } 566 }
567 mMiniSplitter->setSizes( splitterSize ); 567 mMiniSplitter->setSizes( splitterSize );
568 if ( mExtensionBarSplitter ) { 568 if ( mExtensionBarSplitter ) {
569 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 569 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
570 if ( true /*splitterSize.count() == 0*/ ) { 570 if ( true /*splitterSize.count() == 0*/ ) {
571 splitterSize.append( wid / 2 ); 571 splitterSize.append( wid / 2 );
572 splitterSize.append( wid / 2 ); 572 splitterSize.append( wid / 2 );
573 } 573 }
574 mExtensionBarSplitter->setSizes( splitterSize ); 574 mExtensionBarSplitter->setSizes( splitterSize );
575 575
576 } 576 }
577#ifdef DESKTOP_VERSION 577#ifdef DESKTOP_VERSION
578 KConfig *config = KABPrefs::instance()->getConfig(); 578 KConfig *config = KABPrefs::instance()->getConfig();
579 config->setGroup("WidgetLayout"); 579 config->setGroup("WidgetLayout");
580 QStringList list; 580 QStringList list;
581 list = config->readListEntry("MainLayout"); 581 list = config->readListEntry("MainLayout");
582 int x,y,w,h; 582 int x,y,w,h;
583 if ( ! list.isEmpty() ) { 583 if ( ! list.isEmpty() ) {
584 x = list[0].toInt(); 584 x = list[0].toInt();
585 y = list[1].toInt(); 585 y = list[1].toInt();
586 w = list[2].toInt(); 586 w = list[2].toInt();
587 h = list[3].toInt(); 587 h = list[3].toInt();
588 KApplication::testCoords( &x,&y,&w,&h ); 588 KApplication::testCoords( &x,&y,&w,&h );
589 topLevelWidget()->setGeometry(x,y,w,h); 589 topLevelWidget()->setGeometry(x,y,w,h);
590 590
591 } else { 591 } else {
592 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 592 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
593 } 593 }
594#endif 594#endif
595} 595}
596 596
597void KABCore::saveSettings() 597void KABCore::saveSettings()
598{ 598{
599 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 599 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
600 if ( mExtensionBarSplitter ) 600 if ( mExtensionBarSplitter )
601 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 601 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
602 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 602 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
603 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 603 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
604#ifndef KAB_EMBEDDED 604#ifndef KAB_EMBEDDED
605 605
606 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 606 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
607 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 607 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
608#endif //KAB_EMBEDDED 608#endif //KAB_EMBEDDED
609 mExtensionManager->saveSettings(); 609 mExtensionManager->saveSettings();
610 mViewManager->saveSettings(); 610 mViewManager->saveSettings();
611 611
612 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 612 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
613 613
614 KABPrefs::instance()->writeConfig(); 614 KABPrefs::instance()->writeConfig();
615 qDebug("KA: KABCore::saveSettings() "); 615 qDebug("KA: KABCore::saveSettings() ");
616} 616}
617 617
618KABC::AddressBook *KABCore::addressBook() const 618KABC::AddressBook *KABCore::addressBook() const
619{ 619{
620 return mAddressBook; 620 return mAddressBook;
621} 621}