author | harlekin <harlekin> | 2003-02-15 22:21:14 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-02-15 22:21:14 (UTC) |
commit | f8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f (patch) (side-by-side diff) | |
tree | ab71630af2332c9ca9e9a537711b6e0d09614f9b /noncore/net/opietooth/manager/panpopup.cpp | |
parent | 10b6cb1e9262b174ec0d8dc095d9f668f2d3e094 (diff) | |
download | opie-f8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f.zip opie-f8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f.tar.gz opie-f8bb789cd1d85da9b4a830b5b8a67a6a4ceeee3f.tar.bz2 |
hacked together pan support, just for my own convenience, the core func should be moved into libopietooth later
Diffstat (limited to 'noncore/net/opietooth/manager/panpopup.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/panpopup.cpp | 70 |
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 @@ +#include <qpe/qcopenvelope_qws.h> + +#include <qtimer.h> + +#include "panpopup.h" + +using namespace OpieTooth; + +/* + * c'tor init the QAction + */ +PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { + + qWarning("PanPopup c'tor"); + + m_item = item; + m_panconnect = 0l; + QAction *a, *b; + + /* connect action */ + a = new QAction( ); // so it's get deleted + a->setText( "connect" ); + a->addTo( this ); + connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); + + b = new QAction(); + b->setText( "connect+conf" ); + b->addTo( this ); + connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); +}; + +PanPopup::~PanPopup() { + delete m_panconnect; +} + +void PanPopup::slotConnect() { + + + // SHOULD move to lib + // before pand must be in "pand --listen --role panu" mode ( client ) + + m_panconnect = new OProcess(); + *m_panconnect << "pand" << "--connect" << m_item->mac(); + + connect( m_panconnect, SIGNAL( processExited( OProcess* ) ) , + this, SLOT( slotConnectExited( OProcess* ) ) ); + connect( m_panconnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), + this, SLOT( slotConnectOut( OProcess*, char*, int ) ) ); + if (!m_panconnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { + qWarning( "could not start" ); + delete m_panconnect; + } +} + +void PanPopup::slotExited( OProcess* proc ) { + delete m_panconnect; +} + +void PanPopup::slotStdOut(OProcess* proc, char* chars, int len) +{} + + +void PanPopup::slotConnectAndConfig() { + slotConnect(); + + // more intelligence here later like passing the device ( bnepX ) + QCopEnvelope e( "QPE/System", "execute(QString)" ); + e << QString( "networksetup" ); + +} |