summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp44
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.h7
2 files changed, 34 insertions, 17 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
@@ -7,4 +7,6 @@
#include <qpe/qpeapplication.h>
#include <opie2/odebug.h>
+#include <opie2/oprocess.h>
+
using namespace Opie::Core;
@@ -17,22 +19,22 @@ using namespace OpieTooth;
* c'tor init the QAction
*/
-RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
- : QPopupMenu()
+RfcCommPopup::RfcCommPopup(const OpieTooth::Services& service,
+ OpieTooth::BTDeviceItem* item)
+ : QPopupMenu(), m_service(service)
{
owarn << "RfcCommPopup c'tor" << oendl;
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 */
a = new QAction( );
@@ -41,5 +43,16 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
connect( a, SIGNAL( activated() ) ,
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() ) );
+ }
/* foo action */
@@ -75,5 +88,6 @@ void RfcCommPopup::slotConnect()
owarn << "connect" << oendl;
- PPPDialog pppDialog;
+ PPPDialog pppDialog(m_item->mac(),
+ m_service.protocolDescriptorList().last().port());
QPEApplication::execDialog( &pppDialog );
}
@@ -82,5 +96,7 @@ void RfcCommPopup::slotConnect()
void RfcCommPopup::slotDisconnect()
{
- owarn << "slot disconnected" << oendl;
+ owarn << "slot disconnected " << procId << oendl;
+ if (procId >= 0)
+ PPPDialog::conns[procId].proc.kill();
}
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
@@ -4,5 +4,5 @@
#include <qpopupmenu.h>
#include <qaction.h>
-
+#include <services.h>
#include "btdeviceitem.h"
@@ -19,8 +19,7 @@ namespace OpieTooth {
Q_OBJECT
public:
- RfcCommPopup( OpieTooth::BTDeviceItem* );
+ RfcCommPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem*);
~RfcCommPopup();
-
private:
QAction* m_con;
@@ -29,4 +28,6 @@ namespace OpieTooth {
QAction* m_bar;
OpieTooth::BTDeviceItem *m_item;
+ Services m_service;
+ int procId; //Connection process number
private slots:
void slotConnect();