From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kppp/connect.cpp | 182 +++++++++++++++++++++++++++---------------------------- 1 file changed, 91 insertions(+), 91 deletions(-) (limited to 'kppp/connect.cpp') diff --git a/kppp/connect.cpp b/kppp/connect.cpp index 01e615cc..0ab7f662 100644 --- a/kppp/connect.cpp +++ b/kppp/connect.cpp @@ -26,8 +26,8 @@ #include -#include -#include +#include +#include #include #include @@ -74,12 +74,12 @@ extern KPPPWidget *p_kppp; -QString old_hostname; +TQString old_hostname; bool modified_hostname; -ConnectWidget::ConnectWidget(QWidget *parent, const char *name, PPPStats *st) - : QWidget(parent, name), +ConnectWidget::ConnectWidget(TQWidget *parent, const char *name, PPPStats *st) + : TQWidget(parent, name), // initialize some important variables myreadbuffer(""), main_timer_ID(0), @@ -100,15 +100,15 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name, PPPStats *st) { modified_hostname = false; - QVBoxLayout *tl = new QVBoxLayout(this, 8, 10); - QString tit = i18n("Connecting to: "); + TQVBoxLayout *tl = new TQVBoxLayout(this, 8, 10); + TQString tit = i18n("Connecting to: "); setCaption(tit); - QHBoxLayout *l0 = new QHBoxLayout(10); + TQHBoxLayout *l0 = new TQHBoxLayout(10); tl->addLayout(l0); l0->addSpacing(10); - messg = new QLabel(this, "messg"); - messg->setFrameStyle(QFrame::Panel|QFrame::Sunken); + messg = new TQLabel(this, "messg"); + messg->setFrameStyle(TQFrame::Panel|TQFrame::Sunken); messg->setAlignment(AlignCenter); messg->setText(i18n("Unable to create modem lock file.")); messg->setMinimumHeight(messg->sizeHint().height() + 5); @@ -119,17 +119,17 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name, PPPStats *st) l0->addWidget(messg); l0->addSpacing(10); - QHBoxLayout *l1 = new QHBoxLayout(10); + TQHBoxLayout *l1 = new TQHBoxLayout(10); tl->addLayout(l1); l1->addStretch(1); - debug = new QPushButton(i18n("&Log"), this); + debug = new TQPushButton(i18n("&Log"), this); debug->setToggleButton(true); - connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); + connect(debug, TQT_SIGNAL(clicked()), TQT_SIGNAL(toggleDebugWindow())); cancel = new KPushButton(KStdGuiItem::cancel(), this); cancel->setFocus(); - connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton())); + connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(cancelbutton())); int maxw = QMAX(cancel->sizeHint().width(), debug->sizeHint().width()); @@ -142,25 +142,25 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name, PPPStats *st) setFixedSize(sizeHint()); - pausetimer = new QTimer(this); - connect(pausetimer, SIGNAL(timeout()), SLOT(pause())); + pausetimer = new TQTimer(this); + connect(pausetimer, TQT_SIGNAL(timeout()), TQT_SLOT(pause())); kapp->processEvents(); - timeout_timer = new QTimer(this); - connect(timeout_timer, SIGNAL(timeout()), SLOT(script_timed_out())); + timeout_timer = new TQTimer(this); + connect(timeout_timer, TQT_SIGNAL(timeout()), TQT_SLOT(script_timed_out())); - inittimer = new QTimer(this); - connect(inittimer, SIGNAL(timeout()), SLOT(init())); + inittimer = new TQTimer(this); + connect(inittimer, TQT_SIGNAL(timeout()), TQT_SLOT(init())); - if_timeout_timer = new QTimer(this); - connect(if_timeout_timer, SIGNAL(timeout()), SLOT(if_waiting_timed_out())); + if_timeout_timer = new TQTimer(this); + connect(if_timeout_timer, TQT_SIGNAL(timeout()), TQT_SLOT(if_waiting_timed_out())); - connect(this,SIGNAL(if_waiting_signal()),this,SLOT(if_waiting_slot())); + connect(this,TQT_SIGNAL(if_waiting_signal()),this,TQT_SLOT(if_waiting_slot())); prompt = new PWEntry( this, "pw" ); - if_timer = new QTimer(this); - connect(if_timer,SIGNAL(timeout()), SLOT(if_waiting_slot())); + if_timer = new TQTimer(this); + connect(if_timer,TQT_SIGNAL(timeout()), TQT_SLOT(if_waiting_slot())); } @@ -210,13 +210,13 @@ void ConnectWidget::init() { comlist = &gpppdata.scriptType(); arglist = &gpppdata.script(); - QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); + TQString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); setCaption(tit); kapp->processEvents(); // signal other applications that we are about to get connected - kapp->dcopClient()->emitDCOPSignal("KpppIface", "aboutToConnect()", QByteArray()); + kapp->dcopClient()->emitDCOPSignal("KpppIface", "aboutToConnect()", TQByteArray()); // run the "before-connect" command if (!gpppdata.command_before_connect().isEmpty()) { @@ -224,7 +224,7 @@ void ConnectWidget::init() { emit debugMessage(i18n("Running pre-startup command...")); kapp->processEvents(); - QApplication::flushX(); + TQApplication::flushX(); pid_t id = execute_command(gpppdata.command_before_connect()); int i, status; @@ -259,7 +259,7 @@ void ConnectWidget::init() { semaphore = false; Modem::modem->stop(); - Modem::modem->notify(this, SLOT(readChar(unsigned char))); + Modem::modem->notify(this, TQT_SLOT(readChar(unsigned char))); // if we are stuck anywhere we will time out timeout_timer->start(gpppdata.modemTimeout()*1000); @@ -278,7 +278,7 @@ void ConnectWidget::init() { } -void ConnectWidget::timerEvent(QTimerEvent *) { +void ConnectWidget::timerEvent(TQTimerEvent *) { if (semaphore || pausing) return; @@ -296,7 +296,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { substate = 0; } - QString initStr = gpppdata.modemInitStr(substate); + TQString initStr = gpppdata.modemInitStr(substate); if (!initStr.isEmpty()) { // send a carriage return and then wait a bit so that the modem will // let us issue commands. @@ -328,8 +328,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if (vmain == 5) { if(!expecting) { - QString sToneDuration = "ATS11=" + QString::number(gpppdata.modemToneDuration()); - QString msg = i18n("Setting ") + sToneDuration; + TQString sToneDuration = "ATS11=" + TQString::number(gpppdata.modemToneDuration()); + TQString msg = i18n("Setting ") + sToneDuration; messg->setText(msg); emit debugMessage(msg); setExpect(gpppdata.modemInitResp()); @@ -356,7 +356,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(i18n("Setting speaker volume...")); setExpect(gpppdata.modemInitResp()); - QString vol("AT"); + TQString vol("AT"); vol += gpppdata.volumeInitString(); writeline(vol); usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec @@ -368,7 +368,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(vmain == 4) { if(!expecting) { if(!gpppdata.waitForDialTone() || gpppdata.waitCallback()) { - QString msg = i18n("Turning off dial tone waiting..."); + TQString msg = i18n("Turning off dial tone waiting..."); messg->setText(msg); emit debugMessage(msg); setExpect(gpppdata.modemInitResp()); @@ -387,7 +387,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { timeout_timer->start(gpppdata.modemTimeout()*1000); if(gpppdata.waitCallback()) { - QString msg = i18n("Waiting for callback..."); + TQString msg = i18n("Waiting for callback..."); messg->setText(msg); emit debugMessage(msg); setExpect(gpppdata.modemRingResp()); @@ -395,14 +395,14 @@ void ConnectWidget::timerEvent(QTimerEvent *) { return; } - QStringList &plist = gpppdata.phonenumbers(); - QString bmarg= gpppdata.dialPrefix(); + TQStringList &plist = gpppdata.phonenumbers(); + TQString bmarg= gpppdata.dialPrefix(); bmarg += *plist.at(dialnumber); - QString bm = i18n("Dialing %1").arg(bmarg); + TQString bm = i18n("Dialing %1").arg(bmarg); messg->setText(bm); emit debugMessage(bm); - QString pn = gpppdata.modemDialStr(); + TQString pn = gpppdata.modemDialStr(); pn += gpppdata.dialPrefix(); pn += *plist.at(dialnumber); if(++dialnumber >= plist.count()) @@ -434,7 +434,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { Modem::modem->hangup(); if(gpppdata.busyWait() > 0) { - QString bm = i18n("Line busy. Waiting: %1 seconds").arg(gpppdata.busyWait()); + TQString bm = i18n("Line busy. Waiting: %1 seconds").arg(gpppdata.busyWait()); messg->setText(bm); emit debugMessage(bm); @@ -467,7 +467,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { timeout_timer->start(gpppdata.modemTimeout()*1000); if(gpppdata.busyWait() > 0) { - QString bm = i18n("No carrier. Waiting: %1 seconds").arg(gpppdata.busyWait()); + TQString bm = i18n("No carrier. Waiting: %1 seconds").arg(gpppdata.busyWait()); messg->setText(bm); emit debugMessage(bm); @@ -553,7 +553,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "Scan") { - QString bm = i18n("Scanning %1").arg(scriptArgument); + TQString bm = i18n("Scanning %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); @@ -563,7 +563,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "Save") { - QString bm = i18n("Saving %1").arg(scriptArgument); + TQString bm = i18n("Saving %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); @@ -581,12 +581,12 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") { - QString bm = i18n("Sending %1"); + TQString bm = i18n("Sending %1"); // replace %USERNAME% and %PASSWORD% - QString arg = scriptArgument; - QRegExp re1("%USERNAME%"); - QRegExp re2("%PASSWORD%"); + TQString arg = scriptArgument; + TQRegExp re1("%USERNAME%"); + TQRegExp re2("%PASSWORD%"); arg = arg.replace(re1, gpppdata.storedUsername()); arg = arg.replace(re2, gpppdata.storedPassword()); @@ -606,7 +606,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "Expect") { - QString bm = i18n("Expecting %1").arg(scriptArgument); + TQString bm = i18n("Expecting %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); @@ -620,7 +620,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if (scriptCommand == "Pause") { - QString bm = i18n("Pause %1 seconds").arg(scriptArgument); + TQString bm = i18n("Pause %1 seconds").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); @@ -637,7 +637,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { timeout_timer->stop(); - QString bm = i18n("Timeout %1 seconds").arg(scriptArgument); + TQString bm = i18n("Timeout %1 seconds").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); @@ -672,11 +672,11 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "ID") { - QString bm = i18n("ID %1").arg(scriptArgument); + TQString bm = i18n("ID %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); - QString idstring = gpppdata.storedUsername(); + TQString idstring = gpppdata.storedUsername(); if(!idstring.isEmpty() && firstrunID) { // the user entered an Id on the main kppp dialog @@ -708,11 +708,11 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "Password") { - QString bm = i18n("Password %1").arg(scriptArgument); + TQString bm = i18n("Password %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); - QString pwstring = gpppdata.password(); + TQString pwstring = gpppdata.password(); if(!pwstring.isEmpty() && firstrunPW) { // the user entered a password on the main kppp dialog @@ -745,13 +745,13 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "Prompt") { - QString bm = i18n("Prompting %1"); + TQString bm = i18n("Prompting %1"); // if the scriptindex (aka the prompt text) includes a ## marker // this marker should get substituted with the contents of our stored // variable (from the subsequent scan). - QString ts = scriptArgument; + TQString ts = scriptArgument; int vstart = ts.find( "##" ); if( vstart != -1 ) { ts.remove( vstart, 2 ); @@ -782,7 +782,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "PWPrompt") { - QString bm = i18n("PW Prompt %1").arg(scriptArgument); + TQString bm = i18n("PW Prompt %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); @@ -807,7 +807,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if (scriptCommand == "LoopStart") { - QString bm = i18n("Loop Start %1").arg(scriptArgument); + TQString bm = i18n("Loop Start %1").arg(scriptArgument); // The incrementing of the scriptindex MUST be before the // call to setExpect otherwise the expect will miss a string that is @@ -832,7 +832,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } if (scriptCommand == "LoopEnd") { - QString bm = i18n("Loop End %1").arg(scriptArgument); + TQString bm = i18n("Loop End %1").arg(scriptArgument); if ( loopnest <= 0 ) { bm = i18n("LoopEnd without matching Start. Line: %1").arg(bm); vmain=20; @@ -902,7 +902,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } } - // Close the tty. This prevents the QTimer::singleShot() in + // Close the tty. This prevents the TQTimer::singleShot() in // Modem::readtty() from re-enabling the socket notifier. // The port is still held open by the helper process. Modem::modem->closetty(); @@ -1003,7 +1003,7 @@ void ConnectWidget::checkBuffers() { scanvar = scanvar.stripWhiteSpace(); // Show the Variabel content in the debug window - QString sv = i18n("Scan Var: %1").arg(scanvar); + TQString sv = i18n("Scan Var: %1").arg(scanvar); emit debugMessage(sv); } @@ -1013,7 +1013,7 @@ void ConnectWidget::checkBuffers() { // keep everything after the expected string readbuffer.remove(0, readbuffer.find(expectstr) + expectstr.length()); - QString ts = i18n("Found: %1").arg(expectstr); + TQString ts = i18n("Found: %1").arg(expectstr); emit debugMessage(ts); if (loopend) { @@ -1024,7 +1024,7 @@ void ConnectWidget::checkBuffers() { if (loopend && readbuffer.contains(loopstr[loopnest])) { expecting = false; readbuffer = ""; - QString ts = i18n("Looping: %1").arg(loopstr[loopnest]); + TQString ts = i18n("Looping: %1").arg(loopstr[loopnest]); emit debugMessage(ts); scriptindex = loopstartindex[loopnest]; loopend = false; @@ -1032,7 +1032,7 @@ void ConnectWidget::checkBuffers() { } // notify event loop if expected string was found if(!expecting) - timerEvent((QTimerEvent *) 0); + timerEvent((TQTimerEvent *) 0); } } @@ -1112,22 +1112,22 @@ void ConnectWidget::script_timed_out() { } -void ConnectWidget::setScan(const QString &n) { +void ConnectWidget::setScan(const TQString &n) { scanning = true; scanstr = n; scanbuffer = ""; - QString ts = i18n("Scanning: %1").arg(n); + TQString ts = i18n("Scanning: %1").arg(n); emit debugMessage(ts); } -void ConnectWidget::setExpect(const QString &n) { +void ConnectWidget::setExpect(const TQString &n) { expecting = true; expectstr = n; - QString ts = i18n("Expecting: %1").arg(n); - ts.replace(QRegExp("\n"), ""); + TQString ts = i18n("Expecting: %1").arg(n); + ts.replace(TQRegExp("\n"), ""); emit debugMessage(ts); // check if the expected string is in the read buffer already. @@ -1192,7 +1192,7 @@ void ConnectWidget::if_waiting_slot() { auto_hostname(); // signal other applications that we are connected now - kapp->dcopClient()->emitDCOPSignal("KpppIface", "connected()", QByteArray()); + kapp->dcopClient()->emitDCOPSignal("KpppIface", "connected()", TQByteArray()); if(!gpppdata.command_on_connect().isEmpty()) { messg->setText(i18n("Running startup command...")); @@ -1239,7 +1239,7 @@ void ConnectWidget::if_waiting_slot() { bool ConnectWidget::execppp() { - QString command; + TQString command; command = "pppd"; @@ -1276,7 +1276,7 @@ bool ConnectWidget::execppp() { // the english/i18n mix below is ugly but we want to keep working // after someone changed the code to use i18n'ed config values - QString flowCtrl = gpppdata.flowcontrol(); + TQString flowCtrl = gpppdata.flowcontrol(); if(flowCtrl != "None" && flowCtrl != i18n("None")) { if(flowCtrl == "CRTSCTS" || flowCtrl == "Hardware [CRTSCTS]" || flowCtrl == i18n("Hardware [CRTSCTS]")) @@ -1291,8 +1291,8 @@ bool ConnectWidget::execppp() { if(gpppdata.autoDNS()) command += " usepeerdns"; - QStringList &arglist = gpppdata.pppdArgument(); - for ( QStringList::Iterator it = arglist.begin(); + TQStringList &arglist = gpppdata.pppdArgument(); + for ( TQStringList::Iterator it = arglist.begin(); it != arglist.end(); ++it ) { @@ -1308,7 +1308,7 @@ bool ConnectWidget::execppp() { } else { command += " callback "; command += gpppdata.callbackType() == CBTYPE_ADMIN ? - QString("0") : gpppdata.callbackPhone(); + TQString("0") : gpppdata.callbackPhone(); } } else gpppdata.setWaitCallback(false); @@ -1350,17 +1350,17 @@ bool ConnectWidget::execppp() { } -void ConnectWidget::closeEvent( QCloseEvent *e ) { +void ConnectWidget::closeEvent( TQCloseEvent *e ) { e->ignore(); emit cancelbutton(); } -void ConnectWidget::setMsg(const QString &msg) { +void ConnectWidget::setMsg(const TQString &msg) { messg->setText(msg); } -void ConnectWidget::writeline(const QString &s) { +void ConnectWidget::writeline(const TQString &s) { Modem::modem->writeLine(s.local8Bit()); } @@ -1368,7 +1368,7 @@ void ConnectWidget::writeline(const QString &s) { void auto_hostname() { struct in_addr local_ip; struct hostent *hostname_entry; - QString new_hostname; + TQString new_hostname; int dot; char tmp_str[100]; // buffer overflow safe @@ -1398,11 +1398,11 @@ void auto_hostname() { // Replace the DNS domain entry in the /etc/resolv.conf file and // disable the nameserver entries if option is enabled -void add_domain(const QString &domain) { +void add_domain(const TQString &domain) { int fd; char c; - QString resolv[MAX_RESOLVCONF_LINES]; + TQString resolv[MAX_RESOLVCONF_LINES]; if (domain.isEmpty()) return; @@ -1422,7 +1422,7 @@ void add_domain(const QString &domain) { if ((c != '\n') && (i < MAX_RESOLVCONF_LINES)) i++; if((fd = Requester::rq->openResolv(O_WRONLY|O_TRUNC)) >= 0) { - QCString tmp = "domain " + domain.local8Bit() + + TQCString tmp = "domain " + domain.local8Bit() + " \t\t#kppp temp entry\n"; write(fd, tmp.data(), tmp.length()); @@ -1432,12 +1432,12 @@ void add_domain(const QString &domain) { && !resolv[j].contains("#kppp temp entry") && gpppdata.exDNSDisabled())) && !resolv[j].contains("#entry disabled by kppp")) { - QCString tmp = "# " + resolv[j].local8Bit() + + TQCString tmp = "# " + resolv[j].local8Bit() + " \t#entry disabled by kppp\n"; write(fd, tmp, tmp.length()); } else { - QCString tmp = resolv[j].local8Bit() + "\n"; + TQCString tmp = resolv[j].local8Bit() + "\n"; write(fd, tmp, tmp.length()); } } @@ -1453,12 +1453,12 @@ void adddns() int fd; if ((fd = Requester::rq->openResolv(O_WRONLY|O_APPEND)) >= 0) { - QStringList &dnslist = gpppdata.dns(); - for ( QStringList::Iterator it = dnslist.begin(); + TQStringList &dnslist = gpppdata.dns(); + for ( TQStringList::Iterator it = dnslist.begin(); it != dnslist.end(); ++it ) { - QCString dns = "nameserver " + (*it).local8Bit() + + TQCString dns = "nameserver " + (*it).local8Bit() + " \t#kppp temp entry\n"; write(fd, dns.data(), dns.length()); } @@ -1493,7 +1493,7 @@ void removedns() { int fd; char c; - QString resolv[MAX_RESOLVCONF_LINES]; + TQString resolv[MAX_RESOLVCONF_LINES]; if((fd = Requester::rq->openResolv(O_RDONLY)) >= 0) { @@ -1512,12 +1512,12 @@ void removedns() { for(int j=0; j < i; j++) { if(resolv[j].contains("#kppp temp entry")) continue; if(resolv[j].contains("#entry disabled by kppp")) { - QCString tmp = resolv[j].local8Bit(); + TQCString tmp = resolv[j].local8Bit(); write(fd, tmp.data()+2, tmp.length() - 27); write(fd, "\n", 1); } else { - QCString tmp = resolv[j].local8Bit() + "\n"; + TQCString tmp = resolv[j].local8Bit() + "\n"; write(fd, tmp, tmp.length()); } } -- cgit v1.2.3