Diffstat (limited to 'noncore/net/opietooth/manager/dunpopup.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/dunpopup.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp index 10505a9..3017d63 100644 --- a/noncore/net/opietooth/manager/dunpopup.cpp +++ b/noncore/net/opietooth/manager/dunpopup.cpp @@ -1,9 +1,11 @@ #include <qpe/qcopenvelope_qws.h> - -#include <qtimer.h> +#include <qmessagebox.h> #include <opie2/odebug.h> +#include <opie2/oprocess.h> +#include <qpe/qpeapplication.h> using namespace Opie::Core; #include "dunpopup.h" +#include "dundialog.h" using namespace OpieTooth; @@ -12,5 +14,6 @@ using namespace OpieTooth; * c'tor init the QAction */ -DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { +DunPopup::DunPopup( const Services& service, + BTDeviceItem* item ) : QPopupMenu(), m_service(service) { owarn << "DunPopup c'tor" << oendl; @@ -19,8 +22,4 @@ DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { QAction *a, *b, *c; - m_dunconnection = 0l; - /* connect action */ - - a = new QAction(); // so it's get deleted a->setText( tr("connect") ); @@ -28,5 +27,4 @@ DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); - b = new QAction(); b->setText( tr( "connect+conf" ) ); @@ -46,11 +44,19 @@ DunPopup::~DunPopup() { void DunPopup::slotConnect() { - - m_dunconnection = new StartDunConnection( m_item->mac() ); - m_dunconnection->start(); + odebug << "connect" << oendl; + DunDialog dundlg(m_item->mac(), + m_service.protocolDescriptorList().last().port()); + QPEApplication::execDialog( &dundlg ); } void DunPopup::slotDisconnect() { - m_dunconnection->stop(); + OProcess dunDis; + OProcess pppDis; + dunDis << tr("dund") << tr("--kill") << m_item->mac(); + dunDis.start(OProcess::DontCare, OProcess::NoCommunication); + pppDis << tr("killall") << tr("-q") << tr("pppd"); + pppDis.start(OProcess::DontCare, OProcess::NoCommunication); + sleep(1); + QMessageBox::information(this, tr("DUN Disconnect"), tr("DUN Disconnected")); } @@ -62,4 +68,3 @@ void DunPopup::slotConnectAndConfig() { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( "networksettings" ); - } |