summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp64
-rw-r--r--kaddressbook/kabcore.h11
-rw-r--r--kaddressbook/kaddressbookmain.cpp12
-rw-r--r--kaddressbook/kaddressbookmain.h1
-rw-r--r--kaddressbook/mainembedded.cpp7
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
@@ -313,5 +313,10 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
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
@@ -326,7 +331,54 @@ KABCore::~KABCore()
326 331
327 delete syncManager; 332 delete syncManager;
333 if ( infrared )
334 delete infrared;
335}
336void 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}
347void 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
368void 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}
331void KABCore::recieve( QString fn ) 383void KABCore::recieve( QString fn )
332{ 384{
@@ -1785,4 +1837,10 @@ void KABCore::initActions()
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
@@ -1955,4 +2013,6 @@ void KABCore::addActionsManually()
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 );
@@ -2748,4 +2808,5 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
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
@@ -2768,4 +2829,5 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2768 if ( syncOK ) 2829 if ( syncOK )
2769 mViewManager->refreshView(); 2830 mViewManager->refreshView();
2831 disableBR( false );
2770 return syncOK; 2832 return syncOK;
2771 2833
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c7be343..fcbe1e8 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -35,4 +35,7 @@
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
38namespace KABC { 41namespace KABC {
@@ -353,4 +356,7 @@ class KABCore : public QWidget, public KSyncInterface
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();
@@ -371,4 +377,8 @@ class KABCore : public QWidget, public KSyncInterface
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();
@@ -409,4 +419,5 @@ class KABCore : public QWidget, public KSyncInterface
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;
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 8c4ca09..f48f214 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -93,15 +93,5 @@ KAddressBookMain::~KAddressBookMain()
93 // mCore->saveSettings(); 93 // mCore->saveSettings();
94} 94}
95void 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}
106void KAddressBookMain::showMinimized () 96void KAddressBookMain::showMinimized ()
107{ 97{
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index 40d2bdd..b6d9b4b 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -82,5 +82,4 @@ class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
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();
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 6dd97b8..a2ff1e9 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -80,6 +80,5 @@ int main( int argc, char **argv )
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 );
@@ -88,7 +87,5 @@ int main( int argc, char **argv )
88#endif 87#endif
89 a.exec(); 88 a.exec();
90#ifndef DESKTOP_VERSION 89
91 delete c1;
92#endif
93 90
94 } 91 }