summaryrefslogtreecommitdiff
authorkorovkin <korovkin>2006-04-04 12:15:10 (UTC)
committer korovkin <korovkin>2006-04-04 12:15:10 (UTC)
commit57f97a65fc7ce932231585895f358f1089900879 (patch) (unidiff)
tree026f02a04d8f78da60fef452f07ee1a0282d113e
parent70c7420d074505c75a5482e3e71be2e403df7b62 (diff)
downloadopie-57f97a65fc7ce932231585895f358f1089900879.zip
opie-57f97a65fc7ce932231585895f358f1089900879.tar.gz
opie-57f97a65fc7ce932231585895f358f1089900879.tar.bz2
Added headers.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/dundialog.cpp11
-rw-r--r--noncore/net/opietooth/manager/dundialog.h10
-rw-r--r--noncore/net/opietooth/manager/dunpopup.cpp10
-rw-r--r--noncore/net/opietooth/manager/dunpopup.h10
-rw-r--r--noncore/net/opietooth/manager/pandialog.cpp11
-rw-r--r--noncore/net/opietooth/manager/pandialog.h10
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp10
-rw-r--r--noncore/net/opietooth/manager/panpopup.h10
8 files changed, 80 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/dundialog.cpp b/noncore/net/opietooth/manager/dundialog.cpp
index 033534c..7aac271 100644
--- a/noncore/net/opietooth/manager/dundialog.cpp
+++ b/noncore/net/opietooth/manager/dundialog.cpp
@@ -1,131 +1,140 @@
1 1/* $Id$ */
2/* DUN connection dialog */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
2#include "dundialog.h" 11#include "dundialog.h"
3#include <qpushbutton.h> 12#include <qpushbutton.h>
4#include <qmultilineedit.h> 13#include <qmultilineedit.h>
5#include <qlineedit.h> 14#include <qlineedit.h>
6#include <qlayout.h> 15#include <qlayout.h>
7#include <qcheckbox.h> 16#include <qcheckbox.h>
8#include <qlabel.h> 17#include <qlabel.h>
9#include <qstring.h> 18#include <qstring.h>
10#include <opie2/oprocess.h> 19#include <opie2/oprocess.h>
11#include <opie2/odebug.h> 20#include <opie2/odebug.h>
12using namespace Opie::Core; 21using namespace Opie::Core;
13 22
14using namespace OpieTooth; 23using namespace OpieTooth;
15 24
16using namespace Opie::Core; 25using namespace Opie::Core;
17 26
18DunDialog::DunDialog( const QString& device, int port, QWidget* parent, 27DunDialog::DunDialog( const QString& device, int port, QWidget* parent,
19 const char* name, bool modal, WFlags fl ) 28 const char* name, bool modal, WFlags fl )
20 : QDialog( parent, name, modal, fl ) { 29 : QDialog( parent, name, modal, fl ) {
21 if ( !name ) 30 if ( !name )
22 setName( "DUNDialog" ); 31 setName( "DUNDialog" );
23 setCaption( tr( "DUN connection " ) ) ; 32 setCaption( tr( "DUN connection " ) ) ;
24 33
25 m_device = device; 34 m_device = device;
26 m_port = port; 35 m_port = port;
27 36
28 m_dunConnect = NULL; 37 m_dunConnect = NULL;
29 layout = new QVBoxLayout( this ); 38 layout = new QVBoxLayout( this );
30 39
31 QLabel* info = new QLabel( this ); 40 QLabel* info = new QLabel( this );
32 info->setText( tr("Enter an ppp script name:") ); 41 info->setText( tr("Enter an ppp script name:") );
33 42
34 cmdLine = new QLineEdit( this ); 43 cmdLine = new QLineEdit( this );
35 44
36 outPut = new QMultiLineEdit( this ); 45 outPut = new QMultiLineEdit( this );
37 QFont outPut_font( outPut->font() ); 46 QFont outPut_font( outPut->font() );
38 outPut_font.setPointSize( 8 ); 47 outPut_font.setPointSize( 8 );
39 outPut->setFont( outPut_font ); 48 outPut->setFont( outPut_font );
40 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 49 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
41 50
42 connectButton = new QPushButton( this ); 51 connectButton = new QPushButton( this );
43 connectButton->setText( tr( "Connect" ) ); 52 connectButton->setText( tr( "Connect" ) );
44 53
45 doEncryption = new QCheckBox(this, "encrypt"); 54 doEncryption = new QCheckBox(this, "encrypt");
46 doEncryption->setText( tr( "encrypt" ) ); 55 doEncryption->setText( tr( "encrypt" ) );
47 56
48 layout->addWidget(info); 57 layout->addWidget(info);
49 layout->addWidget(cmdLine); 58 layout->addWidget(cmdLine);
50 layout->addWidget(doEncryption); 59 layout->addWidget(doEncryption);
51 layout->addWidget(outPut); 60 layout->addWidget(outPut);
52 layout->addWidget(connectButton); 61 layout->addWidget(connectButton);
53 62
54 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 63 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
55} 64}
56 65
57DunDialog::~DunDialog() { 66DunDialog::~DunDialog() {
58} 67}
59 68
60void DunDialog::connectToDevice() { 69void DunDialog::connectToDevice() {
61 bool doEnc = doEncryption->isChecked(); 70 bool doEnc = doEncryption->isChecked();
62 if (cmdLine->text() == "") 71 if (cmdLine->text() == "")
63 return; 72 return;
64 if (m_dunConnect) { 73 if (m_dunConnect) {
65 outPut->append(tr("Work in progress")); 74 outPut->append(tr("Work in progress"));
66 return; 75 return;
67 } 76 }
68 m_dunConnect = new OProcess(); 77 m_dunConnect = new OProcess();
69 outPut->clear(); 78 outPut->clear();
70 79
71 // Fill process command line 80 // Fill process command line
72 *m_dunConnect << tr("dund") 81 *m_dunConnect << tr("dund")
73 << tr("--connect") << m_device 82 << tr("--connect") << m_device
74 << tr("--channel") << QString::number(m_port) 83 << tr("--channel") << QString::number(m_port)
75 << tr("--nodetach"); 84 << tr("--nodetach");
76 if (doEnc) 85 if (doEnc)
77 *m_dunConnect << tr("--encrypt"); 86 *m_dunConnect << tr("--encrypt");
78 *m_dunConnect << tr("call") 87 *m_dunConnect << tr("call")
79 << cmdLine->text(); 88 << cmdLine->text();
80 if (!m_dunConnect->start(OProcess::NotifyOnExit, 89 if (!m_dunConnect->start(OProcess::NotifyOnExit,
81 OProcess::All)) { 90 OProcess::All)) {
82 outPut->append(tr("Couldn't start")); 91 outPut->append(tr("Couldn't start"));
83 delete m_dunConnect; 92 delete m_dunConnect;
84 m_dunConnect = NULL; 93 m_dunConnect = NULL;
85 } 94 }
86 else 95 else
87 { 96 {
88 m_dunConnect->resume(); 97 m_dunConnect->resume();
89 outPut->append(tr("Started")); 98 outPut->append(tr("Started"));
90 connect(m_dunConnect, 99 connect(m_dunConnect,
91 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), 100 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
92 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int))); 101 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
93 connect(m_dunConnect, 102 connect(m_dunConnect,
94 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), 103 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
95 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int))); 104 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
96 connect(m_dunConnect, 105 connect(m_dunConnect,
97 SIGNAL(processExited(Opie::Core::OProcess*)), 106 SIGNAL(processExited(Opie::Core::OProcess*)),
98 this, SLOT(slotProcessExited(Opie::Core::OProcess*))); 107 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
99 } 108 }
100} 109}
101 110
102void DunDialog::fillOutPut( OProcess*, char* cha, int len ) { 111void DunDialog::fillOutPut( OProcess*, char* cha, int len ) {
103 QCString str(cha, len); 112 QCString str(cha, len);
104 outPut->append(str); 113 outPut->append(str);
105} 114}
106 115
107void DunDialog::fillErr(OProcess*, char* buf, int len) 116void DunDialog::fillErr(OProcess*, char* buf, int len)
108{ 117{
109 QCString str(buf, len); 118 QCString str(buf, len);
110 outPut->append(str); 119 outPut->append(str);
111} 120}
112 121
113void DunDialog::slotProcessExited(OProcess* proc) { 122void DunDialog::slotProcessExited(OProcess* proc) {
114 if (m_dunConnect->normalExit()) { 123 if (m_dunConnect->normalExit()) {
115 outPut->append( tr("Finished with result ") ); 124 outPut->append( tr("Finished with result ") );
116 outPut->append( QString::number(proc->exitStatus()) ); 125 outPut->append( QString::number(proc->exitStatus()) );
117 } 126 }
118 else 127 else
119 outPut->append( tr("Exited abnormally") ); 128 outPut->append( tr("Exited abnormally") );
120 delete m_dunConnect; 129 delete m_dunConnect;
121 m_dunConnect = NULL; 130 m_dunConnect = NULL;
122} 131}
123 132
124void DunDialog::closeEvent(QCloseEvent* e) 133void DunDialog::closeEvent(QCloseEvent* e)
125{ 134{
126 if (m_dunConnect && m_dunConnect->isRunning()) 135 if (m_dunConnect && m_dunConnect->isRunning())
127 m_dunConnect->kill(); 136 m_dunConnect->kill();
128 QDialog::closeEvent(e); 137 QDialog::closeEvent(e);
129} 138}
130 139
131//eof 140//eof
diff --git a/noncore/net/opietooth/manager/dundialog.h b/noncore/net/opietooth/manager/dundialog.h
index 746c8a3..9e219cd 100644
--- a/noncore/net/opietooth/manager/dundialog.h
+++ b/noncore/net/opietooth/manager/dundialog.h
@@ -1,42 +1,52 @@
1/* $Id$ */
2/* DUN connection dialog */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1#ifndef DUNDIALOG_H 11#ifndef DUNDIALOG_H
2#define DUNDIALOG_H 12#define DUNDIALOG_H
3 13
4 14
5#include <qdialog.h> 15#include <qdialog.h>
6#include <opie2/oprocess.h> 16#include <opie2/oprocess.h>
7 17
8class QVBoxLayout; 18class QVBoxLayout;
9class QPushButton; 19class QPushButton;
10class QMultiLineEdit; 20class QMultiLineEdit;
11class QLineEdit; 21class QLineEdit;
12class QCheckBox; 22class QCheckBox;
13 23
14namespace OpieTooth { 24namespace OpieTooth {
15 class DunDialog : public QDialog { 25 class DunDialog : public QDialog {
16 26
17 Q_OBJECT 27 Q_OBJECT
18 28
19 public: 29 public:
20 DunDialog(const QString& device = 0, int port = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0); 30 DunDialog(const QString& device = 0, int port = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0);
21 ~DunDialog(); 31 ~DunDialog();
22 32
23 private slots: 33 private slots:
24 void connectToDevice(); 34 void connectToDevice();
25 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len ); 35 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
26 void fillErr(Opie::Core::OProcess*, char*, int); 36 void fillErr(Opie::Core::OProcess*, char*, int);
27 void slotProcessExited(Opie::Core::OProcess* proc); 37 void slotProcessExited(Opie::Core::OProcess* proc);
28 void closeEvent(QCloseEvent* e); 38 void closeEvent(QCloseEvent* e);
29 protected: 39 protected:
30 QVBoxLayout* layout; 40 QVBoxLayout* layout;
31 QLineEdit* cmdLine; 41 QLineEdit* cmdLine;
32 QPushButton* connectButton; 42 QPushButton* connectButton;
33 QMultiLineEdit* outPut; 43 QMultiLineEdit* outPut;
34 QCheckBox* doEncryption; 44 QCheckBox* doEncryption;
35 45
36 private: 46 private:
37 QString m_device; //device BT address 47 QString m_device; //device BT address
38 int m_port; //device process 48 int m_port; //device process
39 Opie::Core::OProcess* m_dunConnect; //DUN process 49 Opie::Core::OProcess* m_dunConnect; //DUN process
40 }; 50 };
41} 51}
42#endif 52#endif
diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp
index 3017d63..c304b2d 100644
--- a/noncore/net/opietooth/manager/dunpopup.cpp
+++ b/noncore/net/opietooth/manager/dunpopup.cpp
@@ -1,70 +1,80 @@
1/* $Id$ */
2/* DUN context menu */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1#include <qpe/qcopenvelope_qws.h> 11#include <qpe/qcopenvelope_qws.h>
2#include <qmessagebox.h> 12#include <qmessagebox.h>
3#include <opie2/odebug.h> 13#include <opie2/odebug.h>
4#include <opie2/oprocess.h> 14#include <opie2/oprocess.h>
5#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
6using namespace Opie::Core; 16using namespace Opie::Core;
7 17
8#include "dunpopup.h" 18#include "dunpopup.h"
9#include "dundialog.h" 19#include "dundialog.h"
10 20
11using namespace OpieTooth; 21using namespace OpieTooth;
12 22
13/* 23/*
14 * c'tor init the QAction 24 * c'tor init the QAction
15 */ 25 */
16DunPopup::DunPopup( const Services& service, 26DunPopup::DunPopup( const Services& service,
17 BTDeviceItem* item ) : QPopupMenu(), m_service(service) { 27 BTDeviceItem* item ) : QPopupMenu(), m_service(service) {
18 28
19 owarn << "DunPopup c'tor" << oendl; 29 owarn << "DunPopup c'tor" << oendl;
20 30
21 m_item = item; 31 m_item = item;
22 QAction *a, *b, *c; 32 QAction *a, *b, *c;
23 33
24 a = new QAction(); // so it's get deleted 34 a = new QAction(); // so it's get deleted
25 a->setText( tr("connect") ); 35 a->setText( tr("connect") );
26 a->addTo( this ); 36 a->addTo( this );
27 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 37 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
28 38
29 b = new QAction(); 39 b = new QAction();
30 b->setText( tr( "connect+conf" ) ); 40 b->setText( tr( "connect+conf" ) );
31 b->addTo( this ); 41 b->addTo( this );
32 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); 42 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
33 43
34 c = new QAction(); 44 c = new QAction();
35 c->setText( tr( "disconnect" ) ); 45 c->setText( tr( "disconnect" ) );
36 c->addTo( this ); 46 c->addTo( this );
37 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); 47 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
38 48
39}; 49};
40 50
41DunPopup::~DunPopup() { 51DunPopup::~DunPopup() {
42 52
43} 53}
44 54
45void DunPopup::slotConnect() { 55void DunPopup::slotConnect() {
46 odebug << "connect" << oendl; 56 odebug << "connect" << oendl;
47 DunDialog dundlg(m_item->mac(), 57 DunDialog dundlg(m_item->mac(),
48 m_service.protocolDescriptorList().last().port()); 58 m_service.protocolDescriptorList().last().port());
49 QPEApplication::execDialog( &dundlg ); 59 QPEApplication::execDialog( &dundlg );
50} 60}
51 61
52void DunPopup::slotDisconnect() { 62void DunPopup::slotDisconnect() {
53 OProcess dunDis; 63 OProcess dunDis;
54 OProcess pppDis; 64 OProcess pppDis;
55 dunDis << tr("dund") << tr("--kill") << m_item->mac(); 65 dunDis << tr("dund") << tr("--kill") << m_item->mac();
56 dunDis.start(OProcess::DontCare, OProcess::NoCommunication); 66 dunDis.start(OProcess::DontCare, OProcess::NoCommunication);
57 pppDis << tr("killall") << tr("-q") << tr("pppd"); 67 pppDis << tr("killall") << tr("-q") << tr("pppd");
58 pppDis.start(OProcess::DontCare, OProcess::NoCommunication); 68 pppDis.start(OProcess::DontCare, OProcess::NoCommunication);
59 sleep(1); 69 sleep(1);
60 QMessageBox::information(this, tr("DUN Disconnect"), tr("DUN Disconnected")); 70 QMessageBox::information(this, tr("DUN Disconnect"), tr("DUN Disconnected"));
61} 71}
62 72
63 73
64void DunPopup::slotConnectAndConfig() { 74void DunPopup::slotConnectAndConfig() {
65 slotConnect(); 75 slotConnect();
66 76
67 // more intelligence here later like passing the device ( bnepX ) 77 // more intelligence here later like passing the device ( bnepX )
68 QCopEnvelope e( "QPE/System", "execute(QString)" ); 78 QCopEnvelope e( "QPE/System", "execute(QString)" );
69 e << QString( "networksettings" ); 79 e << QString( "networksettings" );
70} 80}
diff --git a/noncore/net/opietooth/manager/dunpopup.h b/noncore/net/opietooth/manager/dunpopup.h
index 6058b20..9fecf06 100644
--- a/noncore/net/opietooth/manager/dunpopup.h
+++ b/noncore/net/opietooth/manager/dunpopup.h
@@ -1,32 +1,42 @@
1/* $Id$ */
2/* DUN context menu */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1#ifndef DUNPOPUP_H 11#ifndef DUNPOPUP_H
2#define DUNPOPUP_H 12#define DUNPOPUP_H
3 13
4#include <qpopupmenu.h> 14#include <qpopupmenu.h>
5#include <qaction.h> 15#include <qaction.h>
6#include <services.h> 16#include <services.h>
7 17
8#include "btdeviceitem.h" 18#include "btdeviceitem.h"
9 19
10 20
11namespace OpieTooth { 21namespace OpieTooth {
12 22
13 class DunPopup : public QPopupMenu { 23 class DunPopup : public QPopupMenu {
14 24
15 Q_OBJECT 25 Q_OBJECT
16 26
17 public: 27 public:
18 DunPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); 28 DunPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
19 ~DunPopup(); 29 ~DunPopup();
20 30
21 private: 31 private:
22 QAction* m_push; 32 QAction* m_push;
23 OpieTooth::BTDeviceItem *m_item; //device item 33 OpieTooth::BTDeviceItem *m_item; //device item
24 Services m_service; //device service (port) 34 Services m_service; //device service (port)
25 private slots: 35 private slots:
26 void slotConnect(); 36 void slotConnect();
27 void slotDisconnect(); 37 void slotDisconnect();
28 void slotConnectAndConfig(); 38 void slotConnectAndConfig();
29 }; 39 };
30}; 40};
31 41
32#endif 42#endif
diff --git a/noncore/net/opietooth/manager/pandialog.cpp b/noncore/net/opietooth/manager/pandialog.cpp
index ca6f491..10ca7a8 100644
--- a/noncore/net/opietooth/manager/pandialog.cpp
+++ b/noncore/net/opietooth/manager/pandialog.cpp
@@ -1,125 +1,134 @@
1 1/* $Id$ */
2/* PAN connection dialog */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
2#include "pandialog.h" 11#include "pandialog.h"
3#include <qpushbutton.h> 12#include <qpushbutton.h>
4#include <qlayout.h> 13#include <qlayout.h>
5#include <qcheckbox.h> 14#include <qcheckbox.h>
6#include <qlabel.h> 15#include <qlabel.h>
7#include <qstring.h> 16#include <qstring.h>
8#include <qmultilineedit.h> 17#include <qmultilineedit.h>
9#include <opie2/oprocess.h> 18#include <opie2/oprocess.h>
10#include <opie2/odebug.h> 19#include <opie2/odebug.h>
11using namespace Opie::Core; 20using namespace Opie::Core;
12 21
13using namespace OpieTooth; 22using namespace OpieTooth;
14 23
15using namespace Opie::Core; 24using namespace Opie::Core;
16 25
17PanDialog::PanDialog( const QString& device, QWidget* parent, 26PanDialog::PanDialog( const QString& device, QWidget* parent,
18 const char* name, bool modal, WFlags fl ) 27 const char* name, bool modal, WFlags fl )
19 : QDialog( parent, name, modal, fl ) { 28 : QDialog( parent, name, modal, fl ) {
20 m_panConnect = NULL; 29 m_panConnect = NULL;
21 30
22 if ( !name ) 31 if ( !name )
23 setName( "PANDialog" ); 32 setName( "PANDialog" );
24 setCaption( tr( "PAN connection " ) ) ; 33 setCaption( tr( "PAN connection " ) ) ;
25 34
26 m_device = device; 35 m_device = device;
27 36
28 layout = new QVBoxLayout( this ); 37 layout = new QVBoxLayout( this );
29 38
30 outPut = new QMultiLineEdit( this ); 39 outPut = new QMultiLineEdit( this );
31 QFont outPut_font( outPut->font() ); 40 QFont outPut_font( outPut->font() );
32 outPut_font.setPointSize( 8 ); 41 outPut_font.setPointSize( 8 );
33 outPut->setFont( outPut_font ); 42 outPut->setFont( outPut_font );
34 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 43 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
35 44
36 connectButton = new QPushButton( this ); 45 connectButton = new QPushButton( this );
37 connectButton->setText( tr( "Connect" ) ); 46 connectButton->setText( tr( "Connect" ) );
38 47
39 doEncryption = new QCheckBox(this, "encrypt"); 48 doEncryption = new QCheckBox(this, "encrypt");
40 doEncryption->setText( tr( "encrypt" ) ); 49 doEncryption->setText( tr( "encrypt" ) );
41 doSecure = new QCheckBox(this, "secure connection"); 50 doSecure = new QCheckBox(this, "secure connection");
42 doSecure->setText( tr( "secure connection" ) ); 51 doSecure->setText( tr( "secure connection" ) );
43 52
44 layout->addWidget(doEncryption); 53 layout->addWidget(doEncryption);
45 layout->addWidget(doSecure); 54 layout->addWidget(doSecure);
46 layout->addWidget(outPut); 55 layout->addWidget(outPut);
47 layout->addWidget(connectButton); 56 layout->addWidget(connectButton);
48 57
49 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 58 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
50} 59}
51 60
52PanDialog::~PanDialog() { 61PanDialog::~PanDialog() {
53} 62}
54 63
55void PanDialog::connectToDevice() { 64void PanDialog::connectToDevice() {
56 bool doEnc = doEncryption->isChecked(); 65 bool doEnc = doEncryption->isChecked();
57 bool doSec = doSecure->isChecked(); 66 bool doSec = doSecure->isChecked();
58 67
59 if (m_panConnect) { 68 if (m_panConnect) {
60 outPut->append(tr("Work in progress")); 69 outPut->append(tr("Work in progress"));
61 return; 70 return;
62 } 71 }
63 m_panConnect = new OProcess(); 72 m_panConnect = new OProcess();
64 outPut->clear(); 73 outPut->clear();
65 74
66 // Fill process command line 75 // Fill process command line
67 *m_panConnect << tr("pand") 76 *m_panConnect << tr("pand")
68 << tr("--connect") << m_device 77 << tr("--connect") << m_device
69 << tr("--nodetach"); 78 << tr("--nodetach");
70 if (doEnc) 79 if (doEnc)
71 *m_panConnect << tr("--encrypt"); 80 *m_panConnect << tr("--encrypt");
72 if (doSec) 81 if (doSec)
73 *m_panConnect << tr("--secure"); 82 *m_panConnect << tr("--secure");
74 if (!m_panConnect->start(OProcess::NotifyOnExit, 83 if (!m_panConnect->start(OProcess::NotifyOnExit,
75 OProcess::All)) { 84 OProcess::All)) {
76 outPut->append(tr("Couldn't start")); 85 outPut->append(tr("Couldn't start"));
77 delete m_panConnect; 86 delete m_panConnect;
78 m_panConnect = NULL; 87 m_panConnect = NULL;
79 } 88 }
80 else 89 else
81 { 90 {
82 m_panConnect->resume(); 91 m_panConnect->resume();
83 outPut->append(tr("Started")); 92 outPut->append(tr("Started"));
84 connect(m_panConnect, 93 connect(m_panConnect,
85 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), 94 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
86 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int))); 95 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
87 connect(m_panConnect, 96 connect(m_panConnect,
88 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), 97 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
89 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int))); 98 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
90 connect(m_panConnect, 99 connect(m_panConnect,
91 SIGNAL(processExited(Opie::Core::OProcess*)), 100 SIGNAL(processExited(Opie::Core::OProcess*)),
92 this, SLOT(slotProcessExited(Opie::Core::OProcess*))); 101 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
93 } 102 }
94} 103}
95 104
96void PanDialog::fillOutPut( OProcess*, char* cha, int len ) { 105void PanDialog::fillOutPut( OProcess*, char* cha, int len ) {
97 QCString str(cha, len); 106 QCString str(cha, len);
98 outPut->append(str); 107 outPut->append(str);
99} 108}
100 109
101void PanDialog::fillErr(OProcess*, char* buf, int len) 110void PanDialog::fillErr(OProcess*, char* buf, int len)
102{ 111{
103 QCString str(buf, len); 112 QCString str(buf, len);
104 outPut->append(str); 113 outPut->append(str);
105} 114}
106 115
107void PanDialog::slotProcessExited(OProcess* proc) { 116void PanDialog::slotProcessExited(OProcess* proc) {
108 if (m_panConnect->normalExit()) { 117 if (m_panConnect->normalExit()) {
109 outPut->append( tr("Finished with result ") ); 118 outPut->append( tr("Finished with result ") );
110 outPut->append( QString::number(proc->exitStatus()) ); 119 outPut->append( QString::number(proc->exitStatus()) );
111 } 120 }
112 else 121 else
113 outPut->append( tr("Exited abnormally") ); 122 outPut->append( tr("Exited abnormally") );
114 delete m_panConnect; 123 delete m_panConnect;
115 m_panConnect = NULL; 124 m_panConnect = NULL;
116} 125}
117 126
118void PanDialog::closeEvent(QCloseEvent* e) 127void PanDialog::closeEvent(QCloseEvent* e)
119{ 128{
120 if (m_panConnect && m_panConnect->isRunning()) 129 if (m_panConnect && m_panConnect->isRunning())
121 m_panConnect->kill(); 130 m_panConnect->kill();
122 QDialog::closeEvent(e); 131 QDialog::closeEvent(e);
123} 132}
124 133
125//eof 134//eof
diff --git a/noncore/net/opietooth/manager/pandialog.h b/noncore/net/opietooth/manager/pandialog.h
index 02363d2..b11a026 100644
--- a/noncore/net/opietooth/manager/pandialog.h
+++ b/noncore/net/opietooth/manager/pandialog.h
@@ -1,40 +1,50 @@
1/* $Id$ */
2/* PAN connection dialog */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1#ifndef PANDIALOG_H 11#ifndef PANDIALOG_H
2#define DUNDIALOG_H 12#define DUNDIALOG_H
3 13
4 14
5#include <qdialog.h> 15#include <qdialog.h>
6#include <opie2/oprocess.h> 16#include <opie2/oprocess.h>
7 17
8class QVBoxLayout; 18class QVBoxLayout;
9class QMultiLineEdit; 19class QMultiLineEdit;
10class QPushButton; 20class QPushButton;
11class QCheckBox; 21class QCheckBox;
12 22
13namespace OpieTooth { 23namespace OpieTooth {
14 class PanDialog : public QDialog { 24 class PanDialog : public QDialog {
15 25
16 Q_OBJECT 26 Q_OBJECT
17 27
18 public: 28 public:
19 PanDialog(const QString& device = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0); 29 PanDialog(const QString& device = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0);
20 ~PanDialog(); 30 ~PanDialog();
21 31
22 private slots: 32 private slots:
23 void connectToDevice(); 33 void connectToDevice();
24 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len ); 34 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
25 void fillErr(Opie::Core::OProcess*, char*, int); 35 void fillErr(Opie::Core::OProcess*, char*, int);
26 void slotProcessExited(Opie::Core::OProcess* proc); 36 void slotProcessExited(Opie::Core::OProcess* proc);
27 void closeEvent(QCloseEvent* e); 37 void closeEvent(QCloseEvent* e);
28 protected: 38 protected:
29 QVBoxLayout* layout; 39 QVBoxLayout* layout;
30 QPushButton* connectButton; 40 QPushButton* connectButton;
31 QMultiLineEdit* outPut; 41 QMultiLineEdit* outPut;
32 QCheckBox* doEncryption; 42 QCheckBox* doEncryption;
33 QCheckBox* doSecure; 43 QCheckBox* doSecure;
34 Opie::Core::OProcess* m_panConnect; 44 Opie::Core::OProcess* m_panConnect;
35 45
36 private: 46 private:
37 QString m_device; //device BT address 47 QString m_device; //device BT address
38 }; 48 };
39} 49}
40#endif 50#endif
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp
index 2fd9eaf..d16bf0c 100644
--- a/noncore/net/opietooth/manager/panpopup.cpp
+++ b/noncore/net/opietooth/manager/panpopup.cpp
@@ -1,72 +1,82 @@
1/* $Id$ */
2/* PAN context menu */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1#include <qpe/qcopenvelope_qws.h> 11#include <qpe/qcopenvelope_qws.h>
2#include <qmessagebox.h> 12#include <qmessagebox.h>
3#include <opie2/odebug.h> 13#include <opie2/odebug.h>
4#include <opie2/oprocess.h> 14#include <opie2/oprocess.h>
5#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
6#include "pandialog.h" 16#include "pandialog.h"
7using namespace Opie::Core; 17using namespace Opie::Core;
8 18
9#include <qtimer.h> 19#include <qtimer.h>
10 20
11#include "panpopup.h" 21#include "panpopup.h"
12 22
13using namespace OpieTooth; 23using namespace OpieTooth;
14 24
15/* 25/*
16 * c'tor init the QAction 26 * c'tor init the QAction
17 */ 27 */
18PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { 28PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
19 29
20 owarn << "PanPopup c'tor" << oendl; 30 owarn << "PanPopup c'tor" << oendl;
21 31
22 m_item = item; 32 m_item = item;
23 QAction *a, *b, *c; 33 QAction *a, *b, *c;
24 34
25 m_panconnection = 0l; 35 m_panconnection = 0l;
26 /* connect action */ 36 /* connect action */
27 37
28 38
29 a = new QAction(); // so it's get deleted 39 a = new QAction(); // so it's get deleted
30 a->setText( tr("connect") ); 40 a->setText( tr("connect") );
31 a->addTo( this ); 41 a->addTo( this );
32 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 42 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
33 43
34 44
35 b = new QAction(); 45 b = new QAction();
36 b->setText( tr( "connect+conf" ) ); 46 b->setText( tr( "connect+conf" ) );
37 b->addTo( this ); 47 b->addTo( this );
38 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); 48 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
39 49
40 c = new QAction(); 50 c = new QAction();
41 c->setText( tr( "disconnect" ) ); 51 c->setText( tr( "disconnect" ) );
42 c->addTo( this ); 52 c->addTo( this );
43 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); 53 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
44 54
45}; 55};
46 56
47PanPopup::~PanPopup() { 57PanPopup::~PanPopup() {
48 58
49} 59}
50 60
51void PanPopup::slotConnect() { 61void PanPopup::slotConnect() {
52 odebug << "connect" << oendl; 62 odebug << "connect" << oendl;
53 PanDialog pandlg(m_item->mac()); 63 PanDialog pandlg(m_item->mac());
54 QPEApplication::execDialog(&pandlg); 64 QPEApplication::execDialog(&pandlg);
55} 65}
56 66
57void PanPopup::slotDisconnect() { 67void PanPopup::slotDisconnect() {
58 if (!m_panconnection) 68 if (!m_panconnection)
59 m_panconnection = new StartPanConnection( m_item->mac() ); 69 m_panconnection = new StartPanConnection( m_item->mac() );
60 m_panconnection->stop(); 70 m_panconnection->stop();
61 QMessageBox::information(this, tr("Pan Disconnect"), tr("PAN Disconnected")); 71 QMessageBox::information(this, tr("Pan Disconnect"), tr("PAN Disconnected"));
62} 72}
63 73
64 74
65void PanPopup::slotConnectAndConfig() { 75void PanPopup::slotConnectAndConfig() {
66 slotConnect(); 76 slotConnect();
67 77
68 // more intelligence here later like passing the device ( bnepX ) 78 // more intelligence here later like passing the device ( bnepX )
69 QCopEnvelope e( "QPE/System", "execute(QString)" ); 79 QCopEnvelope e( "QPE/System", "execute(QString)" );
70 e << QString( "networksettings" ); 80 e << QString( "networksettings" );
71 81
72} 82}
diff --git a/noncore/net/opietooth/manager/panpopup.h b/noncore/net/opietooth/manager/panpopup.h
index 3e535e3..7d41dfa 100644
--- a/noncore/net/opietooth/manager/panpopup.h
+++ b/noncore/net/opietooth/manager/panpopup.h
@@ -1,33 +1,43 @@
1/* $Id$ */
2/* PAN context menu */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1#ifndef PANPOPUP_H 11#ifndef PANPOPUP_H
2#define PANPOPUP_H 12#define PANPOPUP_H
3 13
4#include <qpopupmenu.h> 14#include <qpopupmenu.h>
5#include <qaction.h> 15#include <qaction.h>
6 16
7#include <startpanconnection.h> 17#include <startpanconnection.h>
8 18
9#include "btdeviceitem.h" 19#include "btdeviceitem.h"
10 20
11 21
12namespace OpieTooth { 22namespace OpieTooth {
13 23
14 class PanPopup : public QPopupMenu { 24 class PanPopup : public QPopupMenu {
15 25
16 Q_OBJECT 26 Q_OBJECT
17 27
18 public: 28 public:
19 PanPopup( OpieTooth::BTDeviceItem* ); 29 PanPopup( OpieTooth::BTDeviceItem* );
20 ~PanPopup(); 30 ~PanPopup();
21 31
22 private: 32 private:
23 QAction* m_push; 33 QAction* m_push;
24 OpieTooth::StartPanConnection* m_panconnection; 34 OpieTooth::StartPanConnection* m_panconnection;
25 OpieTooth::BTDeviceItem *m_item; 35 OpieTooth::BTDeviceItem *m_item;
26 private slots: 36 private slots:
27 void slotConnect(); 37 void slotConnect();
28 void slotDisconnect(); 38 void slotDisconnect();
29 void slotConnectAndConfig(); 39 void slotConnectAndConfig();
30 }; 40 };
31}; 41};
32 42
33#endif 43#endif