summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-26 22:30:46 (UTC)
committer harlekin <harlekin>2003-03-26 22:30:46 (UTC)
commita57325de7183c21df6b5ff06eff8cf7e3c328ef4 (patch) (side-by-side diff)
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 @@
+
+#include "startdunconnection.h"
+
+using namespace OpieTooth;
+
+
+StartDunConnection::StartDunConnection() {
+ m_dunConnect = 0l;
+ setConnectionType();
+}
+
+StartDunConnection::~StartDunConnection() {
+ delete m_dunConnect;
+}
+
+StartDunConnection::StartDunConnection( QString mac ) {
+ m_dunConnect = 0l;
+ m_mac = mac;
+ setConnectionType();
+}
+
+void StartDunConnection::setName( QString name ) {
+ m_name = name;
+}
+
+QString StartDunConnection::name() {
+ return m_name;
+}
+
+void StartDunConnection::setConnectionType() {
+ m_connectionType = Pan;
+}
+
+StartConnection::ConnectionType StartDunConnection::type() {
+ return m_connectionType;
+}
+
+void StartDunConnection::start() {
+ m_dunConnect = new OProcess();
+ *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
+
+ connect( m_dunConnect, SIGNAL( processExited( OProcess* ) ) ,
+ this, SLOT( slotExited( OProcess* ) ) );
+ connect( m_dunConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ),
+ this, SLOT( slotStdOut( OProcess*, char*, int ) ) );
+ if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
+ qWarning( "could not start" );
+ delete m_dunConnect;
+ }
+}
+
+
+void StartDunConnection::slotExited( OProcess* proc ) {
+ delete m_dunConnect;
+}
+
+void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
+{}
+
+
+void StartDunConnection::stop() {
+ if ( m_dunConnect ) {
+ delete m_dunConnect;
+ m_dunConnect = 0l;
+ }
+}
+
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 @@
+#ifndef startdunconnection_h
+#define startdunconnection_h
+
+#include <qobject.h>
+#include "connection.h"
+#include <opie/oprocess.h>
+
+namespace OpieTooth {
+
+ class StartDunConnection : StartConnection {
+
+ Q_OBJECT
+
+ public:
+ StartDunConnection();
+ StartDunConnection( QString mac );
+ ~StartDunConnection();
+
+ QString name();
+ void setName( QString name );
+ StartConnection::ConnectionType type();
+ void setConnectionType( );
+ void start();
+ void stop();
+
+ private:
+ QString m_name;
+ QString m_mac;
+ ConnectionType m_connectionType;
+ OProcess* m_dunConnect;
+
+ private slots:
+ void slotExited( OProcess* proc );
+ void slotStdOut( OProcess* proc, char* chars, int len );
+ };
+
+
+}
+
+#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 @@
+#include <qpe/qcopenvelope_qws.h>
+
+#include <qtimer.h>
+
+#include "dunpopup.h"
+
+using namespace OpieTooth;
+
+/*
+ * c'tor init the QAction
+ */
+DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
+
+ qWarning("DunPopup c'tor");
+
+ m_item = item;
+ QAction *a, *b, *c;
+
+ m_dunconnection = 0l;
+ /* connect action */
+
+
+ a = new QAction(); // so it's get deleted
+ a->setText( tr("connect") );
+ a->addTo( this );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
+
+
+ b = new QAction();
+ b->setText( tr( "connect+conf" ) );
+ b->addTo( this );
+ connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
+
+ c = new QAction();
+ c->setText( tr( "disconnect" ) );
+ c->addTo( this );
+ connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
+
+};
+
+DunPopup::~DunPopup() {
+
+}
+
+void DunPopup::slotConnect() {
+
+ m_dunconnection = new StartDunConnection( m_item->mac() );
+ m_dunconnection->start();
+}
+
+void DunPopup::slotDisconnect() {
+ m_dunconnection->stop();
+}
+
+
+void DunPopup::slotConnectAndConfig() {
+ slotConnect();
+
+ // more intelligence here later like passing the device ( bnepX )
+ QCopEnvelope e( "QPE/System", "execute(QString)" );
+ e << QString( "networksettings" );
+
+}
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 @@
+#ifndef DUNPOPUP_H
+#define DUNPOPUP_H
+
+#include <qpopupmenu.h>
+#include <qaction.h>
+
+#include <startdunconnection.h>
+
+#include "btdeviceitem.h"
+
+
+namespace OpieTooth {
+
+ class DunPopup : public QPopupMenu {
+
+ Q_OBJECT
+
+ public:
+ DunPopup( OpieTooth::BTDeviceItem* );
+ ~DunPopup();
+
+ private:
+ QAction* m_push;
+ OpieTooth::StartDunConnection* m_dunconnection;
+ OpieTooth::BTDeviceItem *m_item;
+ private slots:
+ void slotConnect();
+ void slotDisconnect();
+ void slotConnectAndConfig();
+ };
+};
+
+#endif