summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-02-15 22:21:14 (UTC)
committer harlekin <harlekin>2003-02-15 22:21:14 (UTC)
commitf8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f (patch) (unidiff)
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
@@ -1,78 +1,79 @@
1 1
2#include "bticonloader.h" 2#include "bticonloader.h"
3 3
4#include <qpixmap.h> 4#include <qpixmap.h>
5#include <qpe/resource.h> 5#include <qpe/resource.h>
6 6
7namespace OpieTooth { 7namespace OpieTooth {
8 8
9 9
10 BTIconLoader::BTIconLoader() { 10 BTIconLoader::BTIconLoader() {
11 11
12 // still need to find out real ids 12 // still need to find out real ids
13 deviceIcons.insert( 100 , "computer_16" ); 13 deviceIcons.insert( 100 , "computer_16" );
14 deviceIcons.insert( 101 , "phone_16" ); 14 deviceIcons.insert( 101 , "phone_16" );
15 deviceIcons.insert( 102 , "brain_16" ); 15 deviceIcons.insert( 102 , "brain_16" );
16 deviceIcons.insert( 103 , "conduit_16" ); 16 deviceIcons.insert( 103 , "conduit_16" );
17 17
18 18
19 serviceIcons.insert( 4357 , "obex_16" ); //OBEXObjectPush 19 serviceIcons.insert( 4357 , "obex_16" ); //OBEXObjectPush
20 serviceIcons.insert( 4358 , "obex_16" ); //OBEXFileTransfer 20 serviceIcons.insert( 4358 , "obex_16" ); //OBEXFileTransfer
21 serviceIcons.insert( 4369 , "print_16" ); //Fax 21 serviceIcons.insert( 4369 , "print_16" ); //Fax
22 serviceIcons.insert( 4353 , "serial_16" ); //SerialPort 22 serviceIcons.insert( 4353 , "serial_16" ); //SerialPort
23 serviceIcons.insert( 4356 , "sync_16" ); //IrMCSync 23 serviceIcons.insert( 4356 , "sync_16" ); //IrMCSync
24 serviceIcons.insert( 4359 , "sync_16" ); //IrMCSyncCommand 24 serviceIcons.insert( 4359 , "sync_16" ); //IrMCSyncCommand
25 serviceIcons.insert( 4354 , "network_16" ); //LANAccessUsingPPP 25 serviceIcons.insert( 4354 , "network_16" ); //LANAccessUsingPPP
26 serviceIcons.insert( 4355 , "network_16"); //DialupNetworking 26 serviceIcons.insert( 4355 , "network_16"); //DialupNetworking
27 serviceIcons.insert( 4360 , "phone_16"); // Headset 27 serviceIcons.insert( 4360 , "phone_16"); // Headset
28 serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway 28 serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway
29 serviceIcons.insert( 4374 , "network_16"); // Network Access Point
29 serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony 30 serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony
30 serviceIcons.insert( 4362 , "audio_16"); // AudioSource 31 serviceIcons.insert( 4362 , "audio_16"); // AudioSource
31 serviceIcons.insert( 4363 , "audio_16"); // AudioSink 32 serviceIcons.insert( 4363 , "audio_16"); // AudioSink
32 serviceIcons.insert( 4390 , "print_16" ); //HCR_Print 33 serviceIcons.insert( 4390 , "print_16" ); //HCR_Print
33 serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access 34 serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access
34 35
35 serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking 36 serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking
36 serviceIcons.insert( 4610 , "folder_16" ); //GenericFileTransfer 37 serviceIcons.insert( 4610 , "folder_16" ); //GenericFileTransfer
37 serviceIcons.insert( 4392 , "audio_16" ); //GenericAudio 38 serviceIcons.insert( 4392 , "audio_16" ); //GenericAudio
38 // serviceIcons.insert( 4392 , "phone_16" ); //GenericTelephony 39 // serviceIcons.insert( 4392 , "phone_16" ); //GenericTelephony
39 // the above is duplicated? -zecke 40 // the above is duplicated? -zecke
40 41
41 //serviceIcons.insert( "106" , "link_16" ); 42 //serviceIcons.insert( "106" , "link_16" );
42 //serviceIcons.insert( "107" , "misc_16" ); 43 //serviceIcons.insert( "107" , "misc_16" );
43 } 44 }
44 45
45 BTIconLoader::~BTIconLoader() { 46 BTIconLoader::~BTIconLoader() {
46 } 47 }
47 48
48 QPixmap BTIconLoader::deviceIcon( int deviceClass ) { 49 QPixmap BTIconLoader::deviceIcon( int deviceClass ) {
49 50
50 QString iconName; 51 QString iconName;
51 52
52 QMap<int, QString>::Iterator it; 53 QMap<int, QString>::Iterator it;
53 54
54 it = deviceIcons.find( deviceClass ); 55 it = deviceIcons.find( deviceClass );
55 iconName = it.data(); 56 iconName = it.data();
56 57
57 if ( iconName.isEmpty() ) { 58 if ( iconName.isEmpty() ) {
58 iconName = "unknown_16"; 59 iconName = "unknown_16";
59 } 60 }
60 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); 61 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) );
61 } 62 }
62 63
63 QPixmap BTIconLoader::serviceIcon( int serviceClass ) { 64 QPixmap BTIconLoader::serviceIcon( int serviceClass ) {
64 65
65 QString iconName; 66 QString iconName;
66 67
67 QMap<int, QString>::Iterator it; 68 QMap<int, QString>::Iterator it;
68 69
69 it = serviceIcons.find( serviceClass ); 70 it = serviceIcons.find( serviceClass );
70 iconName = it.data(); 71 iconName = it.data();
71 72
72 if ( iconName.isEmpty() ) { 73 if ( iconName.isEmpty() ) {
73 iconName = "unknown_16"; 74 iconName = "unknown_16";
74 } 75 }
75 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); 76 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) );
76 } 77 }
77 78
78} 79}
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,49 +1,49 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on debug 2CONFIG = qt warn_on debug
3#CONFIG = qt warn_on release 3#CONFIG = qt warn_on release
4HEADERS = btconnectionitem.h btdeviceitem.h \ 4HEADERS = btconnectionitem.h btdeviceitem.h \
5 btserviceitem.h stdpopups.h \ 5 btserviceitem.h stdpopups.h \
6 popuphelper.h bluebase.h \ 6 popuphelper.h bluebase.h \
7 scandialog.h btlistitem.h \ 7 scandialog.h btlistitem.h \
8 hciconfwrapper.h bticonloader.h \ 8 hciconfwrapper.h bticonloader.h \
9 pppdialog.h obexdialog.h \ 9 pppdialog.h obexdialog.h \
10 devicehandler.h rfcpopup.h obexpopup.h \ 10 devicehandler.h rfcpopup.h obexpopup.h \
11 rfcommhelper.h 11 rfcommhelper.h panpopup.h
12 12
13SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ 13SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
14 btserviceitem.cpp stdpopups.cpp \ 14 btserviceitem.cpp stdpopups.cpp \
15 popuphelper.cpp main.cpp \ 15 popuphelper.cpp main.cpp \
16 bluebase.cpp scandialog.cpp \ 16 bluebase.cpp scandialog.cpp \
17 btlistitem.cpp hciconfwrapper.cpp \ 17 btlistitem.cpp hciconfwrapper.cpp \
18 bticonloader.cpp pppdialog.cpp \ 18 bticonloader.cpp pppdialog.cpp \
19 obexdialog.cpp devicehandler.cpp \ 19 obexdialog.cpp devicehandler.cpp \
20 rfcpopup.cpp obexpopup.cpp \ 20 rfcpopup.cpp obexpopup.cpp \
21 rfcommhelper.cpp 21 rfcommhelper.cpp panpopup.cpp
22INCLUDEPATH += $(OPIEDIR)/include 22INCLUDEPATH += $(OPIEDIR)/include
23INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 23INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
24DEPENDPATH += $(OPIEDIR)/include 24DEPENDPATH += $(OPIEDIR)/include
25LIBS += -lqpe -lopietooth -lopie 25LIBS += -lqpe -lopietooth -lopie
26INTERFACES = bluetoothbase.ui devicedialog.ui 26INTERFACES = bluetoothbase.ui devicedialog.ui
27DESTDIR = $(OPIEDIR)/bin 27DESTDIR = $(OPIEDIR)/bin
28TARGET = bluetooth-manager 28TARGET = bluetooth-manager
29 29
30TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ 30TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \
31 ../../../../i18n/da/bluetooth-manager.ts \ 31 ../../../../i18n/da/bluetooth-manager.ts \
32 ../../../../i18n/xx/bluetooth-manager.ts \ 32 ../../../../i18n/xx/bluetooth-manager.ts \
33 ../../../../i18n/en/bluetooth-manager.ts \ 33 ../../../../i18n/en/bluetooth-manager.ts \
34 ../../../../i18n/es/bluetooth-manager.ts \ 34 ../../../../i18n/es/bluetooth-manager.ts \
35 ../../../../i18n/fr/bluetooth-manager.ts \ 35 ../../../../i18n/fr/bluetooth-manager.ts \
36 ../../../../i18n/hu/bluetooth-manager.ts \ 36 ../../../../i18n/hu/bluetooth-manager.ts \
37 ../../../../i18n/ja/bluetooth-manager.ts \ 37 ../../../../i18n/ja/bluetooth-manager.ts \
38 ../../../../i18n/ko/bluetooth-manager.ts \ 38 ../../../../i18n/ko/bluetooth-manager.ts \
39 ../../../../i18n/no/bluetooth-manager.ts \ 39 ../../../../i18n/no/bluetooth-manager.ts \
40 ../../../../i18n/pl/bluetooth-manager.ts \ 40 ../../../../i18n/pl/bluetooth-manager.ts \
41 ../../../../i18n/pt/bluetooth-manager.ts \ 41 ../../../../i18n/pt/bluetooth-manager.ts \
42 ../../../../i18n/pt_BR/bluetooth-manager.ts \ 42 ../../../../i18n/pt_BR/bluetooth-manager.ts \
43 ../../../../i18n/sl/bluetooth-manager.ts \ 43 ../../../../i18n/sl/bluetooth-manager.ts \
44 ../../../../i18n/zh_CN/bluetooth-manager.ts \ 44 ../../../../i18n/zh_CN/bluetooth-manager.ts \
45 ../../../../i18n/zh_TW/bluetooth-manager.ts 45 ../../../../i18n/zh_TW/bluetooth-manager.ts
46 46
47 47
48 48
49include ( $(OPIEDIR)/include.pro ) 49include ( $(OPIEDIR)/include.pro )
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 @@
1#include <qpe/qcopenvelope_qws.h>
2
3#include <qtimer.h>
4
5#include "panpopup.h"
6
7using namespace OpieTooth;
8
9/*
10 * c'tor init the QAction
11 */
12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13
14 qWarning("PanPopup c'tor");
15
16 m_item = item;
17 m_panconnect = 0l;
18 QAction *a, *b;
19
20 /* connect action */
21 a = new QAction( ); // so it's get deleted
22 a->setText( "connect" );
23 a->addTo( this );
24 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
25
26 b = new QAction();
27 b->setText( "connect+conf" );
28 b->addTo( this );
29 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
30};
31
32PanPopup::~PanPopup() {
33 delete m_panconnect;
34}
35
36void PanPopup::slotConnect() {
37
38
39 // SHOULD move to lib
40 // before pand must be in "pand --listen --role panu" mode ( client )
41
42 m_panconnect = new OProcess();
43 *m_panconnect << "pand" << "--connect" << m_item->mac();
44
45 connect( m_panconnect, SIGNAL( processExited( OProcess* ) ) ,
46 this, SLOT( slotConnectExited( OProcess* ) ) );
47 connect( m_panconnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ),
48 this, SLOT( slotConnectOut( OProcess*, char*, int ) ) );
49 if (!m_panconnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
50 qWarning( "could not start" );
51 delete m_panconnect;
52 }
53}
54
55void PanPopup::slotExited( OProcess* proc ) {
56 delete m_panconnect;
57}
58
59void PanPopup::slotStdOut(OProcess* proc, char* chars, int len)
60{}
61
62
63void PanPopup::slotConnectAndConfig() {
64 slotConnect();
65
66 // more intelligence here later like passing the device ( bnepX )
67 QCopEnvelope e( "QPE/System", "execute(QString)" );
68 e << QString( "networksetup" );
69
70}
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 @@
1#ifndef PANPOPUP_H
2#define PANPOPUP_H
3
4#include <qpopupmenu.h>
5#include <qaction.h>
6#include <opie/oprocess.h>
7
8#include "btdeviceitem.h"
9
10namespace OpieTooth {
11
12 class PanPopup : public QPopupMenu {
13
14 Q_OBJECT
15
16 public:
17 PanPopup( OpieTooth::BTDeviceItem* );
18 ~PanPopup();
19
20 private:
21 QAction* m_push;
22 OProcess* m_panconnect;
23 OpieTooth::BTDeviceItem *m_item;
24 private slots:
25 void slotConnect();
26 void slotConnectAndConfig();
27 void slotExited( OProcess* proc );
28 void slotStdOut( OProcess* proc, char* chars, int len );
29 };
30};
31
32#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 @@
1 1
2#include "stdpopups.h" 2#include "stdpopups.h"
3
4#include "popuphelper.h" 3#include "popuphelper.h"
5 4
6using namespace OpieTooth; 5using namespace OpieTooth;
7 6
8PopupHelper::PopupHelper() { 7PopupHelper::PopupHelper() {
9 init(); 8 init();
10} 9}
11 10
12PopupHelper::~PopupHelper() { 11PopupHelper::~PopupHelper() {
13
14} 12}
15 13
16void PopupHelper::insert( int id, popupFactory fact ) { 14void PopupHelper::insert( int id, popupFactory fact ) {
17 m_map.insert(id, fact ); 15 m_map.insert(id, fact );
18} 16}
19 17
20QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) { 18QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) {
21 //qWarning("find"); 19 //qWarning("find");
22 FactoryMap::Iterator it = m_map.find(id ); 20 FactoryMap::Iterator it = m_map.find(id );
23 if ( it != m_map.end() ) { 21 if ( it != m_map.end() ) {
24 //qWarning("found"); 22 //qWarning("found");
25 popupFactory fact = it.data(); 23 popupFactory fact = it.data();
26 return (*fact)(ser, item); 24 return (*fact)(ser, item);
27 } 25 }
28 return 0l; 26 return 0l;
29} 27}
30 28
31void PopupHelper::init() { 29void PopupHelper::init() {
32 insert( 4355, newRfcComPopup ); 30 insert( 4355, newRfcComPopup );
33 insert( 4353, newRfcComPopup ); 31 insert( 4353, newRfcComPopup );
34 insert( 4357, newObexPushPopup ); 32 insert( 4357, newObexPushPopup );
35 insert( 4358, newObexPushPopup ); 33 insert( 4358, newObexPushPopup );
34 insert( 4374, newPanPopup );
36} 35}
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 @@
1 1
2#include "rfcpopup.h" 2#include "rfcpopup.h"
3#include "obexpopup.h" 3#include "obexpopup.h"
4#include "panpopup.h"
4 5
5#include "stdpopups.h" 6#include "stdpopups.h"
6 7
7extern "C" { 8extern "C" {
8 9
9 QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, OpieTooth::BTDeviceItem* item ) { 10 QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
10 return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters 11 return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters
11 //return 0l; 12 //return 0l;
12 } 13 }
13 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) { 14 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) {
14 return new OpieTooth::ObexPopup(); 15 return new OpieTooth::ObexPopup();
15 } 16 }
17 QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
18 return new OpieTooth::PanPopup( item );
19 }
16} 20}
21
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 @@
1 1
2#ifndef OPIE_TOOTH_STD_POPUPS 2#ifndef OPIE_TOOTH_STD_POPUPS
3#define OPIE_TOOTH_STD_POPUPS 3#define OPIE_TOOTH_STD_POPUPS
4 4
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qpopupmenu.h> 6#include <qpopupmenu.h>
7 7
8#include <services.h> 8#include <services.h>
9 9
10#include "btdeviceitem.h" 10#include "btdeviceitem.h"
11 11
12extern "C" { 12extern "C" {
13 13
14 QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); 14 QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
15 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); 15 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
16 QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
16} 17}
17 18
18#endif 19#endif