summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-02-15 22:21:14 (UTC)
committer harlekin <harlekin>2003-02-15 22:21:14 (UTC)
commitf8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f (patch) (side-by-side diff)
treeab71630af2332c9ca9e9a537711b6e0d09614f9b
parent10b6cb1e9262b174ec0d8dc095d9f668f2d3e094 (diff)
downloadopie-f8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f.zip
opie-f8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f.tar.gz
opie-f8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f.tar.bz2
hacked together pan support, just for my own convenience, the core func should be moved into libopietooth later
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bticonloader.cpp1
-rw-r--r--noncore/net/opietooth/manager/manager.pro4
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp70
-rw-r--r--noncore/net/opietooth/manager/panpopup.h32
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp3
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp7
-rw-r--r--noncore/net/opietooth/manager/stdpopups.h1
7 files changed, 113 insertions, 5 deletions
diff --git a/noncore/net/opietooth/manager/bticonloader.cpp b/noncore/net/opietooth/manager/bticonloader.cpp
index a26af54..e5d8092 100644
--- a/noncore/net/opietooth/manager/bticonloader.cpp
+++ b/noncore/net/opietooth/manager/bticonloader.cpp
@@ -28,2 +28,3 @@ namespace OpieTooth {
serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway
+ serviceIcons.insert( 4374 , "network_16"); // Network Access Point
serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 9249d8d..f813e65 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -10,3 +10,3 @@ HEADERS = btconnectionitem.h btdeviceitem.h \
devicehandler.h rfcpopup.h obexpopup.h \
- rfcommhelper.h
+ rfcommhelper.h panpopup.h
@@ -20,3 +20,3 @@ SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
rfcpopup.cpp obexpopup.cpp \
- rfcommhelper.cpp
+ rfcommhelper.cpp panpopup.cpp
INCLUDEPATH += $(OPIEDIR)/include
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp
new file mode 100644
index 0000000..d3d1347
--- a/dev/null
+++ b/noncore/net/opietooth/manager/panpopup.cpp
@@ -0,0 +1,70 @@
+#include <qpe/qcopenvelope_qws.h>
+
+#include <qtimer.h>
+
+#include "panpopup.h"
+
+using namespace OpieTooth;
+
+/*
+ * c'tor init the QAction
+ */
+PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
+
+ qWarning("PanPopup c'tor");
+
+ m_item = item;
+ m_panconnect = 0l;
+ QAction *a, *b;
+
+ /* connect action */
+ a = new QAction( ); // so it's get deleted
+ a->setText( "connect" );
+ a->addTo( this );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
+
+ b = new QAction();
+ b->setText( "connect+conf" );
+ b->addTo( this );
+ connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
+};
+
+PanPopup::~PanPopup() {
+ delete m_panconnect;
+}
+
+void PanPopup::slotConnect() {
+
+
+ // SHOULD move to lib
+ // before pand must be in "pand --listen --role panu" mode ( client )
+
+ m_panconnect = new OProcess();
+ *m_panconnect << "pand" << "--connect" << m_item->mac();
+
+ connect( m_panconnect, SIGNAL( processExited( OProcess* ) ) ,
+ this, SLOT( slotConnectExited( OProcess* ) ) );
+ connect( m_panconnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ),
+ this, SLOT( slotConnectOut( OProcess*, char*, int ) ) );
+ if (!m_panconnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
+ qWarning( "could not start" );
+ delete m_panconnect;
+ }
+}
+
+void PanPopup::slotExited( OProcess* proc ) {
+ delete m_panconnect;
+}
+
+void PanPopup::slotStdOut(OProcess* proc, char* chars, int len)
+{}
+
+
+void PanPopup::slotConnectAndConfig() {
+ slotConnect();
+
+ // more intelligence here later like passing the device ( bnepX )
+ QCopEnvelope e( "QPE/System", "execute(QString)" );
+ e << QString( "networksetup" );
+
+}
diff --git a/noncore/net/opietooth/manager/panpopup.h b/noncore/net/opietooth/manager/panpopup.h
new file mode 100644
index 0000000..9d99f5e
--- a/dev/null
+++ b/noncore/net/opietooth/manager/panpopup.h
@@ -0,0 +1,32 @@
+#ifndef PANPOPUP_H
+#define PANPOPUP_H
+
+#include <qpopupmenu.h>
+#include <qaction.h>
+#include <opie/oprocess.h>
+
+#include "btdeviceitem.h"
+
+namespace OpieTooth {
+
+ class PanPopup : public QPopupMenu {
+
+ Q_OBJECT
+
+ public:
+ PanPopup( OpieTooth::BTDeviceItem* );
+ ~PanPopup();
+
+ private:
+ QAction* m_push;
+ OProcess* m_panconnect;
+ OpieTooth::BTDeviceItem *m_item;
+ private slots:
+ void slotConnect();
+ void slotConnectAndConfig();
+ void slotExited( OProcess* proc );
+ void slotStdOut( OProcess* proc, char* chars, int len );
+ };
+};
+
+#endif
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
index 1571fab..7da7002 100644
--- a/noncore/net/opietooth/manager/popuphelper.cpp
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -2,3 +2,2 @@
#include "stdpopups.h"
-
#include "popuphelper.h"
@@ -12,3 +11,2 @@ PopupHelper::PopupHelper() {
PopupHelper::~PopupHelper() {
-
}
@@ -35,2 +33,3 @@ void PopupHelper::init() {
insert( 4358, newObexPushPopup );
+ insert( 4374, newPanPopup );
}
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp
index 3a52334..934e58b 100644
--- a/noncore/net/opietooth/manager/stdpopups.cpp
+++ b/noncore/net/opietooth/manager/stdpopups.cpp
@@ -3,2 +3,3 @@
#include "obexpopup.h"
+#include "panpopup.h"
@@ -8,3 +9,3 @@ extern "C" {
- QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, OpieTooth::BTDeviceItem* item ) {
+ QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters
@@ -15,2 +16,6 @@ extern "C" {
}
+ QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
+ return new OpieTooth::PanPopup( item );
+ }
}
+
diff --git a/noncore/net/opietooth/manager/stdpopups.h b/noncore/net/opietooth/manager/stdpopups.h
index b57d4de..7f2f6b3 100644
--- a/noncore/net/opietooth/manager/stdpopups.h
+++ b/noncore/net/opietooth/manager/stdpopups.h
@@ -15,2 +15,3 @@ extern "C" {
QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
+ QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
}