diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:25:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:25:18 +0000 |
commit | aa3a1ca934bc541bddd3fa136a85f106f7da266e (patch) | |
tree | 9ad0b795aed8fa4ac30c2fe0fd1aacb8175714c0 /kpackage/kpPty.cpp | |
parent | b10cf7066791a2f362495890cd50c984e8025412 (diff) | |
download | tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.tar.gz tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1157635 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpackage/kpPty.cpp')
-rw-r--r-- | kpackage/kpPty.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/kpackage/kpPty.cpp b/kpackage/kpPty.cpp index b395483..23eb15f 100644 --- a/kpackage/kpPty.cpp +++ b/kpackage/kpPty.cpp @@ -27,8 +27,8 @@ #include "../config.h" -#include <qtimer.h> -#include <qregexp.h> +#include <tqtimer.h> +#include <tqregexp.h> #include <kprocctrl.h> #include <kpty.h> @@ -49,7 +49,7 @@ const int PROMPT = -1; extern Opts *opts; ////////////////////////////////////////////////////////////////////////////// -kpKProcIO::kpKProcIO ( QTextCodec *_codec) +kpKProcIO::kpKProcIO ( TQTextCodec *_codec) : KProcIO(_codec) { } @@ -61,38 +61,38 @@ kpKProcIO::~kpKProcIO() bool kpKProcIO::sstart (RunMode runmode) { - connect (this, SIGNAL (receivedStdout (KProcess *, char *, int)), - this, SLOT (received (KProcess *, char *, int))); + connect (this, TQT_SIGNAL (receivedStdout (KProcess *, char *, int)), + this, TQT_SLOT (received (KProcess *, char *, int))); - connect (this, SIGNAL (wroteStdin(KProcess *)), - this, SLOT (sent (KProcess *))); + connect (this, TQT_SIGNAL (wroteStdin(KProcess *)), + this, TQT_SLOT (sent (KProcess *))); return KProcess::start (runmode,( KProcess::Communication) ( KProcess::Stdin | KProcess::Stdout)); } ////////////////////////////////////////////////////////////////////////////// -kpPty::kpPty() : QObject() +kpPty::kpPty() : TQObject() { pty = new kpKProcIO(); pty->setUsePty(KProcess::All, false); - connect(pty, SIGNAL(readReady(KProcIO *)), this, - SLOT(readLines())); - connect(pty, SIGNAL(processExited(KProcess *)), this, - SLOT(done())); + connect(pty, TQT_SIGNAL(readReady(KProcIO *)), this, + TQT_SLOT(readLines())); + connect(pty, TQT_SIGNAL(processExited(KProcess *)), this, + TQT_SLOT(done())); pty->pty()->setWinSize(0,80); - tm = new QTimer(this); - connect(tm, SIGNAL(timeout()), this, SLOT(slotTimeout())); + tm = new TQTimer(this); + connect(tm, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout())); eventLoop = FALSE; inSession = FALSE; pUnterm = FALSE; loginSession = FALSE; - codec = QTextCodec::codecForLocale(); - QMap<QString, QCString> passwords; + codec = TQTextCodec::codecForLocale(); + TQMap<TQString, TQCString> passwords; } @@ -147,14 +147,14 @@ bool kpPty::startSession(bool needRoot) kdDebug() << "kpPty::startSession TRUE\n"; loginSession = TRUE; int ret; - QString s = "echo START=$?\n"; + TQString s = "echo START=$?\n"; FULL_RESTART: interact = FALSE; retList.clear(); pty->resetAll(); - QString passMsg; + TQString passMsg; kdDebug() << "privCmd=" << opts->privCmd << "\n"; if (opts->privCmd == Opts::SSHcmd || !hostName.isEmpty()) { passMsg = i18n("The action you requested uses ssh. Please enter the password or pass phrase.\n"); @@ -189,7 +189,7 @@ bool kpPty::startSession(bool needRoot) inSession = TRUE; } } else if (Result == PASSWORD) { // We got a password prompt - QCString pass; + TQCString pass; int res; interact = TRUE; // kdDebug() << "H=" << hostName << " PH=" << passwords[hostName] << " PT=" << passwordTried <<"\n"; @@ -198,7 +198,7 @@ bool kpPty::startSession(bool needRoot) res = 1; } else { kdDebug() << "Passwd=" << retList.last() << "\n"; - QString msg = passMsg; + TQString msg = passMsg; // kdDebug() << "privCmd=" << opts->privCmd << " host=" << hostName.isEmpty() << "\n"; if (opts->privCmd == Opts::SSHcmd || !hostName.isEmpty()) { msg += retList.last(); @@ -224,11 +224,11 @@ bool kpPty::startSession(bool needRoot) inSession = TRUE; kdDebug() << "kpPty::startSession TRUE\n"; } else { // process return code - pty->writeStdin(QCString("\04"), false); // SU doesn't listen to ^C + pty->writeStdin(TQCString("\04"), false); // SU doesn't listen to ^C if (interact) { goto FULL_RESTART; } else { - QString errMsg = retList.join(" "); + TQString errMsg = retList.join(" "); KpMsgE(errMsg, TRUE); inSession = FALSE; } @@ -244,15 +244,15 @@ bool kpPty::startSession(bool needRoot) return inSession; } -void kpPty::breakUpCmd(const QString &cmd) +void kpPty::breakUpCmd(const TQString &cmd) { kdDebug() << " kpPty::run CMD=\""<< cmd <<"\" pty = " << pty << endl; bool quote = FALSE; - QString s; - QStringList cl = QStringList::split(" ", cmd); + TQString s; + TQStringList cl = TQStringList::split(" ", cmd); - for ( QStringList::Iterator it = cl.begin(); it != cl.end(); ++it ) { + for ( TQStringList::Iterator it = cl.begin(); it != cl.end(); ++it ) { int lastPt = (*it).length() - 1; if ((*it)[0] == '\'') { // Start of quoted string s = *it; @@ -278,7 +278,7 @@ void kpPty::breakUpCmd(const QString &cmd) } } -QStringList kpPty::run(const QString &cmd, bool inLoop, bool needRoot) +TQStringList kpPty::run(const TQString &cmd, bool inLoop, bool needRoot) { Result = 0; @@ -296,7 +296,7 @@ QStringList kpPty::run(const QString &cmd, bool inLoop, bool needRoot) } else { if (startSession(needRoot)) { kdDebug() << "CMDroot='"<< cmd <<"'\n"; - QString s = cmd + ";echo RESULT=$?"; + TQString s = cmd + ";echo RESULT=$?"; pty->writeStdin(s); kdDebug() << " kpPty::run session\n"; } else { @@ -331,7 +331,7 @@ void kpPty::finish(int ret) { kdDebug() << "kpPty::finish " << ret << "\n"; - QStringList::Iterator l; + TQStringList::Iterator l; Result = ret; if (ret == PROMPT) { // Called program executed in session @@ -375,14 +375,14 @@ void kpPty::readLines() { bool unterm = FALSE; - QString stext; + TQString stext; while(pty->readln(stext, false, &unterm) >= 0) { stext = codec->toUnicode(stext.ascii(), stext.length()); emit textIn(stext, !unterm); // kdDebug() << "[" << pUnterm << "-" << unterm << "-" << stext << ">\n"; if (pUnterm) { - QStringList::Iterator lst = retList.fromLast(); + TQStringList::Iterator lst = retList.fromLast(); if (lst != retList.end()) { stext = *lst + stext; @@ -410,7 +410,7 @@ void kpPty::readLines() emit textIn("\r \n", false); finish(PROMPT); } else if (loginSession) { - QRegExp rx( "^[^:]+:[\\s]*$"); // Password prompt + TQRegExp rx( "^[^:]+:[\\s]*$"); // Password prompt if (rx.search(retList.last()) >= 0) { kdDebug() << loginSession << " " <<retList.last()<< " Match password p\n"; finish(PASSWORD); @@ -422,7 +422,7 @@ void kpPty::readLines() void kpPty::keyOut(char ch) { - QCString s(2); + TQCString s(2); s[0] = ch; s[1] = '\0'; pty->writeStdin(s, false); @@ -431,7 +431,7 @@ void kpPty::keyOut(char ch) void kpPty::done() { int ret = pty->exitStatus(); - QString stext; + TQString stext; //kdDebug() << "Done (" << ret << ")" << endl; |