author | zautrix <zautrix> | 2004-10-20 10:24:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 10:24:19 (UTC) |
commit | f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28 (patch) (unidiff) | |
tree | c0f67de8a80dc20d80612d7b4b27ebc6ca30f1ca | |
parent | b3662915cb2c966ed7b5c563b8e840ae5b82d4e6 (diff) | |
download | kdepimpi-f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28.zip kdepimpi-f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28.tar.gz kdepimpi-f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28.tar.bz2 |
fixed br for kapi
-rw-r--r-- | kaddressbook/kabcore.cpp | 64 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 11 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.h | 1 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 7 |
5 files changed, 77 insertions, 18 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 11eeabc..980e436 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -303,40 +303,92 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
303 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 303 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
304 | SLOT( browse( const QString& ) ) ); | 304 | SLOT( browse( const QString& ) ) ); |
305 | 305 | ||
306 | 306 | ||
307 | mAddressBookService = new KAddressBookService( this ); | 307 | mAddressBookService = new KAddressBookService( this ); |
308 | 308 | ||
309 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
310 | 310 | ||
311 | mMessageTimer = new QTimer( this ); | 311 | mMessageTimer = new QTimer( this ); |
312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
313 | mEditorDialog = 0; | 313 | mEditorDialog = 0; |
314 | createAddresseeEditorDialog( this ); | 314 | createAddresseeEditorDialog( this ); |
315 | setModified( false ); | 315 | setModified( false ); |
316 | mBRdisabled = 0; | ||
317 | #ifndef DESKTOP_VERSION | ||
318 | infrared = 0; | ||
319 | #endif | ||
320 | toggleBeamReceive( ); | ||
316 | } | 321 | } |
317 | 322 | ||
318 | KABCore::~KABCore() | 323 | KABCore::~KABCore() |
319 | { | 324 | { |
320 | // save(); | 325 | // save(); |
321 | //saveSettings(); | 326 | //saveSettings(); |
322 | //KABPrefs::instance()->writeConfig(); | 327 | //KABPrefs::instance()->writeConfig(); |
323 | delete AddresseeConfig::instance(); | 328 | delete AddresseeConfig::instance(); |
324 | mAddressBook = 0; | 329 | mAddressBook = 0; |
325 | KABC::StdAddressBook::close(); | 330 | KABC::StdAddressBook::close(); |
326 | 331 | ||
327 | delete syncManager; | 332 | delete syncManager; |
333 | if ( infrared ) | ||
334 | delete infrared; | ||
335 | } | ||
336 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | ||
337 | { | ||
338 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | ||
339 | if ( cmsg == "setDocument(QString)" ) { | ||
340 | QDataStream stream( data, IO_ReadOnly ); | ||
341 | QString fileName; | ||
342 | stream >> fileName; | ||
343 | recieve( fileName ); | ||
344 | return; | ||
345 | } | ||
346 | } | ||
347 | void KABCore::toggleBeamReceive( ) | ||
348 | { | ||
349 | if ( mBRdisabled ) | ||
350 | return; | ||
351 | #ifndef DESKTOP_VERSION | ||
352 | if ( infrared ) { | ||
353 | qDebug("AB disable BeamReceive "); | ||
354 | delete infrared; | ||
355 | infrared = 0; | ||
356 | mActionBR->setChecked(false); | ||
357 | return; | ||
358 | } | ||
359 | qDebug("AB enable BeamReceive "); | ||
360 | mActionBR->setChecked(true); | ||
328 | 361 | ||
362 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | ||
363 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | ||
364 | #endif | ||
329 | } | 365 | } |
330 | 366 | ||
367 | |||
368 | void KABCore::disableBR(bool b) | ||
369 | { | ||
370 | if ( b ) { | ||
371 | if ( infrared ) { | ||
372 | toggleBeamReceive( ); | ||
373 | mBRdisabled = true; | ||
374 | } | ||
375 | } else { | ||
376 | if ( mBRdisabled ) { | ||
377 | mBRdisabled = false; | ||
378 | toggleBeamReceive( ); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | } | ||
331 | void KABCore::recieve( QString fn ) | 383 | void KABCore::recieve( QString fn ) |
332 | { | 384 | { |
333 | //qDebug("KABCore::recieve "); | 385 | //qDebug("KABCore::recieve "); |
334 | int count = mAddressBook->importFromFile( fn, true ); | 386 | int count = mAddressBook->importFromFile( fn, true ); |
335 | mViewManager->refreshView(); | 387 | mViewManager->refreshView(); |
336 | message(i18n("%1 contact(s) received!").arg( count )); | 388 | message(i18n("%1 contact(s) received!").arg( count )); |
337 | topLevelWidget()->showMaximized(); | 389 | topLevelWidget()->showMaximized(); |
338 | topLevelWidget()->raise(); | 390 | topLevelWidget()->raise(); |
339 | } | 391 | } |
340 | void KABCore::restoreSettings() | 392 | void KABCore::restoreSettings() |
341 | { | 393 | { |
342 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 394 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
@@ -1775,24 +1827,30 @@ void KABCore::initActions() | |||
1775 | 1827 | ||
1776 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1828 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1777 | } | 1829 | } |
1778 | 1830 | ||
1779 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1831 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1780 | actionCollection(), "options_show_jump_bar" ); | 1832 | actionCollection(), "options_show_jump_bar" ); |
1781 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1833 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1782 | 1834 | ||
1783 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1835 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1784 | actionCollection(), "options_show_details" ); | 1836 | actionCollection(), "options_show_details" ); |
1785 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1837 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1786 | 1838 | ||
1839 | |||
1840 | mActionBR = new KToggleAction( i18n( "Beam receice enabled" ), "beam", 0, this, | ||
1841 | SLOT( toggleBeamReceive() ), actionCollection(), | ||
1842 | "kaddressbook_beam_rec" ); | ||
1843 | |||
1844 | |||
1787 | // misc | 1845 | // misc |
1788 | // only enable LDAP lookup if we can handle the protocol | 1846 | // only enable LDAP lookup if we can handle the protocol |
1789 | #ifndef KAB_EMBEDDED | 1847 | #ifndef KAB_EMBEDDED |
1790 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1848 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1791 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1849 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1792 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1850 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1793 | "ldap_lookup" ); | 1851 | "ldap_lookup" ); |
1794 | } | 1852 | } |
1795 | #else //KAB_EMBEDDED | 1853 | #else //KAB_EMBEDDED |
1796 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1854 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1797 | #endif //KAB_EMBEDDED | 1855 | #endif //KAB_EMBEDDED |
1798 | 1856 | ||
@@ -1945,24 +2003,26 @@ void KABCore::addActionsManually() | |||
1945 | 2003 | ||
1946 | } else { | 2004 | } else { |
1947 | mActionKeyBindings->plug( settingsMenu ); | 2005 | mActionKeyBindings->plug( settingsMenu ); |
1948 | } | 2006 | } |
1949 | 2007 | ||
1950 | settingsMenu->insertSeparator(); | 2008 | settingsMenu->insertSeparator(); |
1951 | 2009 | ||
1952 | mActionJumpBar->plug( settingsMenu ); | 2010 | mActionJumpBar->plug( settingsMenu ); |
1953 | mActionDetails->plug( settingsMenu ); | 2011 | mActionDetails->plug( settingsMenu ); |
1954 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2012 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1955 | mActionDetails->plug( tb ); | 2013 | mActionDetails->plug( tb ); |
1956 | settingsMenu->insertSeparator(); | 2014 | settingsMenu->insertSeparator(); |
2015 | mActionBR->plug(settingsMenu ); | ||
2016 | settingsMenu->insertSeparator(); | ||
1957 | 2017 | ||
1958 | mActionWhoAmI->plug( settingsMenu ); | 2018 | mActionWhoAmI->plug( settingsMenu ); |
1959 | mActionCategories->plug( settingsMenu ); | 2019 | mActionCategories->plug( settingsMenu ); |
1960 | 2020 | ||
1961 | 2021 | ||
1962 | mActionWN->plug( helpMenu ); | 2022 | mActionWN->plug( helpMenu ); |
1963 | mActionSyncHowto->plug( helpMenu ); | 2023 | mActionSyncHowto->plug( helpMenu ); |
1964 | mActionLicence->plug( helpMenu ); | 2024 | mActionLicence->plug( helpMenu ); |
1965 | mActionFaq->plug( helpMenu ); | 2025 | mActionFaq->plug( helpMenu ); |
1966 | mActionAboutKAddressbook->plug( helpMenu ); | 2026 | mActionAboutKAddressbook->plug( helpMenu ); |
1967 | 2027 | ||
1968 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2028 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
@@ -2738,44 +2798,46 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2738 | if ( syncOK ) | 2798 | if ( syncOK ) |
2739 | mViewManager->refreshView(); | 2799 | mViewManager->refreshView(); |
2740 | return syncOK; | 2800 | return syncOK; |
2741 | 2801 | ||
2742 | } | 2802 | } |
2743 | 2803 | ||
2744 | 2804 | ||
2745 | //this is a overwritten callbackmethods from the syncinterface | 2805 | //this is a overwritten callbackmethods from the syncinterface |
2746 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2806 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2747 | { | 2807 | { |
2748 | if ( resource == "phone" ) | 2808 | if ( resource == "phone" ) |
2749 | return syncPhone(); | 2809 | return syncPhone(); |
2810 | disableBR( true ); | ||
2750 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2811 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2751 | 2812 | ||
2752 | AddressBook abLocal( resource,"syncContact"); | 2813 | AddressBook abLocal( resource,"syncContact"); |
2753 | bool syncOK = false; | 2814 | bool syncOK = false; |
2754 | if ( abLocal.load() ) { | 2815 | if ( abLocal.load() ) { |
2755 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2816 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2756 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2817 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2757 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 2818 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
2758 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2819 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2759 | if ( syncOK ) { | 2820 | if ( syncOK ) { |
2760 | if ( syncManager->mWriteBackFile ) { | 2821 | if ( syncManager->mWriteBackFile ) { |
2761 | abLocal.removeSyncAddressees( false ); | 2822 | abLocal.removeSyncAddressees( false ); |
2762 | abLocal.saveAB(); | 2823 | abLocal.saveAB(); |
2763 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2824 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2764 | } | 2825 | } |
2765 | } | 2826 | } |
2766 | setModified(); | 2827 | setModified(); |
2767 | } | 2828 | } |
2768 | if ( syncOK ) | 2829 | if ( syncOK ) |
2769 | mViewManager->refreshView(); | 2830 | mViewManager->refreshView(); |
2831 | disableBR( false ); | ||
2770 | return syncOK; | 2832 | return syncOK; |
2771 | 2833 | ||
2772 | } | 2834 | } |
2773 | void KABCore::message( QString m ) | 2835 | void KABCore::message( QString m ) |
2774 | { | 2836 | { |
2775 | topLevelWidget()->setCaption( m ); | 2837 | topLevelWidget()->setCaption( m ); |
2776 | mMessageTimer->start( 15000, true ); | 2838 | mMessageTimer->start( 15000, true ); |
2777 | } | 2839 | } |
2778 | bool KABCore::syncPhone() | 2840 | bool KABCore::syncPhone() |
2779 | { | 2841 | { |
2780 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2842 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2781 | QString fileName = getPhoneFile(); | 2843 | QString fileName = getPhoneFile(); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c7be343..fcbe1e8 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -25,24 +25,27 @@ | |||
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <ksyncmanager.h> | 36 | #include <ksyncmanager.h> |
37 | #ifndef DESKTOP_VERSION | ||
38 | #include <qcopchannel_qws.h> | ||
39 | #endif | ||
37 | 40 | ||
38 | namespace KABC { | 41 | namespace KABC { |
39 | class AddressBook; | 42 | class AddressBook; |
40 | } | 43 | } |
41 | 44 | ||
42 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
43 | class KAboutData; | 46 | class KAboutData; |
44 | class KConfig; | 47 | class KConfig; |
45 | 48 | ||
46 | class KAddressBookService; | 49 | class KAddressBookService; |
47 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
48 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
@@ -343,42 +346,49 @@ class KABCore : public QWidget, public KSyncInterface | |||
343 | 346 | ||
344 | signals: | 347 | signals: |
345 | void contactSelected( const QString &name ); | 348 | void contactSelected( const QString &name ); |
346 | void contactSelected( const QPixmap &pixmap ); | 349 | void contactSelected( const QPixmap &pixmap ); |
347 | public slots: | 350 | public slots: |
348 | void recieve(QString cmsg ); | 351 | void recieve(QString cmsg ); |
349 | void getFile( bool success ); | 352 | void getFile( bool success ); |
350 | void syncFileRequest(); | 353 | void syncFileRequest(); |
351 | void setDetailsVisible( bool visible ); | 354 | void setDetailsVisible( bool visible ); |
352 | void setDetailsToState(); | 355 | void setDetailsToState(); |
353 | // void slotSyncMenu( int ); | 356 | // void slotSyncMenu( int ); |
354 | private slots: | 357 | private slots: |
358 | void receive( const QCString& cmsg, const QByteArray& data ); | ||
359 | void toggleBeamReceive( ); | ||
360 | void disableBR(bool); | ||
355 | void setJumpButtonBarVisible( bool visible ); | 361 | void setJumpButtonBarVisible( bool visible ); |
356 | void setCaptionBack(); | 362 | void setCaptionBack(); |
357 | void importFromOL(); | 363 | void importFromOL(); |
358 | void extensionModified( const KABC::Addressee::List &list ); | 364 | void extensionModified( const KABC::Addressee::List &list ); |
359 | void extensionChanged( int id ); | 365 | void extensionChanged( int id ); |
360 | void clipboardDataChanged(); | 366 | void clipboardDataChanged(); |
361 | void updateActionMenu(); | 367 | void updateActionMenu(); |
362 | void configureKeyBindings(); | 368 | void configureKeyBindings(); |
363 | void removeVoice(); | 369 | void removeVoice(); |
364 | #ifdef KAB_EMBEDDED | 370 | #ifdef KAB_EMBEDDED |
365 | void configureResources(); | 371 | void configureResources(); |
366 | #endif //KAB_EMBEDDED | 372 | #endif //KAB_EMBEDDED |
367 | 373 | ||
368 | void slotEditorDestroyed( const QString &uid ); | 374 | void slotEditorDestroyed( const QString &uid ); |
369 | void configurationChanged(); | 375 | void configurationChanged(); |
370 | void addressBookChanged(); | 376 | void addressBookChanged(); |
371 | 377 | ||
372 | private: | 378 | private: |
379 | bool mBRdisabled; | ||
380 | #ifndef DESKTOP_VERSION | ||
381 | QCopChannel* infrared; | ||
382 | #endif | ||
373 | QTimer *mMessageTimer; | 383 | QTimer *mMessageTimer; |
374 | void initGUI(); | 384 | void initGUI(); |
375 | void initActions(); | 385 | void initActions(); |
376 | QString getPhoneFile(); | 386 | QString getPhoneFile(); |
377 | 387 | ||
378 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 388 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
379 | const char *name = 0 ); | 389 | const char *name = 0 ); |
380 | 390 | ||
381 | KXMLGUIClient *mGUIClient; | 391 | KXMLGUIClient *mGUIClient; |
382 | 392 | ||
383 | KABC::AddressBook *mAddressBook; | 393 | KABC::AddressBook *mAddressBook; |
384 | 394 | ||
@@ -399,24 +409,25 @@ class KABCore : public QWidget, public KSyncInterface | |||
399 | #endif //KAB_EMBEDDED | 409 | #endif //KAB_EMBEDDED |
400 | // QDict<AddresseeEditorDialog> mEditorDict; | 410 | // QDict<AddresseeEditorDialog> mEditorDict; |
401 | AddresseeEditorDialog *mEditorDialog; | 411 | AddresseeEditorDialog *mEditorDialog; |
402 | bool mReadWrite; | 412 | bool mReadWrite; |
403 | bool mModified; | 413 | bool mModified; |
404 | bool mIsPart; | 414 | bool mIsPart; |
405 | bool mMultipleViewsAtOnce; | 415 | bool mMultipleViewsAtOnce; |
406 | 416 | ||
407 | 417 | ||
408 | //US file menu | 418 | //US file menu |
409 | KAction *mActionMail; | 419 | KAction *mActionMail; |
410 | KAction *mActionBeam; | 420 | KAction *mActionBeam; |
421 | KToggleAction *mActionBR; | ||
411 | KAction *mActionExport2phone; | 422 | KAction *mActionExport2phone; |
412 | KAction* mActionPrint; | 423 | KAction* mActionPrint; |
413 | KAction* mActionNewContact; | 424 | KAction* mActionNewContact; |
414 | KAction *mActionSave; | 425 | KAction *mActionSave; |
415 | KAction *mActionEditAddressee; | 426 | KAction *mActionEditAddressee; |
416 | KAction *mActionMailVCard; | 427 | KAction *mActionMailVCard; |
417 | KAction *mActionBeamVCard; | 428 | KAction *mActionBeamVCard; |
418 | 429 | ||
419 | KAction *mActionQuit; | 430 | KAction *mActionQuit; |
420 | 431 | ||
421 | //US edit menu | 432 | //US edit menu |
422 | KAction *mActionCopy; | 433 | KAction *mActionCopy; |
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index 8c4ca09..f48f214 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -83,35 +83,25 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW | |||
83 | 83 | ||
84 | 84 | ||
85 | #endif //KAB_EMBEDDED | 85 | #endif //KAB_EMBEDDED |
86 | setAutoSaveSettings(); | 86 | setAutoSaveSettings(); |
87 | qApp->processEvents(); | 87 | qApp->processEvents(); |
88 | mCore->restoreSettings(); | 88 | mCore->restoreSettings(); |
89 | } | 89 | } |
90 | 90 | ||
91 | KAddressBookMain::~KAddressBookMain() | 91 | KAddressBookMain::~KAddressBookMain() |
92 | { | 92 | { |
93 | // mCore->saveSettings(); | 93 | // mCore->saveSettings(); |
94 | } | 94 | } |
95 | void KAddressBookMain::recieve( const QCString& cmsg, const QByteArray& data ) | 95 | |
96 | { | ||
97 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | ||
98 | if ( cmsg == "setDocument(QString)" ) { | ||
99 | QDataStream stream( data, IO_ReadOnly ); | ||
100 | QString fileName; | ||
101 | stream >> fileName; | ||
102 | mCore->recieve( fileName ); | ||
103 | return; | ||
104 | } | ||
105 | } | ||
106 | void KAddressBookMain::showMinimized () | 96 | void KAddressBookMain::showMinimized () |
107 | { | 97 | { |
108 | QWidget::showMinimized () ; | 98 | QWidget::showMinimized () ; |
109 | } | 99 | } |
110 | void KAddressBookMain::addEmail( QString addr ) | 100 | void KAddressBookMain::addEmail( QString addr ) |
111 | { | 101 | { |
112 | mCore->addEmail( addr ); | 102 | mCore->addEmail( addr ); |
113 | } | 103 | } |
114 | 104 | ||
115 | #ifndef KAB_EMBEDDED | 105 | #ifndef KAB_EMBEDDED |
116 | ASYNC KAddressBookMain::showContactEditor( QString uid ) | 106 | ASYNC KAddressBookMain::showContactEditor( QString uid ) |
117 | { | 107 | { |
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h index 40d2bdd..b6d9b4b 100644 --- a/kaddressbook/kaddressbookmain.h +++ b/kaddressbook/kaddressbookmain.h | |||
@@ -72,25 +72,24 @@ class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface | |||
72 | public slots: | 72 | public slots: |
73 | void showMinimized () ; | 73 | void showMinimized () ; |
74 | virtual void addEmail( QString addr ); | 74 | virtual void addEmail( QString addr ); |
75 | #ifndef KAB_EMBEDDED | 75 | #ifndef KAB_EMBEDDED |
76 | //MOC_SKIP_BEGIN | 76 | //MOC_SKIP_BEGIN |
77 | virtual ASYNC showContactEditor( QString uid ); | 77 | virtual ASYNC showContactEditor( QString uid ); |
78 | //MOC_SKIP_END | 78 | //MOC_SKIP_END |
79 | #endif //KAB_EMBEDDED | 79 | #endif //KAB_EMBEDDED |
80 | virtual void newContact(); | 80 | virtual void newContact(); |
81 | virtual QString getNameByPhone( QString phone ); | 81 | virtual QString getNameByPhone( QString phone ); |
82 | virtual void save(); | 82 | virtual void save(); |
83 | virtual void exit(); | 83 | virtual void exit(); |
84 | void recieve( const QCString& cmsg, const QByteArray& data ); | ||
85 | protected: | 84 | protected: |
86 | void initActions(); | 85 | void initActions(); |
87 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
88 | //US new method to setup menues and toolbars on embedded systems | 87 | //US new method to setup menues and toolbars on embedded systems |
89 | void createGUI(); | 88 | void createGUI(); |
90 | #endif //KAB_EMBEDDED | 89 | #endif //KAB_EMBEDDED |
91 | 90 | ||
92 | /** | 91 | /** |
93 | This function is called when it is time for the app to save its | 92 | This function is called when it is time for the app to save its |
94 | properties for session management purposes. | 93 | properties for session management purposes. |
95 | */ | 94 | */ |
96 | void saveProperties( KConfig* ); | 95 | void saveProperties( KConfig* ); |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 6dd97b8..a2ff1e9 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -70,35 +70,32 @@ int main( int argc, char **argv ) | |||
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 72 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
73 | KAddressBookMain m ; | 73 | KAddressBookMain m ; |
74 | //US MainWindow m; | 74 | //US MainWindow m; |
75 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 75 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
76 | 76 | ||
77 | { | 77 | { |
78 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 78 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
79 | } | 79 | } |
80 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
81 | a.showMainWidget( &m ); | 81 | a.showMainWidget( &m ); |
82 | QCopChannel* c1 = new QCopChannel("QPE/Application/addressbook",&m, "channelAB" ) ; | 82 | |
83 | QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
84 | #else | 83 | #else |
85 | a.setMainWidget( &m ); | 84 | a.setMainWidget( &m ); |
86 | m.resize (640, 480 ); | 85 | m.resize (640, 480 ); |
87 | m.show(); | 86 | m.show(); |
88 | #endif | 87 | #endif |
89 | a.exec(); | 88 | a.exec(); |
90 | #ifndef DESKTOP_VERSION | 89 | |
91 | delete c1; | ||
92 | #endif | ||
93 | 90 | ||
94 | } | 91 | } |
95 | qDebug("KA: Bye! "); | 92 | qDebug("KA: Bye! "); |
96 | } | 93 | } |
97 | 94 | ||
98 | /* | 95 | /* |
99 | #include <stdlib.h> | 96 | #include <stdlib.h> |
100 | 97 | ||
101 | #include <qstring.h> | 98 | #include <qstring.h> |
102 | 99 | ||
103 | #include <kabc/stdaddressbook.h> | 100 | #include <kabc/stdaddressbook.h> |
104 | #include <kaboutdata.h> | 101 | #include <kaboutdata.h> |