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
@@ -5,48 +5,49 @@
#include <qpe/resource.h>
namespace OpieTooth {
BTIconLoader::BTIconLoader() {
// still need to find out real ids
deviceIcons.insert( 100 , "computer_16" );
deviceIcons.insert( 101 , "phone_16" );
deviceIcons.insert( 102 , "brain_16" );
deviceIcons.insert( 103 , "conduit_16" );
serviceIcons.insert( 4357 , "obex_16" ); //OBEXObjectPush
serviceIcons.insert( 4358 , "obex_16" ); //OBEXFileTransfer
serviceIcons.insert( 4369 , "print_16" ); //Fax
serviceIcons.insert( 4353 , "serial_16" ); //SerialPort
serviceIcons.insert( 4356 , "sync_16" ); //IrMCSync
serviceIcons.insert( 4359 , "sync_16" ); //IrMCSyncCommand
serviceIcons.insert( 4354 , "network_16" ); //LANAccessUsingPPP
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
serviceIcons.insert( 4390 , "print_16" ); //HCR_Print
serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access
serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking
serviceIcons.insert( 4610 , "folder_16" ); //GenericFileTransfer
serviceIcons.insert( 4392 , "audio_16" ); //GenericAudio
// serviceIcons.insert( 4392 , "phone_16" ); //GenericTelephony
// the above is duplicated? -zecke
//serviceIcons.insert( "106" , "link_16" );
//serviceIcons.insert( "107" , "misc_16" );
}
BTIconLoader::~BTIconLoader() {
}
QPixmap BTIconLoader::deviceIcon( int deviceClass ) {
QString iconName;
QMap<int, QString>::Iterator it;
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
@@ -1,45 +1,45 @@
TEMPLATE = app
CONFIG = qt warn_on debug
#CONFIG = qt warn_on release
HEADERS = btconnectionitem.h btdeviceitem.h \
btserviceitem.h stdpopups.h \
popuphelper.h bluebase.h \
scandialog.h btlistitem.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 \
popuphelper.cpp main.cpp \
bluebase.cpp scandialog.cpp \
btlistitem.cpp hciconfwrapper.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
LIBS += -lqpe -lopietooth -lopie
INTERFACES = bluetoothbase.ui devicedialog.ui
DESTDIR = $(OPIEDIR)/bin
TARGET = bluetooth-manager
TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \
../../../../i18n/da/bluetooth-manager.ts \
../../../../i18n/xx/bluetooth-manager.ts \
../../../../i18n/en/bluetooth-manager.ts \
../../../../i18n/es/bluetooth-manager.ts \
../../../../i18n/fr/bluetooth-manager.ts \
../../../../i18n/hu/bluetooth-manager.ts \
../../../../i18n/ja/bluetooth-manager.ts \
../../../../i18n/ko/bluetooth-manager.ts \
../../../../i18n/no/bluetooth-manager.ts \
../../../../i18n/pl/bluetooth-manager.ts \
../../../../i18n/pt/bluetooth-manager.ts \
../../../../i18n/pt_BR/bluetooth-manager.ts \
../../../../i18n/sl/bluetooth-manager.ts \
../../../../i18n/zh_CN/bluetooth-manager.ts \
../../../../i18n/zh_TW/bluetooth-manager.ts
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,36 +1,35 @@
#include "stdpopups.h"
-
#include "popuphelper.h"
using namespace OpieTooth;
PopupHelper::PopupHelper() {
init();
}
PopupHelper::~PopupHelper() {
-
}
void PopupHelper::insert( int id, popupFactory fact ) {
m_map.insert(id, fact );
}
QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) {
//qWarning("find");
FactoryMap::Iterator it = m_map.find(id );
if ( it != m_map.end() ) {
//qWarning("found");
popupFactory fact = it.data();
return (*fact)(ser, item);
}
return 0l;
}
void PopupHelper::init() {
insert( 4355, newRfcComPopup );
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
@@ -1,18 +1,19 @@
#ifndef OPIE_TOOTH_STD_POPUPS
#define OPIE_TOOTH_STD_POPUPS
#include <qlistview.h>
#include <qpopupmenu.h>
#include <services.h>
#include "btdeviceitem.h"
extern "C" {
QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
+ QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
}
#endif