summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/dundialog.cpp15
-rw-r--r--noncore/net/opietooth/manager/dundialog.h3
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp28
-rw-r--r--noncore/net/opietooth/manager/pppdialog.h12
4 files changed, 47 insertions, 11 deletions
diff --git a/noncore/net/opietooth/manager/dundialog.cpp b/noncore/net/opietooth/manager/dundialog.cpp
index c6d8619..872ab00 100644
--- a/noncore/net/opietooth/manager/dundialog.cpp
+++ b/noncore/net/opietooth/manager/dundialog.cpp
@@ -3,110 +3,119 @@
3/*************************************************************************** 3/***************************************************************************
4 * * 4 * *
5 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. * 8 * (at your option) any later version. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11#include "dundialog.h" 11#include "dundialog.h"
12#include <qpushbutton.h> 12#include <qpushbutton.h>
13#include <qmultilineedit.h> 13#include <qmultilineedit.h>
14#include <qlineedit.h> 14#include <qlineedit.h>
15#include <qlayout.h> 15#include <qlayout.h>
16#include <qcheckbox.h> 16#include <qcheckbox.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qstring.h> 18#include <qstring.h>
19#include <qcombobox.h>
20#include <qdir.h>
19#include <opie2/oprocess.h> 21#include <opie2/oprocess.h>
20#include <opie2/odebug.h> 22#include <opie2/odebug.h>
21using namespace Opie::Core; 23using namespace Opie::Core;
22 24
23using namespace OpieTooth; 25using namespace OpieTooth;
24 26
25using namespace Opie::Core; 27using namespace Opie::Core;
26 28
27DunDialog::DunDialog( const QString& device, int port, QWidget* parent, 29DunDialog::DunDialog( const QString& device, int port, QWidget* parent,
28 const char* name, bool modal, WFlags fl ) 30 const char* name, bool modal, WFlags fl )
29 : QDialog( parent, name, modal, fl ) { 31 : QDialog( parent, name, modal, fl ) {
32 QDir d("/etc/ppp/peers/"); //Dir we search files in
33 d.setFilter( QDir::Files);
34 d.setSorting( QDir::Size | QDir::Reversed );
35
30 if ( !name ) 36 if ( !name )
31 setName( "DUNDialog" ); 37 setName( "DUNDialog" );
32 setCaption( tr( "DUN connection " ) ) ; 38 setCaption( tr( "DUN connection " ) ) ;
33 39
34 m_device = device; 40 m_device = device;
35 m_port = port; 41 m_port = port;
36 42
37 m_dunConnect = NULL; 43 m_dunConnect = NULL;
38 layout = new QVBoxLayout( this ); 44 layout = new QVBoxLayout( this );
39 45
40 QLabel* info = new QLabel( this ); 46 QLabel* info = new QLabel( this );
41 info->setText( tr("Enter an ppp script name:") ); 47 info->setText( tr("Enter an ppp script name:") );
42 48
43 cmdLine = new QLineEdit( this ); 49 cmdLine = new QComboBox( this );
50 cmdLine->setEditable(true);
44 51
45 outPut = new QMultiLineEdit( this ); 52 outPut = new QMultiLineEdit( this );
46 QFont outPut_font( outPut->font() ); 53 QFont outPut_font( outPut->font() );
47 outPut_font.setPointSize( 8 ); 54 outPut_font.setPointSize( 8 );
48 outPut->setFont( outPut_font ); 55 outPut->setFont( outPut_font );
49 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 56 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
50 57
51 connectButton = new QPushButton( this ); 58 connectButton = new QPushButton( this );
52 connectButton->setText( tr( "Connect" ) ); 59 connectButton->setText( tr( "Connect" ) );
53 60
54 doEncryption = new QCheckBox(this, "encrypt"); 61 doEncryption = new QCheckBox(this, "encrypt");
55 doEncryption->setText( tr( "encrypt" ) ); 62 doEncryption->setText( tr( "encrypt" ) );
56 63
57 persist = new QCheckBox(this, "persist"); 64 persist = new QCheckBox(this, "persist");
58 persist->setText( tr( "persist" ) ); 65 persist->setText( tr( "persist" ) );
59 66
60 layout->addWidget(info); 67 layout->addWidget(info);
61 layout->addWidget(cmdLine); 68 layout->addWidget(cmdLine);
62 layout->addWidget(doEncryption); 69 layout->addWidget(doEncryption);
63 layout->addWidget(persist); 70 layout->addWidget(persist);
64 layout->addWidget(outPut); 71 layout->addWidget(outPut);
65 layout->addWidget(connectButton); 72 layout->addWidget(connectButton);
66 73
67 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 74 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
75 //And fill cmdLine with ppp script filenames
76 cmdLine->insertStringList(d.entryList());
68} 77}
69 78
70DunDialog::~DunDialog() { 79DunDialog::~DunDialog() {
71} 80}
72 81
73void DunDialog::connectToDevice() { 82void DunDialog::connectToDevice() {
74 bool doEnc = doEncryption->isChecked(); 83 bool doEnc = doEncryption->isChecked();
75 bool doPersist = persist->isChecked(); 84 bool doPersist = persist->isChecked();
76 85
77 if (cmdLine->text() == "") 86 if (cmdLine->currentText() == "")
78 return; 87 return;
79 if (m_dunConnect) { 88 if (m_dunConnect) {
80 outPut->append(tr("Work in progress")); 89 outPut->append(tr("Work in progress"));
81 return; 90 return;
82 } 91 }
83 m_dunConnect = new OProcess(); 92 m_dunConnect = new OProcess();
84 outPut->clear(); 93 outPut->clear();
85 94
86 // Fill process command line 95 // Fill process command line
87 *m_dunConnect << tr("dund") 96 *m_dunConnect << tr("dund")
88 << tr("--connect") << m_device 97 << tr("--connect") << m_device
89 << tr("--channel") << QString::number(m_port) 98 << tr("--channel") << QString::number(m_port)
90 << tr("--nodetach"); 99 << tr("--nodetach");
91 if (doEnc) 100 if (doEnc)
92 *m_dunConnect << tr("--encrypt"); 101 *m_dunConnect << tr("--encrypt");
93 if (doPersist) 102 if (doPersist)
94 *m_dunConnect << tr("--persist"); 103 *m_dunConnect << tr("--persist");
95 *m_dunConnect << tr("call") 104 *m_dunConnect << tr("call")
96 << cmdLine->text(); 105 << cmdLine->currentText();
97 if (!m_dunConnect->start(OProcess::NotifyOnExit, 106 if (!m_dunConnect->start(OProcess::NotifyOnExit,
98 OProcess::All)) { 107 OProcess::All)) {
99 outPut->append(tr("Couldn't start")); 108 outPut->append(tr("Couldn't start"));
100 delete m_dunConnect; 109 delete m_dunConnect;
101 m_dunConnect = NULL; 110 m_dunConnect = NULL;
102 } 111 }
103 else 112 else
104 { 113 {
105 m_dunConnect->resume(); 114 m_dunConnect->resume();
106 outPut->append(tr("Started")); 115 outPut->append(tr("Started"));
107 connect(m_dunConnect, 116 connect(m_dunConnect,
108 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), 117 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
109 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int))); 118 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
110 connect(m_dunConnect, 119 connect(m_dunConnect,
111 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), 120 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
112 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int))); 121 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
diff --git a/noncore/net/opietooth/manager/dundialog.h b/noncore/net/opietooth/manager/dundialog.h
index a0d16ad..8310e40 100644
--- a/noncore/net/opietooth/manager/dundialog.h
+++ b/noncore/net/opietooth/manager/dundialog.h
@@ -7,47 +7,48 @@
7 * the Free Software Foundation; either version 2 of the License, or * 7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. * 8 * (at your option) any later version. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11#ifndef DUNDIALOG_H 11#ifndef DUNDIALOG_H
12#define DUNDIALOG_H 12#define DUNDIALOG_H
13 13
14 14
15#include <qdialog.h> 15#include <qdialog.h>
16#include <opie2/oprocess.h> 16#include <opie2/oprocess.h>
17 17
18class QVBoxLayout; 18class QVBoxLayout;
19class QPushButton; 19class QPushButton;
20class QMultiLineEdit; 20class QMultiLineEdit;
21class QLineEdit; 21class QLineEdit;
22class QCheckBox; 22class QCheckBox;
23class QComboBox;
23 24
24namespace OpieTooth { 25namespace OpieTooth {
25 class DunDialog : public QDialog { 26 class DunDialog : public QDialog {
26 27
27 Q_OBJECT 28 Q_OBJECT
28 29
29 public: 30 public:
30 DunDialog(const QString& device = 0, int port = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0); 31 DunDialog(const QString& device = 0, int port = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0);
31 ~DunDialog(); 32 ~DunDialog();
32 33
33 private slots: 34 private slots:
34 void connectToDevice(); 35 void connectToDevice();
35 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len ); 36 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
36 void fillErr(Opie::Core::OProcess*, char*, int); 37 void fillErr(Opie::Core::OProcess*, char*, int);
37 void slotProcessExited(Opie::Core::OProcess* proc); 38 void slotProcessExited(Opie::Core::OProcess* proc);
38 void closeEvent(QCloseEvent* e); 39 void closeEvent(QCloseEvent* e);
39 protected: 40 protected:
40 QVBoxLayout* layout; 41 QVBoxLayout* layout;
41 QLineEdit* cmdLine; 42 QComboBox* cmdLine;
42 QPushButton* connectButton; 43 QPushButton* connectButton;
43 QMultiLineEdit* outPut; 44 QMultiLineEdit* outPut;
44 QCheckBox* doEncryption; 45 QCheckBox* doEncryption;
45 QCheckBox* persist; 46 QCheckBox* persist;
46 47
47 private: 48 private:
48 QString m_device; //device BT address 49 QString m_device; //device BT address
49 int m_port; //device process 50 int m_port; //device process
50 Opie::Core::OProcess* m_dunConnect; //DUN process 51 Opie::Core::OProcess* m_dunConnect; //DUN process
51 }; 52 };
52} 53}
53#endif 54#endif
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
index 11091c4..1df22a1 100644
--- a/noncore/net/opietooth/manager/pppdialog.cpp
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -1,99 +1,115 @@
1 1/* $Id$ */
2/* PPP/rfcomm 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 "pppdialog.h" 11#include "pppdialog.h"
3#include "rfcommhelper.h" 12#include "rfcommhelper.h"
4#include <qpushbutton.h> 13#include <qpushbutton.h>
5#include <qmultilineedit.h> 14#include <qmultilineedit.h>
6#include <qlineedit.h> 15#include <qlineedit.h>
7#include <qlayout.h> 16#include <qlayout.h>
8#include <qcombobox.h> 17#include <qcombobox.h>
9#include <qlabel.h> 18#include <qlabel.h>
19#include <qdir.h>
10#include <opie2/oprocess.h> 20#include <opie2/oprocess.h>
11#include <opie2/odebug.h> 21#include <opie2/odebug.h>
12using namespace Opie::Core; 22using namespace Opie::Core;
13 23
14using namespace OpieTooth; 24using namespace OpieTooth;
15 25
16using namespace Opie::Core; 26using namespace Opie::Core;
17 27
18Connection PPPDialog::conns[NCONNECTS]; 28Connection PPPDialog::conns[NCONNECTS];
19 29
20PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, 30PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent,
21 const char* name, bool modal, WFlags fl ) 31 const char* name, bool modal, WFlags fl )
22 : QDialog( parent, name, modal, fl ) { 32 : QDialog( parent, name, modal, fl ) {
23 int i; //Just an index variable 33 int i; //Just an index variable
24 34 QDir d("/etc/ppp/peers/"); //Dir we search files in
35 d.setFilter( QDir::Files);
36 d.setSorting( QDir::Size | QDir::Reversed );
37
25 if ( !name ) 38 if ( !name )
26 setName( "PPPDialog" ); 39 setName( "PPPDialog" );
27 setCaption( tr( "ppp connection " ) ) ; 40 setCaption( tr( "ppp connection " ) ) ;
28 41
29 m_device = device; 42 m_device = device;
30 m_port = port; 43 m_port = port;
31 44
32 layout = new QVBoxLayout( this ); 45 layout = new QVBoxLayout( this );
33 46
34 QLabel* info = new QLabel( this ); 47 QLabel* info = new QLabel( this );
35 info->setText( tr("Enter an ppp script name:") ); 48 info->setText( tr("Enter a ppp script name:") );
36 49
37 cmdLine = new QLineEdit( this ); 50 cmdLine = new QComboBox( this );
51 cmdLine->setEditable(true);
38 52
39 outPut = new QMultiLineEdit( this ); 53 outPut = new QMultiLineEdit( this );
40 QFont outPut_font( outPut->font() ); 54 QFont outPut_font( outPut->font() );
41 outPut_font.setPointSize( 8 ); 55 outPut_font.setPointSize( 8 );
42 outPut->setFont( outPut_font ); 56 outPut->setFont( outPut_font );
43 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 57 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
44 58
45 connectButton = new QPushButton( this ); 59 connectButton = new QPushButton( this );
46 connectButton->setText( tr( "Connect" ) ); 60 connectButton->setText( tr( "Connect" ) );
47 61
48 serPort = new QComboBox(this); 62 serPort = new QComboBox(this);
49 for (i = 0; i < NCONNECTS; i++) { 63 for (i = 0; i < NCONNECTS; i++) {
50 if (!PPPDialog::conns[i].proc.isRunning()) 64 if (!PPPDialog::conns[i].proc.isRunning())
51 serPort->insertItem(tr("rfcomm%1").arg(i)); 65 serPort->insertItem(tr("rfcomm%1").arg(i));
52 } 66 }
53 67
54 layout->addWidget(info); 68 layout->addWidget(info);
55 layout->addWidget(cmdLine); 69 layout->addWidget(cmdLine);
56 layout->addWidget(serPort); 70 layout->addWidget(serPort);
57 layout->addWidget(outPut); 71 layout->addWidget(outPut);
58 layout->addWidget(connectButton); 72 layout->addWidget(connectButton);
59 73
60 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 74 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
75 //And fill cmdLine with ppp script filenames
76 cmdLine->insertStringList(d.entryList());
61} 77}
62 78
63PPPDialog::~PPPDialog() { 79PPPDialog::~PPPDialog() {
64} 80}
65 81
66void PPPDialog::connectToDevice() { 82void PPPDialog::connectToDevice() {
67 int portNum = serPort->currentText().right(1).toInt(); 83 int portNum = serPort->currentText().right(1).toInt();
68 if (PPPDialog::conns[portNum].proc.isRunning()) { 84 if (PPPDialog::conns[portNum].proc.isRunning()) {
69 outPut->append(tr("Work in progress")); 85 outPut->append(tr("Work in progress"));
70 return; 86 return;
71 } 87 }
72 outPut->clear(); 88 outPut->clear();
73 PPPDialog::conns[portNum].proc.clearArguments(); 89 PPPDialog::conns[portNum].proc.clearArguments();
74 // vom popupmenu beziehen 90 // vom popupmenu beziehen
75 if (cmdLine->text().isEmpty()) {//Connect by rfcomm 91 if (cmdLine->currentText().isEmpty()) {//Connect by rfcomm
76 PPPDialog::conns[portNum].proc << "rfcomm" << "connect" 92 PPPDialog::conns[portNum].proc << "rfcomm" << "connect"
77 << QString::number(portNum) << m_device << QString::number(m_port); 93 << QString::number(portNum) << m_device << QString::number(m_port);
78 } 94 }
79 else { 95 else {
80 PPPDialog::conns[portNum].proc << "pppd" 96 PPPDialog::conns[portNum].proc << "pppd"
81 << tr("/dev/bluetooth/rfcomm/%1").arg(portNum) 97 << tr("/dev/bluetooth/rfcomm/%1").arg(portNum)
82 << "call" 98 << "call"
83 << cmdLine->text(); 99 << cmdLine->currentText();
84 } 100 }
85 if (!PPPDialog::conns[portNum].proc.start(OProcess::NotifyOnExit, 101 if (!PPPDialog::conns[portNum].proc.start(OProcess::NotifyOnExit,
86 OProcess::All)) { 102 OProcess::All)) {
87 outPut->append(tr("Couldn't start")); 103 outPut->append(tr("Couldn't start"));
88 } 104 }
89 else 105 else
90 { 106 {
91 PPPDialog::conns[portNum].proc.resume(); 107 PPPDialog::conns[portNum].proc.resume();
92 outPut->append(tr("Started")); 108 outPut->append(tr("Started"));
93 PPPDialog::conns[portNum].btAddr = m_device; 109 PPPDialog::conns[portNum].btAddr = m_device;
94 PPPDialog::conns[portNum].port = m_port; 110 PPPDialog::conns[portNum].port = m_port;
95 connect(&PPPDialog::conns[portNum].proc, 111 connect(&PPPDialog::conns[portNum].proc,
96 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), 112 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
97 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int))); 113 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
98 connect( &PPPDialog::conns[portNum].proc, 114 connect( &PPPDialog::conns[portNum].proc,
99 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), 115 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
diff --git a/noncore/net/opietooth/manager/pppdialog.h b/noncore/net/opietooth/manager/pppdialog.h
index e0ffc7f..d55c15f 100644
--- a/noncore/net/opietooth/manager/pppdialog.h
+++ b/noncore/net/opietooth/manager/pppdialog.h
@@ -1,16 +1,26 @@
1/* $Id$ */
2/* PPP/rfcomm 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 PPPDIALOG_H 11#ifndef PPPDIALOG_H
2#define PPPDIALOG_H 12#define PPPDIALOG_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 QComboBox; 22class QComboBox;
13#define NCONNECTS 10 //Maximal 23#define NCONNECTS 10 //Maximal
14 24
15namespace OpieTooth { 25namespace OpieTooth {
16 typedef struct { 26 typedef struct {
@@ -25,27 +35,27 @@ namespace OpieTooth {
25 35
26 public: 36 public:
27 PPPDialog(const QString& device = 0, int port = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0); 37 PPPDialog(const QString& device = 0, int port = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0);
28 ~PPPDialog(); 38 ~PPPDialog();
29 39
30 private slots: 40 private slots:
31 void connectToDevice(); 41 void connectToDevice();
32 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len ); 42 void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
33 void fillErr(Opie::Core::OProcess*, char*, int); 43 void fillErr(Opie::Core::OProcess*, char*, int);
34 void slotProcessExited(Opie::Core::OProcess* proc); 44 void slotProcessExited(Opie::Core::OProcess* proc);
35 void closeEvent(QCloseEvent* e); 45 void closeEvent(QCloseEvent* e);
36 public: 46 public:
37 //Array of connections indexed by rfcomm device number 47 //Array of connections indexed by rfcomm device number
38 static Connection conns[NCONNECTS]; 48 static Connection conns[NCONNECTS];
39 protected: 49 protected:
40 QVBoxLayout* layout; 50 QVBoxLayout* layout;
41 QLineEdit* cmdLine; 51 QComboBox* cmdLine;
42 QPushButton* connectButton; 52 QPushButton* connectButton;
43 QMultiLineEdit* outPut; 53 QMultiLineEdit* outPut;
44 QComboBox* serPort; 54 QComboBox* serPort;
45 55
46 private: 56 private:
47 QString m_device; 57 QString m_device;
48 int m_port; 58 int m_port;
49 }; 59 };
50} 60}
51#endif 61#endif