summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/modeminfo.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/modeminfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/modeminfo.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/noncore/settings/networksettings/ppp/modeminfo.cpp b/noncore/settings/networksettings/ppp/modeminfo.cpp
index 0bec186..dbb26db 100644
--- a/noncore/settings/networksettings/ppp/modeminfo.cpp
+++ b/noncore/settings/networksettings/ppp/modeminfo.cpp
@@ -31,20 +31,18 @@
31// #include <kmessagebox.h> 31// #include <kmessagebox.h>
32// #include <kapplication.h> 32// #include <kapplication.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include "modeminfo.h" 35#include "modeminfo.h"
36#include "modem.h" 36#include "modem.h"
37//#include <klocale.h>
38#define i18n QObject::tr
39 37
40ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name) 38ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name)
41 : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder), 39 : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder),
42 _modem(mo) 40 _modem(mo)
43{ 41{
44 setCaption(i18n("ATI Query")); 42 setCaption(QObject::tr("ATI Query"));
45// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 43// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
46 44
47 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 45 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
48 46
49 progressBar = new QProgressBar(this, "bar"); 47 progressBar = new QProgressBar(this, "bar");
50 progressBar->setTotalSteps(8); 48 progressBar->setTotalSteps(8);
@@ -55,23 +53,23 @@ ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name)
55 53
56 // This is a rather complicated case. Since we do not know which 54 // This is a rather complicated case. Since we do not know which
57 // message is the widest in the national language, we'd to 55 // message is the widest in the national language, we'd to
58 // search all these messages. This is a little overkill, so I take 56 // search all these messages. This is a little overkill, so I take
59 // the longest english message, translate it and give it additional 57 // the longest english message, translate it and give it additional
60 // 20 percent space. Hope this is enough. 58 // 20 percent space. Hope this is enough.
61 statusBar->setText(i18n("Unable to create modem lock file.")); 59 statusBar->setText(QObject::tr("Unable to create modem lock file."));
62 statusBar->setFixedWidth((statusBar->sizeHint().width() * 12) / 10); 60 statusBar->setFixedWidth((statusBar->sizeHint().width() * 12) / 10);
63 statusBar->setFixedHeight(statusBar->sizeHint().height() + 4); 61 statusBar->setFixedHeight(statusBar->sizeHint().height() + 4);
64 62
65 // set original text 63 // set original text
66 statusBar->setText(i18n("Looking for modem...")); 64 statusBar->setText(QObject::tr("Looking for modem..."));
67 progressBar->setFixedHeight(statusBar->minimumSize().height()); 65 progressBar->setFixedHeight(statusBar->minimumSize().height());
68 tl->addWidget(progressBar); 66 tl->addWidget(progressBar);
69 tl->addWidget(statusBar); 67 tl->addWidget(statusBar);
70 68
71 cancel = new QPushButton(i18n("Cancel"), this); 69 cancel = new QPushButton(QObject::tr("Cancel"), this);
72 cancel->setFocus(); 70 cancel->setFocus();
73 connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton())); 71 connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton()));
74 72
75 QHBoxLayout *l1 = new QHBoxLayout; 73 QHBoxLayout *l1 = new QHBoxLayout;
76 tl->addLayout(l1); 74 tl->addLayout(l1);
77 l1->addStretch(1); 75 l1->addStretch(1);
@@ -115,41 +113,41 @@ void ModemTransfer::ati_done() {
115 113
116 114
117void ModemTransfer::time_out_slot() { 115void ModemTransfer::time_out_slot() {
118 timeout_timer->stop(); 116 timeout_timer->stop();
119 scripttimer->stop(); 117 scripttimer->stop();
120 118
121 QMessageBox::warning(this, tr("Error"), i18n("Modem Query timed out.")); 119 QMessageBox::warning(this, tr("Error"), QObject::tr("Modem Query timed out."));
122 reject(); 120 reject();
123} 121}
124 122
125 123
126void ModemTransfer::init() { 124void ModemTransfer::init() {
127 125
128 qApp->processEvents(); 126 qApp->processEvents();
129 127
130 int lock = _modem->lockdevice(); 128 int lock = _modem->lockdevice();
131 if (lock == 1) { 129 if (lock == 1) {
132 130
133 statusBar->setText(i18n("Modem device is locked.")); 131 statusBar->setText(QObject::tr("Modem device is locked."));
134 return; 132 return;
135 } 133 }
136 134
137 if (lock == -1) { 135 if (lock == -1) {
138 136
139 statusBar->setText(i18n("Unable to create modem lock file.")); 137 statusBar->setText(QObject::tr("Unable to create modem lock file."));
140 return; 138 return;
141 } 139 }
142 140
143 141
144 if(_modem->opentty()) { 142 if(_modem->opentty()) {
145 if(_modem->hangup()) { 143 if(_modem->hangup()) {
146 usleep(100000); // wait 0.1 secs 144 usleep(100000); // wait 0.1 secs
147 _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ... 145 _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ...
148 146
149 statusBar->setText(i18n("Modem Ready")); 147 statusBar->setText(QObject::tr("Modem Ready"));
150 qApp->processEvents(); 148 qApp->processEvents();
151 usleep(100000); // wait 0.1 secs 149 usleep(100000); // wait 0.1 secs
152 qApp->processEvents(); 150 qApp->processEvents();
153 scripttimer->start(1000); // this one does the ati query 151 scripttimer->start(1000); // this one does the ati query
154 152
155 // clear modem buffer 153 // clear modem buffer
@@ -224,13 +222,13 @@ void ModemTransfer::readtty() {
224 222
225void ModemTransfer::cancelbutton() { 223void ModemTransfer::cancelbutton() {
226 scripttimer->stop(); 224 scripttimer->stop();
227 _modem->stop(); 225 _modem->stop();
228 timeout_timer->stop(); 226 timeout_timer->stop();
229 227
230 statusBar->setText(i18n("One moment please...")); 228 statusBar->setText(QObject::tr("One moment please..."));
231 qApp->processEvents(); 229 qApp->processEvents();
232 230
233 _modem->hangup(); 231 _modem->hangup();
234 232
235 _modem->closetty(); 233 _modem->closetty();
236 _modem->unlockdevice(); 234 _modem->unlockdevice();
@@ -246,13 +244,13 @@ void ModemTransfer::closeEvent( QCloseEvent *e ) {
246 244
247ModemInfo::ModemInfo(QWidget *parent, const char* name) 245ModemInfo::ModemInfo(QWidget *parent, const char* name)
248 : QDialog(parent, name, TRUE, WStyle_Customize|WStyle_NormalBorder) 246 : QDialog(parent, name, TRUE, WStyle_Customize|WStyle_NormalBorder)
249{ 247{
250 QString label_text; 248 QString label_text;
251 249
252 setCaption(i18n("Modem Query Results")); 250 setCaption(QObject::tr("Modem Query Results"));
253 // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 251 // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
254 252
255 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 253 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
256 254
257 QGridLayout *l1 = new QGridLayout(NUM_OF_ATI, 2, 5); 255 QGridLayout *l1 = new QGridLayout(NUM_OF_ATI, 2, 5);
258 tl->addLayout(l1, 1); 256 tl->addLayout(l1, 1);
@@ -271,13 +269,13 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name)
271 ati_label_result[i]->setMinimumWidth(fontMetrics().width('H') * 24); 269 ati_label_result[i]->setMinimumWidth(fontMetrics().width('H') * 24);
272 l1->addWidget(ati_label_result[i], i, 1); 270 l1->addWidget(ati_label_result[i], i, 1);
273 } 271 }
274 //tl->addSpacing(1); 272 //tl->addSpacing(1);
275 273
276 QHBoxLayout *l2 = new QHBoxLayout; 274 QHBoxLayout *l2 = new QHBoxLayout;
277 QPushButton *ok = new QPushButton(i18n("Close"), this); 275 QPushButton *ok = new QPushButton(QObject::tr("Close"), this);
278 ok->setDefault(TRUE); 276 ok->setDefault(TRUE);
279 ok->setFocus(); 277 ok->setFocus();
280 278
281 tl->addLayout(l2); 279 tl->addLayout(l2);
282 l2->addStretch(1); 280 l2->addStretch(1);
283 281