summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp62
-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, 76 insertions, 17 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 11eeabc..980e436 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -315,2 +315,7 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
315 setModified( false ); 315 setModified( false );
316 mBRdisabled = 0;
317#ifndef DESKTOP_VERSION
318 infrared = 0;
319#endif
320 toggleBeamReceive( );
316} 321}
@@ -327,5 +332,52 @@ KABCore::~KABCore()
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 )
@@ -1786,2 +1838,8 @@ void KABCore::initActions()
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
@@ -1956,2 +2014,4 @@ void KABCore::addActionsManually()
1956 settingsMenu->insertSeparator(); 2014 settingsMenu->insertSeparator();
2015 mActionBR->plug(settingsMenu );
2016 settingsMenu->insertSeparator();
1957 2017
@@ -2749,2 +2809,3 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2749 return syncPhone(); 2809 return syncPhone();
2810 disableBR( true );
2750 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2811 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
@@ -2769,2 +2830,3 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2769 mViewManager->refreshView(); 2830 mViewManager->refreshView();
2831 disableBR( false );
2770 return syncOK; 2832 return syncOK;
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c7be343..fcbe1e8 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -36,2 +36,5 @@
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h>
39#endif
37 40
@@ -354,2 +357,5 @@ class KABCore : public QWidget, public KSyncInterface
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 );
@@ -372,2 +378,6 @@ class KABCore : public QWidget, public KSyncInterface
372 private: 378 private:
379 bool mBRdisabled;
380#ifndef DESKTOP_VERSION
381 QCopChannel* infrared;
382#endif
373 QTimer *mMessageTimer; 383 QTimer *mMessageTimer;
@@ -410,2 +420,3 @@ class KABCore : public QWidget, public KSyncInterface
410 KAction *mActionBeam; 420 KAction *mActionBeam;
421 KToggleAction *mActionBR;
411 KAction *mActionExport2phone; 422 KAction *mActionExport2phone;
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 8c4ca09..f48f214 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -94,13 +94,3 @@ KAddressBookMain::~KAddressBookMain()
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 ()
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index 40d2bdd..b6d9b4b 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -83,3 +83,2 @@ class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
83 virtual void exit(); 83 virtual void exit();
84 void recieve( const QCString& cmsg, const QByteArray& data );
85 protected: 84 protected:
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 6dd97b8..a2ff1e9 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -81,4 +81,3 @@ int main( int argc, char **argv )
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
@@ -89,5 +88,3 @@ int main( int argc, char **argv )
89 a.exec(); 88 a.exec();
90#ifndef DESKTOP_VERSION 89
91 delete c1;
92#endif
93 90