author | korovkin <korovkin> | 2006-04-03 04:12:19 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-04-03 04:12:19 (UTC) |
commit | 430017b047c885ba4dfd9f4074f4e4ab130d5709 (patch) (unidiff) | |
tree | ed883831f88038163285800ee2d8cc2fbb4faf86 /noncore/net/opietooth/manager/dunpopup.cpp | |
parent | 812083469c80a0a07ad1ba41d6795e05f950710b (diff) | |
download | opie-430017b047c885ba4dfd9f4074f4e4ab130d5709.zip opie-430017b047c885ba4dfd9f4074f4e4ab130d5709.tar.gz opie-430017b047c885ba4dfd9f4074f4e4ab130d5709.tar.bz2 |
Added dialog boxes for PAN and DUN connections.
Added message boxes in order to confirm DUN and PAN disconnections.
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,36 +1,34 @@ | |||
1 | #include <qpe/qcopenvelope_qws.h> | 1 | #include <qpe/qcopenvelope_qws.h> |
2 | 2 | #include <qmessagebox.h> | |
3 | #include <qtimer.h> | ||
4 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <opie2/oprocess.h> | ||
5 | #include <qpe/qpeapplication.h> | ||
5 | using namespace Opie::Core; | 6 | using namespace Opie::Core; |
6 | 7 | ||
7 | #include "dunpopup.h" | 8 | #include "dunpopup.h" |
9 | #include "dundialog.h" | ||
8 | 10 | ||
9 | using namespace OpieTooth; | 11 | using namespace OpieTooth; |
10 | 12 | ||
11 | /* | 13 | /* |
12 | * c'tor init the QAction | 14 | * c'tor init the QAction |
13 | */ | 15 | */ |
14 | DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | 16 | DunPopup::DunPopup( const Services& service, |
17 | BTDeviceItem* item ) : QPopupMenu(), m_service(service) { | ||
15 | 18 | ||
16 | owarn << "DunPopup c'tor" << oendl; | 19 | owarn << "DunPopup c'tor" << oendl; |
17 | 20 | ||
18 | m_item = item; | 21 | m_item = item; |
19 | QAction *a, *b, *c; | 22 | QAction *a, *b, *c; |
20 | 23 | ||
21 | m_dunconnection = 0l; | ||
22 | /* connect action */ | ||
23 | |||
24 | |||
25 | a = new QAction(); // so it's get deleted | 24 | a = new QAction(); // so it's get deleted |
26 | a->setText( tr("connect") ); | 25 | a->setText( tr("connect") ); |
27 | a->addTo( this ); | 26 | a->addTo( this ); |
28 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); | 27 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); |
29 | 28 | ||
30 | |||
31 | b = new QAction(); | 29 | b = new QAction(); |
32 | b->setText( tr( "connect+conf" ) ); | 30 | b->setText( tr( "connect+conf" ) ); |
33 | b->addTo( this ); | 31 | b->addTo( this ); |
34 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); | 32 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); |
35 | 33 | ||
36 | c = new QAction(); | 34 | c = new QAction(); |
@@ -42,24 +40,31 @@ DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | |||
42 | 40 | ||
43 | DunPopup::~DunPopup() { | 41 | DunPopup::~DunPopup() { |
44 | 42 | ||
45 | } | 43 | } |
46 | 44 | ||
47 | void DunPopup::slotConnect() { | 45 | void DunPopup::slotConnect() { |
48 | 46 | odebug << "connect" << oendl; | |
49 | m_dunconnection = new StartDunConnection( m_item->mac() ); | 47 | DunDialog dundlg(m_item->mac(), |
50 | m_dunconnection->start(); | 48 | m_service.protocolDescriptorList().last().port()); |
49 | QPEApplication::execDialog( &dundlg ); | ||
51 | } | 50 | } |
52 | 51 | ||
53 | void DunPopup::slotDisconnect() { | 52 | void DunPopup::slotDisconnect() { |
54 | m_dunconnection->stop(); | 53 | OProcess dunDis; |
54 | OProcess pppDis; | ||
55 | dunDis << tr("dund") << tr("--kill") << m_item->mac(); | ||
56 | dunDis.start(OProcess::DontCare, OProcess::NoCommunication); | ||
57 | pppDis << tr("killall") << tr("-q") << tr("pppd"); | ||
58 | pppDis.start(OProcess::DontCare, OProcess::NoCommunication); | ||
59 | sleep(1); | ||
60 | QMessageBox::information(this, tr("DUN Disconnect"), tr("DUN Disconnected")); | ||
55 | } | 61 | } |
56 | 62 | ||
57 | 63 | ||
58 | void DunPopup::slotConnectAndConfig() { | 64 | void DunPopup::slotConnectAndConfig() { |
59 | slotConnect(); | 65 | slotConnect(); |
60 | 66 | ||
61 | // more intelligence here later like passing the device ( bnepX ) | 67 | // more intelligence here later like passing the device ( bnepX ) |
62 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 68 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
63 | e << QString( "networksettings" ); | 69 | e << QString( "networksettings" ); |
64 | |||
65 | } | 70 | } |