summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/rfcpopup.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/manager/rfcpopup.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp44
1 files changed, 30 insertions, 14 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 @@
#include <opie2/odebug.h>
+#include <opie2/oprocess.h>
+
using namespace Opie::Core;
@@ -18,4 +20,5 @@ using namespace OpieTooth;
*/
-RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
- : QPopupMenu()
+RfcCommPopup::RfcCommPopup(const OpieTooth::Services& service,
+ OpieTooth::BTDeviceItem* item)
+ : QPopupMenu(), m_service(service)
{
@@ -24,14 +27,13 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
QAction* a;
+ int port = service.protocolDescriptorList().last().port();
+ QString mac = item->mac();
+ unsigned int i;
-
+ procId = -1;
m_item = item;
- /* connect action */
- a = new QAction( ); // so it's get deleted
- a->setText("Connect");
- a->addTo( this );
- connect( a, SIGNAL( activated() ),
- this, SLOT( slotConnect() ) );
-
-
+ for (i = 0; i < sizeof(PPPDialog::conns) / sizeof(Connection); i++) {
+ if (PPPDialog::conns[i].port == port &&
+ PPPDialog::conns[i].btAddr == mac &&
+ PPPDialog::conns[i].proc.isRunning()) {
/* disconnect action */
@@ -42,3 +44,14 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
this, SLOT( slotDisconnect() ) );
-
+ procId = i;
+ break;
+ }
+ }
+ if (procId == -1) {
+ /* connect action */
+ a = new QAction( ); // so it's get deleted
+ a->setText("Connect");
+ a->addTo( this );
+ connect( a, SIGNAL( activated() ),
+ this, SLOT( slotConnect() ) );
+ }
@@ -76,3 +89,4 @@ void RfcCommPopup::slotConnect()
- PPPDialog pppDialog;
+ PPPDialog pppDialog(m_item->mac(),
+ m_service.protocolDescriptorList().last().port());
QPEApplication::execDialog( &pppDialog );
@@ -83,3 +97,5 @@ void RfcCommPopup::slotDisconnect()
{
- owarn << "slot disconnected" << oendl;
+ owarn << "slot disconnected " << procId << oendl;
+ if (procId >= 0)
+ PPPDialog::conns[procId].proc.kill();
}