summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-26 22:30:46 (UTC)
committer harlekin <harlekin>2003-03-26 22:30:46 (UTC)
commita57325de7183c21df6b5ff06eff8cf7e3c328ef4 (patch) (unidiff)
tree8724c094150cf0e977c54afa5c41a7e8da964e55
parentc6e22820a2c28eb8a8f6bab690a36c3fa2605387 (diff)
downloadopie-a57325de7183c21df6b5ff06eff8cf7e3c328ef4.zip
opie-a57325de7183c21df6b5ff06eff8cf7e3c328ef4.tar.gz
opie-a57325de7183c21df6b5ff06eff8cf7e3c328ef4.tar.bz2
ups
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/startdunconnection.cpp67
-rw-r--r--noncore/net/opietooth/lib/startdunconnection.h40
-rw-r--r--noncore/net/opietooth/manager/dunpopup.cpp63
-rw-r--r--noncore/net/opietooth/manager/dunpopup.h33
4 files changed, 203 insertions, 0 deletions
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp
new file mode 100644
index 0000000..6b6d247
--- a/dev/null
+++ b/noncore/net/opietooth/lib/startdunconnection.cpp
@@ -0,0 +1,67 @@
1
2#include "startdunconnection.h"
3
4using namespace OpieTooth;
5
6
7StartDunConnection::StartDunConnection() {
8 m_dunConnect = 0l;
9 setConnectionType();
10}
11
12StartDunConnection::~StartDunConnection() {
13 delete m_dunConnect;
14}
15
16StartDunConnection::StartDunConnection( QString mac ) {
17 m_dunConnect = 0l;
18 m_mac = mac;
19 setConnectionType();
20}
21
22void StartDunConnection::setName( QString name ) {
23 m_name = name;
24}
25
26QString StartDunConnection::name() {
27 return m_name;
28}
29
30void StartDunConnection::setConnectionType() {
31 m_connectionType = Pan;
32}
33
34StartConnection::ConnectionType StartDunConnection::type() {
35 return m_connectionType;
36}
37
38void StartDunConnection::start() {
39 m_dunConnect = new OProcess();
40 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
41
42 connect( m_dunConnect, SIGNAL( processExited( OProcess* ) ) ,
43 this, SLOT( slotExited( OProcess* ) ) );
44 connect( m_dunConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ),
45 this, SLOT( slotStdOut( OProcess*, char*, int ) ) );
46 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
47 qWarning( "could not start" );
48 delete m_dunConnect;
49 }
50}
51
52
53void StartDunConnection::slotExited( OProcess* proc ) {
54 delete m_dunConnect;
55}
56
57void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
58{}
59
60
61void StartDunConnection::stop() {
62 if ( m_dunConnect ) {
63 delete m_dunConnect;
64 m_dunConnect = 0l;
65 }
66}
67
diff --git a/noncore/net/opietooth/lib/startdunconnection.h b/noncore/net/opietooth/lib/startdunconnection.h
new file mode 100644
index 0000000..43a852a
--- a/dev/null
+++ b/noncore/net/opietooth/lib/startdunconnection.h
@@ -0,0 +1,40 @@
1#ifndef startdunconnection_h
2#define startdunconnection_h
3
4#include <qobject.h>
5#include "connection.h"
6#include <opie/oprocess.h>
7
8namespace OpieTooth {
9
10 class StartDunConnection : StartConnection {
11
12 Q_OBJECT
13
14 public:
15 StartDunConnection();
16 StartDunConnection( QString mac );
17 ~StartDunConnection();
18
19 QString name();
20 void setName( QString name );
21 StartConnection::ConnectionType type();
22 void setConnectionType( );
23 void start();
24 void stop();
25
26 private:
27 QString m_name;
28 QString m_mac;
29 ConnectionType m_connectionType;
30 OProcess* m_dunConnect;
31
32 private slots:
33 void slotExited( OProcess* proc );
34 void slotStdOut( OProcess* proc, char* chars, int len );
35 };
36
37
38}
39
40#endif
diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp
new file mode 100644
index 0000000..3043f71
--- a/dev/null
+++ b/noncore/net/opietooth/manager/dunpopup.cpp
@@ -0,0 +1,63 @@
1#include <qpe/qcopenvelope_qws.h>
2
3#include <qtimer.h>
4
5#include "dunpopup.h"
6
7using namespace OpieTooth;
8
9/*
10 * c'tor init the QAction
11 */
12DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13
14 qWarning("DunPopup c'tor");
15
16 m_item = item;
17 QAction *a, *b, *c;
18
19 m_dunconnection = 0l;
20 /* connect action */
21
22
23 a = new QAction(); // so it's get deleted
24 a->setText( tr("connect") );
25 a->addTo( this );
26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
27
28
29 b = new QAction();
30 b->setText( tr( "connect+conf" ) );
31 b->addTo( this );
32 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
33
34 c = new QAction();
35 c->setText( tr( "disconnect" ) );
36 c->addTo( this );
37 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
38
39};
40
41DunPopup::~DunPopup() {
42
43}
44
45void DunPopup::slotConnect() {
46
47 m_dunconnection = new StartDunConnection( m_item->mac() );
48 m_dunconnection->start();
49}
50
51void DunPopup::slotDisconnect() {
52 m_dunconnection->stop();
53}
54
55
56void DunPopup::slotConnectAndConfig() {
57 slotConnect();
58
59 // more intelligence here later like passing the device ( bnepX )
60 QCopEnvelope e( "QPE/System", "execute(QString)" );
61 e << QString( "networksettings" );
62
63}
diff --git a/noncore/net/opietooth/manager/dunpopup.h b/noncore/net/opietooth/manager/dunpopup.h
new file mode 100644
index 0000000..c070c56
--- a/dev/null
+++ b/noncore/net/opietooth/manager/dunpopup.h
@@ -0,0 +1,33 @@
1#ifndef DUNPOPUP_H
2#define DUNPOPUP_H
3
4#include <qpopupmenu.h>
5#include <qaction.h>
6
7#include <startdunconnection.h>
8
9#include "btdeviceitem.h"
10
11
12namespace OpieTooth {
13
14 class DunPopup : public QPopupMenu {
15
16 Q_OBJECT
17
18 public:
19 DunPopup( OpieTooth::BTDeviceItem* );
20 ~DunPopup();
21
22 private:
23 QAction* m_push;
24 OpieTooth::StartDunConnection* m_dunconnection;
25 OpieTooth::BTDeviceItem *m_item;
26 private slots:
27 void slotConnect();
28 void slotDisconnect();
29 void slotConnectAndConfig();
30 };
31};
32
33#endif