summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bticonloader.cpp1
-rw-r--r--noncore/net/opietooth/manager/hidpopup.cpp105
-rw-r--r--noncore/net/opietooth/manager/hidpopup.h43
-rw-r--r--noncore/net/opietooth/manager/manager.pro4
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp1
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp5
-rw-r--r--noncore/net/opietooth/manager/stdpopups.h1
7 files changed, 158 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bticonloader.cpp b/noncore/net/opietooth/manager/bticonloader.cpp
index 6bac256..c8a6dd4 100644
--- a/noncore/net/opietooth/manager/bticonloader.cpp
+++ b/noncore/net/opietooth/manager/bticonloader.cpp
@@ -29,6 +29,7 @@ namespace OpieTooth {
29 serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony 29 serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony
30 serviceIcons.insert( 4362 , "audio_16"); // AudioSource 30 serviceIcons.insert( 4362 , "audio_16"); // AudioSource
31 serviceIcons.insert( 4363 , "audio_16"); // AudioSink 31 serviceIcons.insert( 4363 , "audio_16"); // AudioSink
32 serviceIcons.insert( 4388 , "other_16" ); //Human Interface Device
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
diff --git a/noncore/net/opietooth/manager/hidpopup.cpp b/noncore/net/opietooth/manager/hidpopup.cpp
new file mode 100644
index 0000000..98a2fb4
--- a/dev/null
+++ b/noncore/net/opietooth/manager/hidpopup.cpp
@@ -0,0 +1,105 @@
1/* $Id$ */
2/* PAN context menu */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
11#include <qpe/qcopenvelope_qws.h>
12#include <qmessagebox.h>
13#include <opie2/odebug.h>
14#include <opie2/oprocess.h>
15#include <qpe/qpeapplication.h>
16using namespace Opie::Core;
17
18#include <qtimer.h>
19#include "hidpopup.h"
20
21using namespace OpieTooth;
22
23/*
24 * c'tor init the QAction
25 */
26HidPopup::HidPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem* item) :
27 QPopupMenu() {
28
29 owarn << "HidPopup c'tor" << oendl;
30
31 m_item = item;
32 QAction* a;
33 QAction* c;
34
35 m_hidConnect = 0l;
36 /* connect action */
37
38 a = new QAction(); // so it's get deleted
39 a->setText( tr("connect") );
40 a->addTo( this );
41 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
42
43 c = new QAction();
44 c->setText( tr( "disconnect" ) );
45 c->addTo( this );
46 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
47
48};
49
50HidPopup::~HidPopup() {
51 delete m_hidConnect;
52}
53
54void HidPopup::slotConnect() {
55 odebug << "connect" << oendl;
56 m_hidConnect = new OProcess();
57 *m_hidConnect << "hidd" << "--connect" << m_item->mac();
58 connect(m_hidConnect,
59 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
60 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
61 connect(m_hidConnect,
62 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
63 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
64 connect(m_hidConnect,
65 SIGNAL(processExited(Opie::Core::OProcess*)),
66 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
67 if (!m_hidConnect->start(OProcess::Block, OProcess::AllOutput)) {
68 QMessageBox::critical(this, tr("HID Connection"),
69 tr("HID Connection\nto device ") + m_item->mac() + tr("\nfailed"));
70 delete m_hidConnect;
71 m_hidConnect = 0l;
72 }
73}
74
75void HidPopup::slotDisconnect() {
76 OProcess hidKill;
77 hidKill << "hidd" << "--kill" << m_item->mac();
78 hidKill.start(OProcess::DontCare, OProcess::NoCommunication);
79 sleep(1);
80 QMessageBox::information(this, tr("HID Disconnect"), tr("HID Disconnected"));
81}
82
83void HidPopup::fillOutPut( OProcess*, char* cha, int len ) {
84 QCString str(cha, len);
85 odebug << str << oendl;
86}
87
88void HidPopup::fillErr(OProcess*, char* buf, int len)
89{
90 QCString str(buf, len);
91 odebug << str << oendl;
92}
93
94void HidPopup::slotProcessExited(OProcess* proc) {
95 if (m_hidConnect->normalExit())
96 QMessageBox::information(this, tr("HID Connection"),
97 tr("HID Connect\nstarted"));
98 else
99 QMessageBox::critical(this, tr("HID Connection"),
100 tr("HID Connection\nto device ") + m_item->mac() + tr("\nfailed"));
101 delete m_hidConnect;
102 m_hidConnect = 0l;
103}
104
105//eof
diff --git a/noncore/net/opietooth/manager/hidpopup.h b/noncore/net/opietooth/manager/hidpopup.h
new file mode 100644
index 0000000..0c51919
--- a/dev/null
+++ b/noncore/net/opietooth/manager/hidpopup.h
@@ -0,0 +1,43 @@
1/* $Id$ */
2/* PAN context menu */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
11#ifndef HIDPOPUP_H
12#define HIDPOPUP_H
13
14#include <qpopupmenu.h>
15#include <qaction.h>
16#include <opie2/oprocess.h>
17#include <services.h>
18#include "btdeviceitem.h"
19
20namespace OpieTooth {
21
22 class HidPopup : public QPopupMenu {
23
24 Q_OBJECT
25
26 public:
27 HidPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem*);
28 ~HidPopup();
29
30 private:
31 QAction* m_push;
32 OpieTooth::BTDeviceItem *m_item;
33 Opie::Core::OProcess* m_hidConnect; //HID process
34 private slots:
35 void slotConnect();
36 void slotDisconnect();
37 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
38 void fillErr(Opie::Core::OProcess*, char*, int);
39 void slotProcessExited(Opie::Core::OProcess* proc);
40 };
41};
42
43#endif
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 09bd10e..dc048c4 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -9,7 +9,7 @@ HEADERS = btconnectionitem.h btdeviceitem.h \
9 rfcommassigndialogimpl.h rfcommassigndialogitem.h \ 9 rfcommassigndialogimpl.h rfcommassigndialogitem.h \
10 devicehandler.h rfcpopup.h obexpopup.h obexftpopup.h \ 10 devicehandler.h rfcpopup.h obexpopup.h obexftpopup.h \
11 rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h \ 11 rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h \
12 servicesdialog.h btconfhandler.h 12 servicesdialog.h btconfhandler.h hidpopup.h
13 13
14SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ 14SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
15 btserviceitem.cpp filelistitem.cpp stdpopups.cpp \ 15 btserviceitem.cpp filelistitem.cpp stdpopups.cpp \
@@ -21,7 +21,7 @@ SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
21 obexdialog.cpp devicehandler.cpp \ 21 obexdialog.cpp devicehandler.cpp \
22 rfcpopup.cpp obexpopup.cpp obexftpopup.cpp obexftpdialog.cpp \ 22 rfcpopup.cpp obexpopup.cpp obexftpopup.cpp obexftpdialog.cpp \
23 rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp \ 23 rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp \
24 servicesdialog.cpp btconfhandler.cpp 24 servicesdialog.cpp btconfhandler.cpp hidpopup.cpp
25INCLUDEPATH += $(OPIEDIR)/include 25INCLUDEPATH += $(OPIEDIR)/include
26INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 26INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
27DEPENDPATH += $(OPIEDIR)/include 27DEPENDPATH += $(OPIEDIR)/include
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
index b3d7aa5..66f42bc 100644
--- a/noncore/net/opietooth/manager/popuphelper.cpp
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -33,4 +33,5 @@ void PopupHelper::init() {
33 insert( 4357, newObexPushPopup ); 33 insert( 4357, newObexPushPopup );
34 insert( 4358, newObexFtpPopup ); 34 insert( 4358, newObexFtpPopup );
35 insert( 4374, newPanPopup ); 35 insert( 4374, newPanPopup );
36 insert( 4388, newHidPopup );
36} 37}
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp
index f58d3a6..17a7002 100644
--- a/noncore/net/opietooth/manager/stdpopups.cpp
+++ b/noncore/net/opietooth/manager/stdpopups.cpp
@@ -4,6 +4,7 @@
4#include "obexftpopup.h" 4#include "obexftpopup.h"
5#include "panpopup.h" 5#include "panpopup.h"
6#include "dunpopup.h" 6#include "dunpopup.h"
7#include "hidpopup.h"
7 8
8#include "stdpopups.h" 9#include "stdpopups.h"
9 10
@@ -25,5 +26,9 @@ extern "C" {
25 QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { 26 QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
26 return new OpieTooth::DunPopup(service, item); 27 return new OpieTooth::DunPopup(service, item);
27 } 28 }
29
30 QPopupMenu* newHidPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
31 return new OpieTooth::HidPopup(service, item);
32 }
28} 33}
29 34
diff --git a/noncore/net/opietooth/manager/stdpopups.h b/noncore/net/opietooth/manager/stdpopups.h
index 3c361db..f1e1696 100644
--- a/noncore/net/opietooth/manager/stdpopups.h
+++ b/noncore/net/opietooth/manager/stdpopups.h
@@ -15,6 +15,7 @@ extern "C" {
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 QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
17 QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); 17 QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
18 QPopupMenu* newHidPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
18 QPopupMenu* newObexFtpPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); 19 QPopupMenu* newObexFtpPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
19} 20}
20 21