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
@@ -26,6 +26,7 @@ namespace OpieTooth {
serviceIcons.insert( 4355 , "network_16"); //DialupNetworking
serviceIcons.insert( 4360 , "phone_16"); // Headset
serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway
+ serviceIcons.insert( 4374 , "network_16"); // Network Access Point
serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony
serviceIcons.insert( 4362 , "audio_16"); // AudioSource
serviceIcons.insert( 4363 , "audio_16"); // AudioSink
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
@@ -8,7 +8,7 @@ HEADERS = btconnectionitem.h btdeviceitem.h \
hciconfwrapper.h bticonloader.h \
pppdialog.h obexdialog.h \
devicehandler.h rfcpopup.h obexpopup.h \
- rfcommhelper.h
+ rfcommhelper.h panpopup.h
SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
btserviceitem.cpp stdpopups.cpp \
@@ -18,7 +18,7 @@ SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
bticonloader.cpp pppdialog.cpp \
obexdialog.cpp devicehandler.cpp \
rfcpopup.cpp obexpopup.cpp \
- rfcommhelper.cpp
+ rfcommhelper.cpp panpopup.cpp
INCLUDEPATH += $(OPIEDIR)/include
INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
DEPENDPATH += $(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
@@ -1,6 +1,5 @@
#include "stdpopups.h"
-
#include "popuphelper.h"
using namespace OpieTooth;
@@ -10,7 +9,6 @@ PopupHelper::PopupHelper() {
}
PopupHelper::~PopupHelper() {
-
}
void PopupHelper::insert( int id, popupFactory fact ) {
@@ -33,4 +31,5 @@ void PopupHelper::init() {
insert( 4353, newRfcComPopup );
insert( 4357, newObexPushPopup );
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
@@ -1,16 +1,21 @@
#include "rfcpopup.h"
#include "obexpopup.h"
+#include "panpopup.h"
#include "stdpopups.h"
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
//return 0l;
}
QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) {
return new OpieTooth::ObexPopup();
}
+ 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
@@ -13,6 +13,7 @@ extern "C" {
QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
+ QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
}
#endif