author | ar <ar> | 2004-02-21 18:32:37 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-21 18:32:37 (UTC) |
commit | 536f271b1e6a1d1886e96a28524a3503c4c38c4e (patch) (unidiff) | |
tree | 63b3c0ce472a89a0f9731195fececc701bf4ca67 /noncore/settings/networksettings/ppp | |
parent | db2afda83e495bff9fc19fa14a30072f1cd4c67a (diff) | |
download | opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.zip opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.gz opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.bz2 |
improve support for BigScreen
Diffstat (limited to 'noncore/settings/networksettings/ppp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/accounts.cpp | 80 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.cpp | 62 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/modeminfo.cpp | 65 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 103 |
4 files changed, 198 insertions, 112 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index 28d8732..b8a1925a 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -24,23 +24,28 @@ | |||
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "accounts.h" | ||
28 | #include "authwidget.h" | ||
29 | #include "pppdata.h" | ||
30 | #include "edit.h" | ||
31 | |||
32 | /* OPIE */ | ||
33 | #include <qpe/qpeapplication.h> | ||
34 | |||
35 | /* QT */ | ||
27 | #include <qdir.h> | 36 | #include <qdir.h> |
28 | #include <stdlib.h> | ||
29 | #include <qlayout.h> | 37 | #include <qlayout.h> |
30 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
31 | #include <qtabdialog.h> | 39 | #include <qtabdialog.h> |
32 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
33 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
34 | |||
35 | #include <qapplication.h> | 42 | #include <qapplication.h> |
36 | #include <qbuttongroup.h> | 43 | #include <qbuttongroup.h> |
37 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
38 | #include <qvgroupbox.h> | 45 | #include <qvgroupbox.h> |
39 | 46 | ||
40 | #include "accounts.h" | 47 | /* STD */ |
41 | #include "authwidget.h" | 48 | #include <stdlib.h> |
42 | #include "pppdata.h" | ||
43 | #include "edit.h" | ||
44 | 49 | ||
45 | void parseargs(char* buf, char** args); | 50 | void parseargs(char* buf, char** args); |
46 | 51 | ||
@@ -68,7 +73,8 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF | |||
68 | 73 | ||
69 | listListbox->insertStringList(_pppdata->getAccountList()); | 74 | listListbox->insertStringList(_pppdata->getAccountList()); |
70 | 75 | ||
71 | for (uint i = 0; i < listListbox->count(); i++){ | 76 | for (uint i = 0; i < listListbox->count(); i++) |
77 | { | ||
72 | if ( listListbox->text(i) == _pppdata->accname() ) | 78 | if ( listListbox->text(i) == _pppdata->accname() ) |
73 | listListbox->setCurrentItem( i ); | 79 | listListbox->setCurrentItem( i ); |
74 | } | 80 | } |
@@ -76,7 +82,8 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF | |||
76 | 82 | ||
77 | 83 | ||
78 | 84 | ||
79 | void AccountWidget::slotListBoxSelect(int idx) { | 85 | void AccountWidget::slotListBoxSelect(int idx) |
86 | { | ||
80 | bool ok = _pppdata->setAccount( listListbox->text(idx) ); | 87 | bool ok = _pppdata->setAccount( listListbox->text(idx) ); |
81 | ok = (bool)(idx != -1); | 88 | ok = (bool)(idx != -1); |
82 | delete_b->setEnabled(ok); | 89 | delete_b->setEnabled(ok); |
@@ -84,12 +91,14 @@ void AccountWidget::slotListBoxSelect(int idx) { | |||
84 | //FIXME copy_b->setEnabled(ok); | 91 | //FIXME copy_b->setEnabled(ok); |
85 | } | 92 | } |
86 | 93 | ||
87 | void AccountWidget::edit() { | 94 | void AccountWidget::edit() |
95 | { | ||
88 | _pppdata->setAccount(listListbox->text(listListbox->currentItem())); | 96 | _pppdata->setAccount(listListbox->text(listListbox->currentItem())); |
89 | 97 | ||
90 | int result = doTab(); | 98 | int result = doTab(); |
91 | 99 | ||
92 | if(result == QDialog::Accepted) { | 100 | if(result == QDialog::Accepted) |
101 | { | ||
93 | listListbox->changeItem(_pppdata->accname(),listListbox->currentItem()); | 102 | listListbox->changeItem(_pppdata->accname(),listListbox->currentItem()); |
94 | // emit resetaccounts(); | 103 | // emit resetaccounts(); |
95 | _pppdata->save(); | 104 | _pppdata->save(); |
@@ -97,7 +106,8 @@ void AccountWidget::edit() { | |||
97 | } | 106 | } |
98 | 107 | ||
99 | 108 | ||
100 | void AccountWidget::create() { | 109 | void AccountWidget::create() |
110 | { | ||
101 | 111 | ||
102 | // if(listListbox->count() == MAX_ACCOUNTS) { | 112 | // if(listListbox->count() == MAX_ACCOUNTS) { |
103 | // QMessageBox::information(this, "sorry", | 113 | // QMessageBox::information(this, "sorry", |
@@ -106,29 +116,34 @@ void AccountWidget::create() { | |||
106 | // } | 116 | // } |
107 | 117 | ||
108 | int result; | 118 | int result; |
109 | if (_pppdata->newaccount() == -1){ | 119 | if (_pppdata->newaccount() == -1) |
120 | { | ||
110 | qDebug("_pppdata->newaccount() == -1"); | 121 | qDebug("_pppdata->newaccount() == -1"); |
111 | return; | 122 | return; |
112 | } | 123 | } |
113 | result = doTab(); | 124 | result = doTab(); |
114 | 125 | ||
115 | if(result == QDialog::Accepted) { | 126 | if(result == QDialog::Accepted) |
127 | { | ||
116 | listListbox->insertItem(_pppdata->accname()); | 128 | listListbox->insertItem(_pppdata->accname()); |
117 | listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); | 129 | listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); |
118 | 130 | ||
119 | _pppdata->save(); | 131 | _pppdata->save(); |
120 | } else | 132 | } |
133 | else | ||
121 | _pppdata->deleteAccount(); | 134 | _pppdata->deleteAccount(); |
122 | } | 135 | } |
123 | 136 | ||
124 | 137 | ||
125 | void AccountWidget::copy() { | 138 | void AccountWidget::copy() |
139 | { | ||
126 | // if(listListbox->count() == MAX_ACCOUNTS) { | 140 | // if(listListbox->count() == MAX_ACCOUNTS) { |
127 | // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); | 141 | // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); |
128 | // return; | 142 | // return; |
129 | // } | 143 | // } |
130 | 144 | ||
131 | if(listListbox->currentItem()<0) { | 145 | if(listListbox->currentItem()<0) |
146 | { | ||
132 | QMessageBox::information(this, "sorry", tr("No account selected.")); | 147 | QMessageBox::information(this, "sorry", tr("No account selected.")); |
133 | return; | 148 | return; |
134 | } | 149 | } |
@@ -141,7 +156,8 @@ void AccountWidget::copy() { | |||
141 | } | 156 | } |
142 | 157 | ||
143 | 158 | ||
144 | void AccountWidget::remove() { | 159 | void AccountWidget::remove() |
160 | { | ||
145 | 161 | ||
146 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") | 162 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") |
147 | .arg(listListbox->text(listListbox->currentItem())); | 163 | .arg(listListbox->text(listListbox->currentItem())); |
@@ -164,7 +180,8 @@ void AccountWidget::remove() { | |||
164 | } | 180 | } |
165 | 181 | ||
166 | 182 | ||
167 | int AccountWidget::doTab(){ | 183 | int AccountWidget::doTab() |
184 | { | ||
168 | QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp ); | 185 | QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp ); |
169 | QVBoxLayout *layout = new QVBoxLayout( dlg ); | 186 | QVBoxLayout *layout = new QVBoxLayout( dlg ); |
170 | layout->setSpacing( 0 ); | 187 | layout->setSpacing( 0 ); |
@@ -175,10 +192,13 @@ int AccountWidget::doTab(){ | |||
175 | 192 | ||
176 | bool isnewaccount; | 193 | bool isnewaccount; |
177 | 194 | ||
178 | if(_pppdata->accname().isEmpty()) { | 195 | if(_pppdata->accname().isEmpty()) |
196 | { | ||
179 | dlg->setCaption(tr("New Account")); | 197 | dlg->setCaption(tr("New Account")); |
180 | isnewaccount = true; | 198 | isnewaccount = true; |
181 | } else { | 199 | } |
200 | else | ||
201 | { | ||
182 | QString tit = tr("Edit Account: "); | 202 | QString tit = tr("Edit Account: "); |
183 | tit += _pppdata->accname(); | 203 | tit += _pppdata->accname(); |
184 | dlg->setCaption(tit); | 204 | dlg->setCaption(tit); |
@@ -212,18 +232,24 @@ int AccountWidget::doTab(){ | |||
212 | int result = 0; | 232 | int result = 0; |
213 | bool ok = false; | 233 | bool ok = false; |
214 | 234 | ||
215 | while (!ok){ | 235 | while (!ok) |
216 | dlg->showMaximized(); | 236 | { |
217 | result = dlg->exec(); | 237 | result = QPEApplication::execDialog( dlg ); |
218 | ok = true; | 238 | ok = true; |
219 | 239 | ||
220 | if(result == QDialog::Accepted) { | 240 | if(result == QDialog::Accepted) |
221 | if (!auth_w->check()){ | 241 | { |
242 | if (!auth_w->check()) | ||
243 | { | ||
222 | ok = false; | 244 | ok = false; |
223 | } else if(!dial_w->save()) { | 245 | } |
246 | else if(!dial_w->save()) | ||
247 | { | ||
224 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); | 248 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); |
225 | ok = false; | 249 | ok = false; |
226 | }else{ | 250 | } |
251 | else | ||
252 | { | ||
227 | ip_w->save(); | 253 | ip_w->save(); |
228 | dns_w->save(); | 254 | dns_w->save(); |
229 | gateway_w->save(); | 255 | gateway_w->save(); |
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 5540946..ff1b11b 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -24,9 +24,17 @@ | |||
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <termios.h> | 27 | #include "general.h" |
28 | #include <string.h> | 28 | #include "interfaceppp.h" |
29 | #include "modeminfo.h" | ||
30 | #include "modemcmds.h" | ||
31 | #include "pppdata.h" | ||
29 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <qpe/config.h> | ||
35 | #include <qpe/qpeapplication.h> | ||
36 | |||
37 | /* QT */ | ||
30 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
31 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
32 | #include <qlabel.h> | 40 | #include <qlabel.h> |
@@ -35,20 +43,10 @@ | |||
35 | #include <qslider.h> | 43 | #include <qslider.h> |
36 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
37 | #include <qwhatsthis.h> | 45 | #include <qwhatsthis.h> |
38 | #include <qpe/config.h> | ||
39 | // #include <qgroupbox.h> | ||
40 | |||
41 | |||
42 | #include "general.h" | ||
43 | #include "interfaceppp.h" | ||
44 | //#include "miniterm.h" | ||
45 | #include "modeminfo.h" | ||
46 | #include "modemcmds.h" | ||
47 | //#include "devices.h" | ||
48 | #include "pppdata.h" | ||
49 | //#include <klocale.h> | ||
50 | |||
51 | 46 | ||
47 | /* STD */ | ||
48 | #include <termios.h> | ||
49 | #include <string.h> | ||
52 | 50 | ||
53 | 51 | ||
54 | ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | 52 | ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) |
@@ -148,7 +146,8 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
148 | baud_c = new QComboBox(this); | 146 | baud_c = new QComboBox(this); |
149 | baud_label->setBuddy(baud_c); | 147 | baud_label->setBuddy(baud_c); |
150 | 148 | ||
151 | static const char *baudrates[] = { | 149 | static const char *baudrates[] = |
150 | { | ||
152 | 151 | ||
153 | #ifdef B460800 | 152 | #ifdef B460800 |
154 | "460800", | 153 | "460800", |
@@ -170,7 +169,8 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
170 | "19200", | 169 | "19200", |
171 | "9600", | 170 | "9600", |
172 | "2400", | 171 | "2400", |
173 | 0}; | 172 | 0 |
173 | }; | ||
174 | 174 | ||
175 | for(k = 0; baudrates[k]; k++) | 175 | for(k = 0; baudrates[k]; k++) |
176 | baud_c->insertItem(baudrates[k]); | 176 | baud_c->insertItem(baudrates[k]); |
@@ -190,7 +190,8 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
190 | QWhatsThis::add(baud_label,tmp); | 190 | QWhatsThis::add(baud_label,tmp); |
191 | QWhatsThis::add(baud_c,tmp); | 191 | QWhatsThis::add(baud_c,tmp); |
192 | 192 | ||
193 | for(int i=0; i <= enter->count()-1; i++) { | 193 | for(int i=0; i <= enter->count()-1; i++) |
194 | { | ||
194 | if(_pppdata->enter() == enter->text(i)) | 195 | if(_pppdata->enter() == enter->text(i)) |
195 | enter->setCurrentItem(i); | 196 | enter->setCurrentItem(i); |
196 | } | 197 | } |
@@ -237,17 +238,20 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
237 | "recommended value is 30 seconds.")); | 238 | "recommended value is 30 seconds.")); |
238 | 239 | ||
239 | //set stuff from gpppdata | 240 | //set stuff from gpppdata |
240 | for(int i=0; i <= enter->count()-1; i++) { | 241 | for(int i=0; i <= enter->count()-1; i++) |
242 | { | ||
241 | if(_pppdata->enter() == enter->text(i)) | 243 | if(_pppdata->enter() == enter->text(i)) |
242 | enter->setCurrentItem(i); | 244 | enter->setCurrentItem(i); |
243 | } | 245 | } |
244 | 246 | ||
245 | for(int i=0; i <= modemdevice->count()-1; i++) { | 247 | for(int i=0; i <= modemdevice->count()-1; i++) |
248 | { | ||
246 | if(_pppdata->modemDevice() == modemdevice->text(i)) | 249 | if(_pppdata->modemDevice() == modemdevice->text(i)) |
247 | modemdevice->setCurrentItem(i); | 250 | modemdevice->setCurrentItem(i); |
248 | } | 251 | } |
249 | 252 | ||
250 | for(int i=0; i <= flowcontrol->count()-1; i++) { | 253 | for(int i=0; i <= flowcontrol->count()-1; i++) |
254 | { | ||
251 | if(_pppdata->flowcontrol() == flowcontrol->text(i)) | 255 | if(_pppdata->flowcontrol() == flowcontrol->text(i)) |
252 | flowcontrol->setCurrentItem(i); | 256 | flowcontrol->setCurrentItem(i); |
253 | } | 257 | } |
@@ -273,9 +277,11 @@ ModemWidget::~ModemWidget() | |||
273 | 277 | ||
274 | 278 | ||
275 | QString edited = modemdevice->currentText(); | 279 | QString edited = modemdevice->currentText(); |
276 | if ( !( edited ).isEmpty() ) { | 280 | if ( !( edited ).isEmpty() ) |
281 | { | ||
277 | edited.simplifyWhiteSpace(); | 282 | edited.simplifyWhiteSpace(); |
278 | if ( devs.contains( edited ) == 0 ) { | 283 | if ( devs.contains( edited ) == 0 ) |
284 | { | ||
279 | devs << edited; | 285 | devs << edited; |
280 | } | 286 | } |
281 | _pppdata->setModemDevice( edited ); | 287 | _pppdata->setModemDevice( edited ); |
@@ -470,14 +476,16 @@ ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, | |||
470 | } | 476 | } |
471 | 477 | ||
472 | 478 | ||
473 | void ModemWidget2::modemcmdsbutton() { | 479 | void ModemWidget2::modemcmdsbutton() |
480 | { | ||
474 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); | 481 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); |
475 | mc.showMaximized(); | 482 | |
476 | mc.exec(); | 483 | QPEApplication::execDialog( &mc ); |
477 | } | 484 | } |
478 | 485 | ||
479 | 486 | ||
480 | void ModemWidget2::query_modem() { | 487 | void ModemWidget2::query_modem() |
488 | { | ||
481 | ModemTransfer mt(_ifaceppp->modem(), this); | 489 | ModemTransfer mt(_ifaceppp->modem(), this); |
482 | mt.exec(); | 490 | mt.exec(); |
483 | } | 491 | } |
diff --git a/noncore/settings/networksettings/ppp/modeminfo.cpp b/noncore/settings/networksettings/ppp/modeminfo.cpp index dbb26db..df0bf9b 100644 --- a/noncore/settings/networksettings/ppp/modeminfo.cpp +++ b/noncore/settings/networksettings/ppp/modeminfo.cpp | |||
@@ -24,16 +24,20 @@ | |||
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <unistd.h> | 27 | #include "modeminfo.h" |
28 | #include "modem.h" | ||
29 | |||
30 | /* OPIE */ | ||
31 | #include <qpe/qpeapplication.h> | ||
32 | |||
33 | /* QT */ | ||
28 | #include <qregexp.h> | 34 | #include <qregexp.h> |
29 | #include <qlayout.h> | 35 | #include <qlayout.h> |
30 | // #include <kwin.h> | ||
31 | // #include <kmessagebox.h> | ||
32 | // #include <kapplication.h> | ||
33 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
34 | #include <qapplication.h> | 37 | #include <qapplication.h> |
35 | #include "modeminfo.h" | 38 | |
36 | #include "modem.h" | 39 | /* STD */ |
40 | #include <unistd.h> | ||
37 | 41 | ||
38 | ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name) | 42 | ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name) |
39 | : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder), | 43 | : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder), |
@@ -93,7 +97,8 @@ ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name) | |||
93 | } | 97 | } |
94 | 98 | ||
95 | 99 | ||
96 | void ModemTransfer::ati_done() { | 100 | void ModemTransfer::ati_done() |
101 | { | ||
97 | scripttimer->stop(); | 102 | scripttimer->stop(); |
98 | timeout_timer->stop(); | 103 | timeout_timer->stop(); |
99 | _modem->closetty(); | 104 | _modem->closetty(); |
@@ -104,15 +109,16 @@ void ModemTransfer::ati_done() { | |||
104 | ModemInfo *mi = new ModemInfo(this); | 109 | ModemInfo *mi = new ModemInfo(this); |
105 | for(int i = 0; i < NUM_OF_ATI; i++) | 110 | for(int i = 0; i < NUM_OF_ATI; i++) |
106 | mi->setAtiString(i, ati_query_strings[i]); | 111 | mi->setAtiString(i, ati_query_strings[i]); |
107 | mi->showMaximized(); | 112 | |
108 | mi->exec(); | 113 | QPEApplication::execDialog( mi ); |
109 | delete mi; | 114 | delete mi; |
110 | 115 | ||
111 | accept(); | 116 | accept(); |
112 | } | 117 | } |
113 | 118 | ||
114 | 119 | ||
115 | void ModemTransfer::time_out_slot() { | 120 | void ModemTransfer::time_out_slot() |
121 | { | ||
116 | timeout_timer->stop(); | 122 | timeout_timer->stop(); |
117 | scripttimer->stop(); | 123 | scripttimer->stop(); |
118 | 124 | ||
@@ -121,26 +127,31 @@ void ModemTransfer::time_out_slot() { | |||
121 | } | 127 | } |
122 | 128 | ||
123 | 129 | ||
124 | void ModemTransfer::init() { | 130 | void ModemTransfer::init() |
131 | { | ||
125 | 132 | ||
126 | qApp->processEvents(); | 133 | qApp->processEvents(); |
127 | 134 | ||
128 | int lock = _modem->lockdevice(); | 135 | int lock = _modem->lockdevice(); |
129 | if (lock == 1) { | 136 | if (lock == 1) |
137 | { | ||
130 | 138 | ||
131 | statusBar->setText(QObject::tr("Modem device is locked.")); | 139 | statusBar->setText(QObject::tr("Modem device is locked.")); |
132 | return; | 140 | return; |
133 | } | 141 | } |
134 | 142 | ||
135 | if (lock == -1) { | 143 | if (lock == -1) |
144 | { | ||
136 | 145 | ||
137 | statusBar->setText(QObject::tr("Unable to create modem lock file.")); | 146 | statusBar->setText(QObject::tr("Unable to create modem lock file.")); |
138 | return; | 147 | return; |
139 | } | 148 | } |
140 | 149 | ||
141 | 150 | ||
142 | if(_modem->opentty()) { | 151 | if(_modem->opentty()) |
143 | if(_modem->hangup()) { | 152 | { |
153 | if(_modem->hangup()) | ||
154 | { | ||
144 | usleep(100000); // wait 0.1 secs | 155 | usleep(100000); // wait 0.1 secs |
145 | _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ... | 156 | _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ... |
146 | 157 | ||
@@ -165,11 +176,13 @@ void ModemTransfer::init() { | |||
165 | } | 176 | } |
166 | 177 | ||
167 | 178 | ||
168 | void ModemTransfer::do_script() { | 179 | void ModemTransfer::do_script() |
180 | { | ||
169 | QString msg; | 181 | QString msg; |
170 | QString query; | 182 | QString query; |
171 | 183 | ||
172 | switch(step) { | 184 | switch(step) |
185 | { | ||
173 | case 0: | 186 | case 0: |
174 | readtty(); | 187 | readtty(); |
175 | statusBar->setText("ATI..."); | 188 | statusBar->setText("ATI..."); |
@@ -199,12 +212,14 @@ void ModemTransfer::do_script() { | |||
199 | step++; | 212 | step++; |
200 | } | 213 | } |
201 | 214 | ||
202 | void ModemTransfer::readChar(unsigned char c) { | 215 | void ModemTransfer::readChar(unsigned char c) |
216 | { | ||
203 | if(readbuffer.length() < 255) | 217 | if(readbuffer.length() < 255) |
204 | readbuffer += c; | 218 | readbuffer += c; |
205 | } | 219 | } |
206 | 220 | ||
207 | void ModemTransfer::readtty() { | 221 | void ModemTransfer::readtty() |
222 | { | ||
208 | 223 | ||
209 | if (step == 0) | 224 | if (step == 0) |
210 | return; | 225 | return; |
@@ -220,7 +235,8 @@ void ModemTransfer::readtty() { | |||
220 | } | 235 | } |
221 | 236 | ||
222 | 237 | ||
223 | void ModemTransfer::cancelbutton() { | 238 | void ModemTransfer::cancelbutton() |
239 | { | ||
224 | scripttimer->stop(); | 240 | scripttimer->stop(); |
225 | _modem->stop(); | 241 | _modem->stop(); |
226 | timeout_timer->stop(); | 242 | timeout_timer->stop(); |
@@ -236,7 +252,8 @@ void ModemTransfer::cancelbutton() { | |||
236 | } | 252 | } |
237 | 253 | ||
238 | 254 | ||
239 | void ModemTransfer::closeEvent( QCloseEvent *e ) { | 255 | void ModemTransfer::closeEvent( QCloseEvent *e ) |
256 | { | ||
240 | cancelbutton(); | 257 | cancelbutton(); |
241 | e->accept(); | 258 | e->accept(); |
242 | } | 259 | } |
@@ -254,7 +271,8 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name) | |||
254 | 271 | ||
255 | QGridLayout *l1 = new QGridLayout(NUM_OF_ATI, 2, 5); | 272 | QGridLayout *l1 = new QGridLayout(NUM_OF_ATI, 2, 5); |
256 | tl->addLayout(l1, 1); | 273 | tl->addLayout(l1, 1); |
257 | for(int i = 0 ; i < NUM_OF_ATI ; i++) { | 274 | for(int i = 0 ; i < NUM_OF_ATI ; i++) |
275 | { | ||
258 | 276 | ||
259 | label_text = ""; | 277 | label_text = ""; |
260 | if ( i == 0) | 278 | if ( i == 0) |
@@ -286,7 +304,8 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name) | |||
286 | } | 304 | } |
287 | 305 | ||
288 | 306 | ||
289 | void ModemInfo::setAtiString(int i, QString s) { | 307 | void ModemInfo::setAtiString(int i, QString s) |
308 | { | ||
290 | if(i < NUM_OF_ATI) | 309 | if(i < NUM_OF_ATI) |
291 | ati_label_result[i]->setText(s); | 310 | ati_label_result[i]->setText(s); |
292 | } | 311 | } |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index f7dacf6..a7caffe 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -1,8 +1,3 @@ | |||
1 | #include <errno.h> | ||
2 | #include <signal.h> | ||
3 | |||
4 | |||
5 | #include <qpe/config.h> | ||
6 | 1 | ||
7 | #include "modem.h" | 2 | #include "modem.h" |
8 | #include "pppconfig.h" | 3 | #include "pppconfig.h" |
@@ -11,19 +6,32 @@ | |||
11 | #include "interfaceinformationppp.h" | 6 | #include "interfaceinformationppp.h" |
12 | #include "interfaceppp.h" | 7 | #include "interfaceppp.h" |
13 | 8 | ||
9 | /* OPIE */ | ||
10 | #include <qpe/config.h> | ||
11 | #include <qpe/qpeapplication.h> | ||
12 | |||
13 | /* QT */ | ||
14 | |||
15 | /* STD */ | ||
16 | #include <errno.h> | ||
17 | #include <signal.h> | ||
18 | |||
14 | // don't polute global namespace | 19 | // don't polute global namespace |
15 | namespace { | 20 | namespace |
21 | { | ||
16 | /* | 22 | /* |
17 | * If network settings is qutting and we've ppp | 23 | * If network settings is qutting and we've ppp |
18 | * devices open we need to save the pid_t the PPData | 24 | * devices open we need to save the pid_t the PPData |
19 | * and the interface number | 25 | * and the interface number |
20 | */ | 26 | */ |
21 | struct Connection { | 27 | struct Connection |
28 | { | ||
22 | pid_t pid; | 29 | pid_t pid; |
23 | QString device; | 30 | QString device; |
24 | QString name; | 31 | QString name; |
25 | }; | 32 | }; |
26 | class InterfaceKeeper { | 33 | class InterfaceKeeper |
34 | { | ||
27 | public: | 35 | public: |
28 | InterfaceKeeper(); | 36 | InterfaceKeeper(); |
29 | ~InterfaceKeeper(); | 37 | ~InterfaceKeeper(); |
@@ -53,14 +61,16 @@ PPPModule::PPPModule() : Module() | |||
53 | QMap<QString,QString>::Iterator it; | 61 | QMap<QString,QString>::Iterator it; |
54 | InterfacePPP *iface; | 62 | InterfacePPP *iface; |
55 | qDebug("getting interfaces"); | 63 | qDebug("getting interfaces"); |
56 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ | 64 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) |
65 | { | ||
57 | qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); | 66 | qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); |
58 | iface = new InterfacePPP( 0, it.key() ); | 67 | iface = new InterfacePPP( 0, it.key() ); |
59 | iface->setHardwareName( it.data() ); | 68 | iface->setHardwareName( it.data() ); |
60 | list.append( (Interface*)iface ); | 69 | list.append( (Interface*)iface ); |
61 | 70 | ||
62 | // check if (*it) is one of the running ifaces | 71 | // check if (*it) is one of the running ifaces |
63 | if ( running.contains( it.data() ) ) { | 72 | if ( running.contains( it.data() ) ) |
73 | { | ||
64 | qDebug("iface is running %s", it.key().latin1() ); | 74 | qDebug("iface is running %s", it.key().latin1() ); |
65 | handledInterfaceNames << running[it.data()].device; | 75 | handledInterfaceNames << running[it.data()].device; |
66 | iface->setStatus( true ); | 76 | iface->setStatus( true ); |
@@ -76,14 +86,17 @@ PPPModule::PPPModule() : Module() | |||
76 | /** | 86 | /** |
77 | * Delete any interfaces that we own. | 87 | * Delete any interfaces that we own. |
78 | */ | 88 | */ |
79 | PPPModule::~PPPModule(){ | 89 | PPPModule::~PPPModule() |
90 | { | ||
80 | qDebug("PPPModule::~PPPModule() " ); | 91 | qDebug("PPPModule::~PPPModule() " ); |
81 | QMap<QString,QString> ifaces; | 92 | QMap<QString,QString> ifaces; |
82 | InterfaceKeeper keeper; | 93 | InterfaceKeeper keeper; |
83 | Interface *i; | 94 | Interface *i; |
84 | for ( i=list.first(); i != 0; i=list.next() ){ | 95 | for ( i=list.first(); i != 0; i=list.next() ) |
96 | { | ||
85 | /* if online save the state */ | 97 | /* if online save the state */ |
86 | if ( i->getStatus() ) { | 98 | if ( i->getStatus() ) |
99 | { | ||
87 | qDebug("Iface %s is still up", i->getHardwareName().latin1() ); | 100 | qDebug("Iface %s is still up", i->getHardwareName().latin1() ); |
88 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); | 101 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); |
89 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); | 102 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); |
@@ -97,7 +110,8 @@ PPPModule::~PPPModule(){ | |||
97 | /** | 110 | /** |
98 | * Change the current profile | 111 | * Change the current profile |
99 | */ | 112 | */ |
100 | void PPPModule::setProfile(const QString &newProfile){ | 113 | void PPPModule::setProfile(const QString &newProfile) |
114 | { | ||
101 | profile = newProfile; | 115 | profile = newProfile; |
102 | } | 116 | } |
103 | 117 | ||
@@ -106,7 +120,8 @@ void PPPModule::setProfile(const QString &newProfile){ | |||
106 | * @param Interface* can be used in determining the icon. | 120 | * @param Interface* can be used in determining the icon. |
107 | * @return QString the icon name (minus .png, .gif etc) | 121 | * @return QString the icon name (minus .png, .gif etc) |
108 | */ | 122 | */ |
109 | QString PPPModule::getPixmapName(Interface* ){ | 123 | QString PPPModule::getPixmapName(Interface* ) |
124 | { | ||
110 | return "ppp"; | 125 | return "ppp"; |
111 | } | 126 | } |
112 | 127 | ||
@@ -115,7 +130,8 @@ QString PPPModule::getPixmapName(Interface* ){ | |||
115 | * @param Interface* interface to check against | 130 | * @param Interface* interface to check against |
116 | * @return bool true if i is owned by this module, false otherwise. | 131 | * @return bool true if i is owned by this module, false otherwise. |
117 | */ | 132 | */ |
118 | bool PPPModule::isOwner(Interface *i){ | 133 | bool PPPModule::isOwner(Interface *i) |
134 | { | ||
119 | return list.find( i ) != -1; | 135 | return list.find( i ) != -1; |
120 | } | 136 | } |
121 | 137 | ||
@@ -123,7 +139,8 @@ bool PPPModule::isOwner(Interface *i){ | |||
123 | * Create, and return the WLANConfigure Module | 139 | * Create, and return the WLANConfigure Module |
124 | * @return QWidget* pointer to this modules configure. | 140 | * @return QWidget* pointer to this modules configure. |
125 | */ | 141 | */ |
126 | QWidget *PPPModule::configure(Interface *i){ | 142 | QWidget *PPPModule::configure(Interface *i) |
143 | { | ||
127 | qDebug("return ModemWidget"); | 144 | qDebug("return ModemWidget"); |
128 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, | 145 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, |
129 | 0, "PPPConfig", false, | 146 | 0, "PPPConfig", false, |
@@ -135,7 +152,8 @@ QWidget *PPPModule::configure(Interface *i){ | |||
135 | * Create, and return the Information Module | 152 | * Create, and return the Information Module |
136 | * @return QWidget* pointer to this modules info. | 153 | * @return QWidget* pointer to this modules info. |
137 | */ | 154 | */ |
138 | QWidget *PPPModule::information(Interface *i){ | 155 | QWidget *PPPModule::information(Interface *i) |
156 | { | ||
139 | // We don't have any advanced pppd information widget yet :-D | 157 | // We don't have any advanced pppd information widget yet :-D |
140 | // TODO ^ | 158 | // TODO ^ |
141 | 159 | ||
@@ -147,7 +165,8 @@ QWidget *PPPModule::information(Interface *i){ | |||
147 | * @return QList<Interface> A list of interfaces that exsist that havn't | 165 | * @return QList<Interface> A list of interfaces that exsist that havn't |
148 | * been called by isOwner() | 166 | * been called by isOwner() |
149 | */ | 167 | */ |
150 | QList<Interface> PPPModule::getInterfaces(){ | 168 | QList<Interface> PPPModule::getInterfaces() |
169 | { | ||
151 | // List all of the files in the peer directory | 170 | // List all of the files in the peer directory |
152 | qDebug("PPPModule::getInterfaces"); | 171 | qDebug("PPPModule::getInterfaces"); |
153 | return list; | 172 | return list; |
@@ -159,19 +178,23 @@ QList<Interface> PPPModule::getInterfaces(){ | |||
159 | * by possibleNewInterfaces(); | 178 | * by possibleNewInterfaces(); |
160 | * @return Interface* NULL if it was unable to be created. | 179 | * @return Interface* NULL if it was unable to be created. |
161 | */ | 180 | */ |
162 | Interface *PPPModule::addNewInterface(const QString &newInterface){ | 181 | Interface *PPPModule::addNewInterface(const QString &newInterface) |
182 | { | ||
163 | 183 | ||
164 | InterfacePPP *ifaceppp; | 184 | InterfacePPP *ifaceppp; |
165 | Interface *iface; | 185 | Interface *iface; |
166 | ifaceppp = new InterfacePPP(); | 186 | ifaceppp = new InterfacePPP(); |
167 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); | 187 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); |
168 | imp.showMaximized(); | 188 | |
169 | if(imp.exec() == QDialog::Accepted ){ | 189 | if( QPEApplication::execDialog( &imp ) == QDialog::Accepted ) |
190 | { | ||
170 | iface = (InterfacePPP*) ifaceppp; | 191 | iface = (InterfacePPP*) ifaceppp; |
171 | iface->setModuleOwner( this ); | 192 | iface->setModuleOwner( this ); |
172 | list.append( iface ); | 193 | list.append( iface ); |
173 | return iface; | 194 | return iface; |
174 | }else { | 195 | } |
196 | else | ||
197 | { | ||
175 | delete ifaceppp; | 198 | delete ifaceppp; |
176 | iface = NULL; | 199 | iface = NULL; |
177 | } | 200 | } |
@@ -182,7 +205,8 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){ | |||
182 | * Attempts to remove the interface, doesn't delete i | 205 | * Attempts to remove the interface, doesn't delete i |
183 | * @return bool true if successful, false otherwise. | 206 | * @return bool true if successful, false otherwise. |
184 | */ | 207 | */ |
185 | bool PPPModule::remove(Interface *i){ | 208 | bool PPPModule::remove(Interface *i) |
209 | { | ||
186 | return list.remove(i); | 210 | return list.remove(i); |
187 | } | 211 | } |
188 | 212 | ||
@@ -194,37 +218,44 @@ void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) | |||
194 | 218 | ||
195 | 219 | ||
196 | 220 | ||
197 | namespace { | 221 | namespace |
198 | InterfaceKeeper::InterfaceKeeper( ) { | 222 | { |
199 | } | 223 | InterfaceKeeper::InterfaceKeeper( ) |
200 | InterfaceKeeper::~InterfaceKeeper() { | 224 | {} |
225 | InterfaceKeeper::~InterfaceKeeper() | ||
226 | { | ||
201 | Config cfg("ppp_plugin_keeper"); | 227 | Config cfg("ppp_plugin_keeper"); |
202 | QStringList lst = cfg.groupList(); | 228 | QStringList lst = cfg.groupList(); |
203 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 229 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) |
230 | { | ||
204 | Connection con; | 231 | Connection con; |
205 | cfg.setGroup( (*it) ); | 232 | cfg.setGroup( (*it) ); |
206 | cfg.clearGroup(); | 233 | cfg.clearGroup(); |
207 | } | 234 | } |
208 | 235 | ||
209 | for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) { | 236 | for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) |
237 | { | ||
210 | Connection con = it.data(); | 238 | Connection con = it.data(); |
211 | cfg.setGroup( con.name ); | 239 | cfg.setGroup( con.name ); |
212 | cfg.writeEntry( "pid", con.pid ); | 240 | cfg.writeEntry( "pid", con.pid ); |
213 | cfg.writeEntry( "device", con.device ); | 241 | cfg.writeEntry( "device", con.device ); |
214 | } | 242 | } |
215 | } | 243 | } |
216 | void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) { | 244 | void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) |
245 | { | ||
217 | Connection con; | 246 | Connection con; |
218 | con.pid = pid; | 247 | con.pid = pid; |
219 | con.device = dev; | 248 | con.device = dev; |
220 | con.name = name; | 249 | con.name = name; |
221 | m_interfaces.insert( name, con ); | 250 | m_interfaces.insert( name, con ); |
222 | } | 251 | } |
223 | QMap<QString, Connection> InterfaceKeeper::interfaces()const { | 252 | QMap<QString, Connection> InterfaceKeeper::interfaces()const |
253 | { | ||
224 | Config cfg("ppp_plugin_keeper"); | 254 | Config cfg("ppp_plugin_keeper"); |
225 | QMap<QString, Connection> ifaces; | 255 | QMap<QString, Connection> ifaces; |
226 | QStringList lst = cfg.groupList(); | 256 | QStringList lst = cfg.groupList(); |
227 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 257 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) |
258 | { | ||
228 | Connection con; | 259 | Connection con; |
229 | cfg.setGroup( (*it) ); | 260 | cfg.setGroup( (*it) ); |
230 | con.name = (*it); | 261 | con.name = (*it); |
@@ -237,8 +268,10 @@ namespace { | |||
237 | } | 268 | } |
238 | return ifaces; | 269 | return ifaces; |
239 | } | 270 | } |
240 | bool InterfaceKeeper::isAvailable( pid_t p)const { | 271 | bool InterfaceKeeper::isAvailable( pid_t p)const |
241 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) { | 272 | { |
273 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) | ||
274 | { | ||
242 | qDebug("isAvailable %d", p); | 275 | qDebug("isAvailable %d", p); |
243 | return true; | 276 | return true; |
244 | } | 277 | } |