summaryrefslogtreecommitdiffabout
Side-by-side diff
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
setModified( false );
+ mBRdisabled = 0;
+#ifndef DESKTOP_VERSION
+ infrared = 0;
+#endif
+ toggleBeamReceive( );
}
@@ -327,5 +332,52 @@ KABCore::~KABCore()
delete syncManager;
+ if ( infrared )
+ delete infrared;
+}
+void KABCore::receive( const QCString& cmsg, const QByteArray& data )
+{
+ qDebug("KA: QCOP message received: %s ", cmsg.data() );
+ if ( cmsg == "setDocument(QString)" ) {
+ QDataStream stream( data, IO_ReadOnly );
+ QString fileName;
+ stream >> fileName;
+ recieve( fileName );
+ return;
+ }
+}
+void KABCore::toggleBeamReceive( )
+{
+ if ( mBRdisabled )
+ return;
+#ifndef DESKTOP_VERSION
+ if ( infrared ) {
+ qDebug("AB disable BeamReceive ");
+ delete infrared;
+ infrared = 0;
+ mActionBR->setChecked(false);
+ return;
+ }
+ qDebug("AB enable BeamReceive ");
+ mActionBR->setChecked(true);
+ infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
+ QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
+#endif
}
+
+void KABCore::disableBR(bool b)
+{
+ if ( b ) {
+ if ( infrared ) {
+ toggleBeamReceive( );
+ mBRdisabled = true;
+ }
+ } else {
+ if ( mBRdisabled ) {
+ mBRdisabled = false;
+ toggleBeamReceive( );
+ }
+ }
+
+}
void KABCore::recieve( QString fn )
@@ -1786,2 +1838,8 @@ void KABCore::initActions()
+
+ mActionBR = new KToggleAction( i18n( "Beam receice enabled" ), "beam", 0, this,
+ SLOT( toggleBeamReceive() ), actionCollection(),
+ "kaddressbook_beam_rec" );
+
+
// misc
@@ -1956,2 +2014,4 @@ void KABCore::addActionsManually()
settingsMenu->insertSeparator();
+ mActionBR->plug(settingsMenu );
+ settingsMenu->insertSeparator();
@@ -2749,2 +2809,3 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
return syncPhone();
+ disableBR( true );
QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
@@ -2769,2 +2830,3 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
mViewManager->refreshView();
+ disableBR( false );
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 @@
#include <ksyncmanager.h>
+#ifndef DESKTOP_VERSION
+#include <qcopchannel_qws.h>
+#endif
@@ -354,2 +357,5 @@ class KABCore : public QWidget, public KSyncInterface
private slots:
+ void receive( const QCString& cmsg, const QByteArray& data );
+ void toggleBeamReceive( );
+ void disableBR(bool);
void setJumpButtonBarVisible( bool visible );
@@ -372,2 +378,6 @@ class KABCore : public QWidget, public KSyncInterface
private:
+ bool mBRdisabled;
+#ifndef DESKTOP_VERSION
+ QCopChannel* infrared;
+#endif
QTimer *mMessageTimer;
@@ -410,2 +420,3 @@ class KABCore : public QWidget, public KSyncInterface
KAction *mActionBeam;
+ KToggleAction *mActionBR;
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()
}
-void KAddressBookMain::recieve( const QCString& cmsg, const QByteArray& data )
-{
- qDebug("KA: QCOP message received: %s ", cmsg.data() );
- if ( cmsg == "setDocument(QString)" ) {
- QDataStream stream( data, IO_ReadOnly );
- QString fileName;
- stream >> fileName;
- mCore->recieve( fileName );
- return;
- }
-}
+
void 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
virtual void exit();
- void recieve( const QCString& cmsg, const QByteArray& data );
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 )
a.showMainWidget( &m );
- QCopChannel* c1 = new QCopChannel("QPE/Application/addressbook",&m, "channelAB" ) ;
- QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
+
#else
@@ -89,5 +88,3 @@ int main( int argc, char **argv )
a.exec();
-#ifndef DESKTOP_VERSION
- delete c1;
-#endif
+