-rw-r--r-- | noncore/net/opietooth/manager/rfcpopup.cpp | 56 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/rfcpopup.h | 9 |
2 files changed, 41 insertions, 24 deletions
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index 54f1eb7..7711f0a 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp | |||
@@ -8,2 +8,4 @@ | |||
8 | #include <opie2/odebug.h> | 8 | #include <opie2/odebug.h> |
9 | #include <opie2/oprocess.h> | ||
10 | |||
9 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
@@ -18,4 +20,5 @@ using namespace OpieTooth; | |||
18 | */ | 20 | */ |
19 | RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) | 21 | RfcCommPopup::RfcCommPopup(const OpieTooth::Services& service, |
20 | : QPopupMenu() | 22 | OpieTooth::BTDeviceItem* item) |
23 | : QPopupMenu(), m_service(service) | ||
21 | { | 24 | { |
@@ -24,21 +27,31 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) | |||
24 | QAction* a; | 27 | QAction* a; |
28 | int port = service.protocolDescriptorList().last().port(); | ||
29 | QString mac = item->mac(); | ||
30 | unsigned int i; | ||
25 | 31 | ||
26 | 32 | procId = -1; | |
27 | m_item = item; | 33 | m_item = item; |
28 | 34 | ||
29 | /* connect action */ | 35 | for (i = 0; i < sizeof(PPPDialog::conns) / sizeof(Connection); i++) { |
30 | a = new QAction( ); // so it's get deleted | 36 | if (PPPDialog::conns[i].port == port && |
31 | a->setText("Connect"); | 37 | PPPDialog::conns[i].btAddr == mac && |
32 | a->addTo( this ); | 38 | PPPDialog::conns[i].proc.isRunning()) { |
33 | connect( a, SIGNAL( activated() ), | 39 | /* disconnect action */ |
34 | this, SLOT( slotConnect() ) ); | 40 | a = new QAction( ); |
35 | 41 | a->setText("Disconnect"); | |
36 | 42 | a->addTo( this ); | |
37 | /* disconnect action */ | 43 | connect( a, SIGNAL( activated() ) , |
38 | a = new QAction( ); | 44 | this, SLOT( slotDisconnect() ) ); |
39 | a->setText("Disconnect"); | 45 | procId = i; |
40 | a->addTo( this ); | 46 | break; |
41 | connect( a, SIGNAL( activated() ) , | 47 | } |
42 | this, SLOT( slotDisconnect() ) ); | 48 | } |
43 | 49 | if (procId == -1) { | |
50 | /* connect action */ | ||
51 | a = new QAction( ); // so it's get deleted | ||
52 | a->setText("Connect"); | ||
53 | a->addTo( this ); | ||
54 | connect( a, SIGNAL( activated() ), | ||
55 | this, SLOT( slotConnect() ) ); | ||
56 | } | ||
44 | 57 | ||
@@ -76,3 +89,4 @@ void RfcCommPopup::slotConnect() | |||
76 | 89 | ||
77 | PPPDialog pppDialog; | 90 | PPPDialog pppDialog(m_item->mac(), |
91 | m_service.protocolDescriptorList().last().port()); | ||
78 | QPEApplication::execDialog( &pppDialog ); | 92 | QPEApplication::execDialog( &pppDialog ); |
@@ -83,3 +97,5 @@ void RfcCommPopup::slotDisconnect() | |||
83 | { | 97 | { |
84 | owarn << "slot disconnected" << oendl; | 98 | owarn << "slot disconnected " << procId << oendl; |
99 | if (procId >= 0) | ||
100 | PPPDialog::conns[procId].proc.kill(); | ||
85 | } | 101 | } |
diff --git a/noncore/net/opietooth/manager/rfcpopup.h b/noncore/net/opietooth/manager/rfcpopup.h index 74b9117..a67e41e 100644 --- a/noncore/net/opietooth/manager/rfcpopup.h +++ b/noncore/net/opietooth/manager/rfcpopup.h | |||
@@ -5,3 +5,3 @@ | |||
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | 6 | #include <services.h> | |
7 | #include "btdeviceitem.h" | 7 | #include "btdeviceitem.h" |
@@ -20,6 +20,5 @@ namespace OpieTooth { | |||
20 | public: | 20 | public: |
21 | RfcCommPopup( OpieTooth::BTDeviceItem* ); | 21 | RfcCommPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem*); |
22 | ~RfcCommPopup(); | 22 | ~RfcCommPopup(); |
23 | 23 | ||
24 | |||
25 | private: | 24 | private: |
@@ -29,3 +28,5 @@ namespace OpieTooth { | |||
29 | QAction* m_bar; | 28 | QAction* m_bar; |
30 | OpieTooth::BTDeviceItem *m_item; | 29 | OpieTooth::BTDeviceItem *m_item; |
30 | Services m_service; | ||
31 | int procId; //Connection process number | ||
31 | private slots: | 32 | private slots: |