-rw-r--r-- | noncore/net/opietooth/lib/startpanconnection.cpp | 14 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/panpopup.cpp | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index e7deede..6e0ab7e 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp | |||
@@ -32,37 +32,51 @@ void StartPanConnection::setConnectionType() { | |||
32 | } | 32 | } |
33 | 33 | ||
34 | StartConnection::ConnectionType StartPanConnection::type() { | 34 | StartConnection::ConnectionType StartPanConnection::type() { |
35 | return m_connectionType; | 35 | return m_connectionType; |
36 | } | 36 | } |
37 | 37 | ||
38 | void StartPanConnection::start() { | 38 | void StartPanConnection::start() { |
39 | m_panConnect = new OProcess(); | 39 | m_panConnect = new OProcess(); |
40 | qDebug( "IM START " + m_mac ); | 40 | qDebug( "IM START " + m_mac ); |
41 | *m_panConnect << "pand" << "--connect" << m_mac; | 41 | *m_panConnect << "pand" << "--connect" << m_mac; |
42 | 42 | ||
43 | connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , | 43 | connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , |
44 | this, SLOT( slotExited( OProcess* ) ) ); | 44 | this, SLOT( slotExited( OProcess* ) ) ); |
45 | connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), | 45 | connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), |
46 | this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); | 46 | this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); |
47 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 47 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
48 | qWarning( "could not start" ); | 48 | qWarning( "could not start" ); |
49 | delete m_panConnect; | 49 | delete m_panConnect; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void StartPanConnection::slotExited( OProcess* proc ) { | 54 | void StartPanConnection::slotExited( OProcess* proc ) { |
55 | delete m_panConnect; | 55 | delete m_panConnect; |
56 | m_panConnect = 0l; | ||
56 | } | 57 | } |
57 | 58 | ||
58 | void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) | 59 | void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) |
59 | {} | 60 | {} |
60 | 61 | ||
61 | 62 | ||
62 | void StartPanConnection::stop() { | 63 | void StartPanConnection::stop() { |
63 | if ( m_panConnect ) { | 64 | if ( m_panConnect ) { |
64 | delete m_panConnect; | 65 | delete m_panConnect; |
65 | m_panConnect = 0l; | 66 | m_panConnect = 0l; |
66 | } | 67 | } |
68 | m_panConnect = new OProcess(); | ||
69 | qDebug("IM STOP " + m_mac); | ||
70 | |||
71 | *m_panConnect << "pand" << "--kill" << m_mac; | ||
72 | |||
73 | connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , | ||
74 | this, SLOT( slotExited( OProcess* ) ) ); | ||
75 | connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), | ||
76 | this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); | ||
77 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | ||
78 | qWarning( "could not stop" ); | ||
79 | delete m_panConnect; | ||
80 | } | ||
67 | } | 81 | } |
68 | 82 | ||
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp index 695f349..8b05964 100644 --- a/noncore/net/opietooth/manager/panpopup.cpp +++ b/noncore/net/opietooth/manager/panpopup.cpp | |||
@@ -28,36 +28,37 @@ PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | |||
28 | 28 | ||
29 | b = new QAction(); | 29 | b = new QAction(); |
30 | b->setText( tr( "connect+conf" ) ); | 30 | b->setText( tr( "connect+conf" ) ); |
31 | b->addTo( this ); | 31 | b->addTo( this ); |
32 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); | 32 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); |
33 | 33 | ||
34 | c = new QAction(); | 34 | c = new QAction(); |
35 | c->setText( tr( "disconnect" ) ); | 35 | c->setText( tr( "disconnect" ) ); |
36 | c->addTo( this ); | 36 | c->addTo( this ); |
37 | connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); | 37 | connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); |
38 | 38 | ||
39 | }; | 39 | }; |
40 | 40 | ||
41 | PanPopup::~PanPopup() { | 41 | PanPopup::~PanPopup() { |
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | void PanPopup::slotConnect() { | 45 | void PanPopup::slotConnect() { |
46 | 46 | ||
47 | m_panconnection = new StartPanConnection( m_item->mac() ); | 47 | m_panconnection = new StartPanConnection( m_item->mac() ); |
48 | m_panconnection->start(); | 48 | m_panconnection->start(); |
49 | } | 49 | } |
50 | 50 | ||
51 | void PanPopup::slotDisconnect() { | 51 | void PanPopup::slotDisconnect() { |
52 | if (!m_panconnection) m_panconnection = new StartPanConnection( m_item->mac() ); | ||
52 | m_panconnection->stop(); | 53 | m_panconnection->stop(); |
53 | } | 54 | } |
54 | 55 | ||
55 | 56 | ||
56 | void PanPopup::slotConnectAndConfig() { | 57 | void PanPopup::slotConnectAndConfig() { |
57 | slotConnect(); | 58 | slotConnect(); |
58 | 59 | ||
59 | // more intelligence here later like passing the device ( bnepX ) | 60 | // more intelligence here later like passing the device ( bnepX ) |
60 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 61 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
61 | e << QString( "networksettings" ); | 62 | e << QString( "networksettings" ); |
62 | 63 | ||
63 | } | 64 | } |