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 @@ -23,18 +23,22 @@ * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <unistd.h> +#include "modeminfo.h" +#include "modem.h" + +/* OPIE */ +#include <qpe/qpeapplication.h> + +/* QT */ #include <qregexp.h> #include <qlayout.h> -// #include <kwin.h> -// #include <kmessagebox.h> -// #include <kapplication.h> #include <qmessagebox.h> #include <qapplication.h> -#include "modeminfo.h" -#include "modem.h" + +/* STD */ +#include <unistd.h> ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name) : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder), _modem(mo) @@ -92,9 +96,10 @@ ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name) } -void ModemTransfer::ati_done() { +void ModemTransfer::ati_done() +{ scripttimer->stop(); timeout_timer->stop(); _modem->closetty(); _modem->unlockdevice(); @@ -103,45 +108,51 @@ void ModemTransfer::ati_done() { // open the result window ModemInfo *mi = new ModemInfo(this); for(int i = 0; i < NUM_OF_ATI; i++) mi->setAtiString(i, ati_query_strings[i]); - mi->showMaximized(); - mi->exec(); + + QPEApplication::execDialog( mi ); delete mi; accept(); } -void ModemTransfer::time_out_slot() { +void ModemTransfer::time_out_slot() +{ timeout_timer->stop(); scripttimer->stop(); QMessageBox::warning(this, tr("Error"), QObject::tr("Modem Query timed out.")); reject(); } -void ModemTransfer::init() { +void ModemTransfer::init() +{ qApp->processEvents(); int lock = _modem->lockdevice(); - if (lock == 1) { + if (lock == 1) + { statusBar->setText(QObject::tr("Modem device is locked.")); return; } - if (lock == -1) { + if (lock == -1) + { statusBar->setText(QObject::tr("Unable to create modem lock file.")); return; } - if(_modem->opentty()) { - if(_modem->hangup()) { + if(_modem->opentty()) + { + if(_modem->hangup()) + { usleep(100000); // wait 0.1 secs _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ... statusBar->setText(QObject::tr("Modem Ready")); @@ -164,13 +175,15 @@ void ModemTransfer::init() { _modem->unlockdevice(); } -void ModemTransfer::do_script() { +void ModemTransfer::do_script() +{ QString msg; QString query; - switch(step) { + switch(step) + { case 0: readtty(); statusBar->setText("ATI..."); progressBar->setProgress( progressBar->progress() + 1); @@ -198,14 +211,16 @@ void ModemTransfer::do_script() { } step++; } -void ModemTransfer::readChar(unsigned char c) { +void ModemTransfer::readChar(unsigned char c) +{ if(readbuffer.length() < 255) readbuffer += c; } -void ModemTransfer::readtty() { +void ModemTransfer::readtty() +{ if (step == 0) return; @@ -219,9 +234,10 @@ void ModemTransfer::readtty() { readbuffer = ""; } -void ModemTransfer::cancelbutton() { +void ModemTransfer::cancelbutton() +{ scripttimer->stop(); _modem->stop(); timeout_timer->stop(); @@ -235,9 +251,10 @@ void ModemTransfer::cancelbutton() { reject(); } -void ModemTransfer::closeEvent( QCloseEvent *e ) { +void ModemTransfer::closeEvent( QCloseEvent *e ) +{ cancelbutton(); e->accept(); } @@ -253,9 +270,10 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name) QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QGridLayout *l1 = new QGridLayout(NUM_OF_ATI, 2, 5); tl->addLayout(l1, 1); - for(int i = 0 ; i < NUM_OF_ATI ; i++) { + for(int i = 0 ; i < NUM_OF_ATI ; i++) + { label_text = ""; if ( i == 0) label_text.sprintf("ATI :"); @@ -285,9 +303,10 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name) setMinimumSize(sizeHint()); } -void ModemInfo::setAtiString(int i, QString s) { +void ModemInfo::setAtiString(int i, QString s) +{ if(i < NUM_OF_ATI) ati_label_result[i]->setText(s); } |