-rw-r--r-- | kaddressbook/kabcore.cpp | 9 |
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 | |||
@@ -301,96 +301,105 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
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 | ||
324 | KABCore::~KABCore() | 324 | KABCore::~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 | } |
339 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 339 | void 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 | } |
350 | void KABCore::toggleBeamReceive( ) | 359 | void 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 | ||
371 | void KABCore::disableBR(bool b) | 380 | void 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 | } |
388 | void KABCore::recieve( QString fn ) | 397 | void 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(); |