Diffstat (limited to 'noncore/settings/networksettings/ppp/modeminfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modeminfo.cpp | 65 |
1 files changed, 42 insertions, 23 deletions
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 | } |