summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/dundialog.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager/dundialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/dundialog.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/dundialog.cpp b/noncore/net/opietooth/manager/dundialog.cpp
index 7aac271..c6d8619 100644
--- a/noncore/net/opietooth/manager/dundialog.cpp
+++ b/noncore/net/opietooth/manager/dundialog.cpp
@@ -33,78 +33,86 @@ DunDialog::DunDialog( const QString& device, int port, QWidget* parent,
33 33
34 m_device = device; 34 m_device = device;
35 m_port = port; 35 m_port = port;
36 36
37 m_dunConnect = NULL; 37 m_dunConnect = NULL;
38 layout = new QVBoxLayout( this ); 38 layout = new QVBoxLayout( this );
39 39
40 QLabel* info = new QLabel( this ); 40 QLabel* info = new QLabel( this );
41 info->setText( tr("Enter an ppp script name:") ); 41 info->setText( tr("Enter an ppp script name:") );
42 42
43 cmdLine = new QLineEdit( this ); 43 cmdLine = new QLineEdit( this );
44 44
45 outPut = new QMultiLineEdit( this ); 45 outPut = new QMultiLineEdit( this );
46 QFont outPut_font( outPut->font() ); 46 QFont outPut_font( outPut->font() );
47 outPut_font.setPointSize( 8 ); 47 outPut_font.setPointSize( 8 );
48 outPut->setFont( outPut_font ); 48 outPut->setFont( outPut_font );
49 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 49 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
50 50
51 connectButton = new QPushButton( this ); 51 connectButton = new QPushButton( this );
52 connectButton->setText( tr( "Connect" ) ); 52 connectButton->setText( tr( "Connect" ) );
53 53
54 doEncryption = new QCheckBox(this, "encrypt"); 54 doEncryption = new QCheckBox(this, "encrypt");
55 doEncryption->setText( tr( "encrypt" ) ); 55 doEncryption->setText( tr( "encrypt" ) );
56 56
57 persist = new QCheckBox(this, "persist");
58 persist->setText( tr( "persist" ) );
59
57 layout->addWidget(info); 60 layout->addWidget(info);
58 layout->addWidget(cmdLine); 61 layout->addWidget(cmdLine);
59 layout->addWidget(doEncryption); 62 layout->addWidget(doEncryption);
63 layout->addWidget(persist);
60 layout->addWidget(outPut); 64 layout->addWidget(outPut);
61 layout->addWidget(connectButton); 65 layout->addWidget(connectButton);
62 66
63 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 67 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
64} 68}
65 69
66DunDialog::~DunDialog() { 70DunDialog::~DunDialog() {
67} 71}
68 72
69void DunDialog::connectToDevice() { 73void DunDialog::connectToDevice() {
70 bool doEnc = doEncryption->isChecked(); 74 bool doEnc = doEncryption->isChecked();
75 bool doPersist = persist->isChecked();
76
71 if (cmdLine->text() == "") 77 if (cmdLine->text() == "")
72 return; 78 return;
73 if (m_dunConnect) { 79 if (m_dunConnect) {
74 outPut->append(tr("Work in progress")); 80 outPut->append(tr("Work in progress"));
75 return; 81 return;
76 } 82 }
77 m_dunConnect = new OProcess(); 83 m_dunConnect = new OProcess();
78 outPut->clear(); 84 outPut->clear();
79 85
80 // Fill process command line 86 // Fill process command line
81 *m_dunConnect << tr("dund") 87 *m_dunConnect << tr("dund")
82 << tr("--connect") << m_device 88 << tr("--connect") << m_device
83 << tr("--channel") << QString::number(m_port) 89 << tr("--channel") << QString::number(m_port)
84 << tr("--nodetach"); 90 << tr("--nodetach");
85 if (doEnc) 91 if (doEnc)
86 *m_dunConnect << tr("--encrypt"); 92 *m_dunConnect << tr("--encrypt");
93 if (doPersist)
94 *m_dunConnect << tr("--persist");
87 *m_dunConnect << tr("call") 95 *m_dunConnect << tr("call")
88 << cmdLine->text(); 96 << cmdLine->text();
89 if (!m_dunConnect->start(OProcess::NotifyOnExit, 97 if (!m_dunConnect->start(OProcess::NotifyOnExit,
90 OProcess::All)) { 98 OProcess::All)) {
91 outPut->append(tr("Couldn't start")); 99 outPut->append(tr("Couldn't start"));
92 delete m_dunConnect; 100 delete m_dunConnect;
93 m_dunConnect = NULL; 101 m_dunConnect = NULL;
94 } 102 }
95 else 103 else
96 { 104 {
97 m_dunConnect->resume(); 105 m_dunConnect->resume();
98 outPut->append(tr("Started")); 106 outPut->append(tr("Started"));
99 connect(m_dunConnect, 107 connect(m_dunConnect,
100 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), 108 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
101 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int))); 109 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
102 connect(m_dunConnect, 110 connect(m_dunConnect,
103 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), 111 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
104 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int))); 112 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
105 connect(m_dunConnect, 113 connect(m_dunConnect,
106 SIGNAL(processExited(Opie::Core::OProcess*)), 114 SIGNAL(processExited(Opie::Core::OProcess*)),
107 this, SLOT(slotProcessExited(Opie::Core::OProcess*))); 115 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
108 } 116 }
109} 117}
110 118