summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/panpopup.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager/panpopup.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp70
1 files changed, 70 insertions, 0 deletions
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}