diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
commit | c663b6440964f6ac48027143ac9e63298991f9d0 (patch) | |
tree | 6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /kioslave/sftp | |
parent | a061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff) | |
download | tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/sftp')
-rw-r--r-- | kioslave/sftp/kio_sftp.cpp | 220 | ||||
-rw-r--r-- | kioslave/sftp/kio_sftp.h | 44 | ||||
-rw-r--r-- | kioslave/sftp/ksshprocess.cpp | 114 | ||||
-rw-r--r-- | kioslave/sftp/ksshprocess.h | 50 | ||||
-rw-r--r-- | kioslave/sftp/ksshprocesstest.cpp | 8 | ||||
-rw-r--r-- | kioslave/sftp/process.cpp | 24 | ||||
-rw-r--r-- | kioslave/sftp/process.h | 42 | ||||
-rw-r--r-- | kioslave/sftp/sftpfileattr.cpp | 22 | ||||
-rw-r--r-- | kioslave/sftp/sftpfileattr.h | 32 |
9 files changed, 278 insertions, 278 deletions
diff --git a/kioslave/sftp/kio_sftp.cpp b/kioslave/sftp/kio_sftp.cpp index e6aaaf532..456d47084 100644 --- a/kioslave/sftp/kio_sftp.cpp +++ b/kioslave/sftp/kio_sftp.cpp @@ -29,12 +29,12 @@ So we can't connect. #include <fcntl.h> -#include <qcstring.h> -#include <qstring.h> -#include <qobject.h> -#include <qstrlist.h> -#include <qfile.h> -#include <qbuffer.h> +#include <tqcstring.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqstrlist.h> +#include <tqfile.h> +#include <tqbuffer.h> #include <stdlib.h> #include <unistd.h> @@ -131,7 +131,7 @@ static int writeToFile (int fd, const char *buf, size_t len) return 0; } -sftpProtocol::sftpProtocol(const QCString &pool_socket, const QCString &app_socket) +sftpProtocol::sftpProtocol(const TQCString &pool_socket, const TQCString &app_socket) : SlaveBase("kio_sftp", pool_socket, app_socket), mConnected(false), mPort(-1), mMsgId(0) { kdDebug(KIO_SFTP_DB) << "sftpProtocol(): pid = " << getpid() << endl; @@ -203,7 +203,7 @@ void sftpProtocol::copy(const KURL &src, const KURL &dest, int permissions, bool else if ( destLocal && !srcLocal ) // Copy sftp -> file sftpCopyGet(dest, src, permissions, overwrite); else - error(ERR_UNSUPPORTED_ACTION, QString::null); + error(ERR_UNSUPPORTED_ACTION, TQString::null); } void sftpProtocol::sftpCopyGet(const KURL& dest, const KURL& src, int mode, bool overwrite) @@ -216,7 +216,7 @@ void sftpProtocol::sftpCopyGet(const KURL& dest, const KURL& src, int mode, bool return; KDE_struct_stat buff_orig; - QCString dest_orig ( QFile::encodeName(dest.path()) ); + TQCString dest_orig ( TQFile::encodeName(dest.path()) ); bool origExists = (KDE_lstat( dest_orig.data(), &buff_orig ) != -1); if (origExists) @@ -235,7 +235,7 @@ void sftpProtocol::sftpCopyGet(const KURL& dest, const KURL& src, int mode, bool } KIO::filesize_t offset = 0; - QCString dest_part ( dest_orig + ".part" ); + TQCString dest_part ( dest_orig + ".part" ); int fd = -1; bool partExists = false; @@ -319,7 +319,7 @@ void sftpProtocol::sftpCopyGet(const KURL& dest, const KURL& src, int mode, bool } } - data(QByteArray()); + data(TQByteArray()); kdDebug(KIO_SFTP_DB) << "sftpCopyGet(): emit finished()" << endl; finished(); } @@ -351,7 +351,7 @@ sftpProtocol::Status sftpProtocol::sftpGet( const KURL& src, KIO::filesize_t off Q_UINT32 pflags = SSH2_FXF_READ; attr.clear(); - QByteArray handle; + TQByteArray handle; if( (code = sftpOpen(src, pflags, attr, handle)) != SSH2_FX_OK ) { res.text = src.prettyURL(); res.code = ERR_CANNOT_OPEN_FOR_READING; @@ -360,8 +360,8 @@ sftpProtocol::Status sftpProtocol::sftpGet( const KURL& src, KIO::filesize_t off // needed for determining mimetype // note: have to emit mimetype before emitting totalsize. - QByteArray buff; - QByteArray mimeBuffer; + TQByteArray buff; + TQByteArray mimeBuffer; unsigned int oldSize; bool foundMimetype = false; @@ -463,13 +463,13 @@ void sftpProtocol::get(const KURL& url) { return; } - data(QByteArray()); + data(TQByteArray()); kdDebug(KIO_SFTP_DB) << "get(): emit finished()" << endl; finished(); } -void sftpProtocol::setHost (const QString& h, int port, const QString& user, const QString& pass) +void sftpProtocol::setHost (const TQString& h, int port, const TQString& user, const TQString& pass) { kdDebug(KIO_SFTP_DB) << "setHost(): " << user << "@" << h << ":" << port << endl; @@ -524,7 +524,7 @@ void sftpProtocol::openConnection() { info.url.setPort(mPort); info.url.setUser(mUsername); info.caption = i18n("SFTP Login"); - info.comment = "sftp://" + mHost + ":" + QString::number(mPort); + info.comment = "sftp://" + mHost + ":" + TQString::number(mPort); info.commentLabel = i18n("site:"); info.username = mUsername; info.keepPassword = true; @@ -608,8 +608,8 @@ void sftpProtocol::openConnection() { // int err; // error code from KSshProcess - QString msg; // msg for dialog box - QString caption; // dialog box caption + TQString msg; // msg for dialog box + TQString caption; // dialog box caption bool firstTime = true; bool dlgResult; @@ -647,7 +647,7 @@ void sftpProtocol::openConnection() { } else { // user canceled or dialog failed to open - error(ERR_USER_CANCELED, QString::null); + error(ERR_USER_CANCELED, TQString::null); kdDebug(KIO_SFTP_DB) << "openConnection(): user canceled, dlgResult = " << dlgResult << endl; closeConnection(); return; @@ -704,7 +704,7 @@ void sftpProtocol::openConnection() { msg = ssh.errorMsg(); if( KMessageBox::Yes != messageBox(WarningYesNo, msg, caption) ) { closeConnection(); - error(ERR_USER_CANCELED, QString::null); + error(ERR_USER_CANCELED, TQString::null); return; } ssh.acceptHostKey(true); @@ -715,7 +715,7 @@ void sftpProtocol::openConnection() { msg = ssh.errorMsg(); if( KMessageBox::Yes != messageBox(WarningYesNo, msg, caption) ) { closeConnection(); - error(ERR_USER_CANCELED, QString::null); + error(ERR_USER_CANCELED, TQString::null); return; } ssh.acceptHostKey(true); @@ -764,14 +764,14 @@ void sftpProtocol::openConnection() { // catch all in case we did something wrong above if( !mConnected ) { - error(ERR_INTERNAL, QString::null); + error(ERR_INTERNAL, TQString::null); return; } // Now send init packet. kdDebug(KIO_SFTP_DB) << "openConnection(): Sending SSH2_FXP_INIT packet." << endl; - QByteArray p; - QDataStream packet(p, IO_WriteOnly); + TQByteArray p; + TQDataStream packet(p, IO_WriteOnly); packet << (Q_UINT32)5; // packet length packet << (Q_UINT8) SSH2_FXP_INIT; // packet type packet << (Q_UINT32)SSH2_FILEXFER_VERSION; // client version @@ -779,7 +779,7 @@ void sftpProtocol::openConnection() { putPacket(p); getPacket(p); - QDataStream s(p, IO_ReadOnly); + TQDataStream s(p, IO_ReadOnly); Q_UINT32 version; Q_UINT8 type; s >> type; @@ -837,7 +837,7 @@ void sftpProtocol::closeConnection() { void sftpProtocol::sftpCopyPut(const KURL& src, const KURL& dest, int permissions, bool overwrite) { KDE_struct_stat buff; - QCString file (QFile::encodeName(src.path())); + TQCString file (TQFile::encodeName(src.path())); if (KDE_lstat(file.data(), &buff) == -1) { error (ERR_DOES_NOT_EXIST, src.prettyURL()); @@ -985,7 +985,7 @@ void sftpProtocol::sftpPut( const KURL& dest, int permissions, bool resume, bool pflags = SSH2_FXF_WRITE | SSH2_FXF_CREAT | SSH2_FXF_APPEND; sftpFileAttr attr(remoteEncoding()); - QByteArray handle; + TQByteArray handle; // Set the permissions of the file we write to if it didn't already exist // and the permission info is supplied, i.e it is not -1 @@ -1013,7 +1013,7 @@ void sftpProtocol::sftpPut( const KURL& dest, int permissions, bool resume, bool } long nbytes; - QByteArray buff; + TQByteArray buff; do { @@ -1108,7 +1108,7 @@ void sftpProtocol::stat ( const KURL& url ){ UDSAtom atom; atom.m_uds = KIO::UDS_NAME; - atom.m_str = QString::null; + atom.m_str = TQString::null; entry.append( atom ); atom.m_uds = KIO::UDS_FILE_TYPE; @@ -1158,7 +1158,7 @@ void sftpProtocol::mimetype ( const KURL& url ){ return; Q_UINT32 pflags = SSH2_FXF_READ; - QByteArray handle, mydata; + TQByteArray handle, mydata; sftpFileAttr attr(remoteEncoding()); int code; if( (code = sftpOpen(url, pflags, attr, handle)) != SSH2_FX_OK ) { @@ -1180,7 +1180,7 @@ void sftpProtocol::mimetype ( const KURL& url ){ } - data(QByteArray()); + data(TQByteArray()); processedSize(offset); sftpClose(handle); finished(); @@ -1206,7 +1206,7 @@ void sftpProtocol::listDir(const KURL& url) { } int code; - QByteArray handle; + TQByteArray handle; if( (code = sftpOpenDirectory(url, handle)) != SSH2_FX_OK ) { kdError(KIO_SFTP_DB) << "listDir(): open directory failed" << endl; @@ -1248,7 +1248,7 @@ void sftpProtocol::mkdir(const KURL&url, int permissions){ if( !mConnected ) return; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); sftpFileAttr attr(remoteEncoding()); @@ -1259,8 +1259,8 @@ void sftpProtocol::mkdir(const KURL&url, int permissions){ Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << Q_UINT32(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len + attr.size()); s << (Q_UINT8)SSH2_FXP_MKDIR; s << id; @@ -1273,7 +1273,7 @@ void sftpProtocol::mkdir(const KURL&url, int permissions){ getPacket(p); Q_UINT8 type; - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); r >> type >> id; if( id != expectedId ) { @@ -1359,7 +1359,7 @@ void sftpProtocol::rename(const KURL& src, const KURL& dest, bool overwrite){ kdDebug(KIO_SFTP_DB) << "rename(): END" << endl; } -void sftpProtocol::symlink(const QString& target, const KURL& dest, bool overwrite){ +void sftpProtocol::symlink(const TQString& target, const KURL& dest, bool overwrite){ kdDebug(KIO_SFTP_DB) << "symlink()" << endl; if (!isSupportedOperation(SSH2_FXP_SYMLINK)) { @@ -1410,7 +1410,7 @@ void sftpProtocol::symlink(const QString& target, const KURL& dest, bool overwri } void sftpProtocol::chmod(const KURL& url, int permissions){ - QString perms; + TQString perms; perms.setNum(permissions, 8); kdDebug(KIO_SFTP_DB) << "chmod(" << url << ", " << perms << ")" << endl; @@ -1427,7 +1427,7 @@ void sftpProtocol::chmod(const KURL& url, int permissions){ if( (code = sftpSetStat(url, attr)) != SSH2_FX_OK ) { kdError(KIO_SFTP_DB) << "chmod(): sftpSetStat failed with error " << code << endl; if( code == SSH2_FX_FAILURE ) - error(ERR_CANNOT_CHMOD, QString::null); + error(ERR_CANNOT_CHMOD, TQString::null); else processStatus(code, url.prettyURL()); } @@ -1454,11 +1454,11 @@ void sftpProtocol::slave_status() { kdDebug(KIO_SFTP_DB) << "slave_status(): connected to " << mHost << "? " << mConnected << endl; - slaveStatus ((mConnected ? mHost : QString::null), mConnected); + slaveStatus ((mConnected ? mHost : TQString::null), mConnected); } -bool sftpProtocol::getPacket(QByteArray& msg) { - QByteArray buf(4096); +bool sftpProtocol::getPacket(TQByteArray& msg) { + TQByteArray buf(4096); // Get the message length... ssize_t len = atomicio(ssh.stdioFd(), buf.data(), 4, true /*read*/); @@ -1473,21 +1473,21 @@ bool sftpProtocol::getPacket(QByteArray& msg) { } uint msgLen; - QDataStream s(buf, IO_ReadOnly); + TQDataStream s(buf, IO_ReadOnly); s >> msgLen; //kdDebug(KIO_SFTP_DB) << "getPacket(): Message size = " << msgLen << endl; msg.resize(0); - QBuffer b( msg ); + TQBuffer b( msg ); b.open( IO_WriteOnly ); while( msgLen ) { len = atomicio(ssh.stdioFd(), buf.data(), kMin(buf.size(), msgLen), true /*read*/); if( len == 0 || len == -1) { - QString errmsg; + TQString errmsg; if (len == 0) errmsg = i18n("Connection closed"); else @@ -1514,7 +1514,7 @@ bool sftpProtocol::getPacket(QByteArray& msg) { } /** Send an sftp packet to stdin of the ssh process. */ -bool sftpProtocol::putPacket(QByteArray& p){ +bool sftpProtocol::putPacket(TQByteArray& p){ // kdDebug(KIO_SFTP_DB) << "putPacket(): size == " << p.size() << endl; int ret; ret = atomicio(ssh.stdioFd(), p.data(), p.size(), false /*write*/); @@ -1535,14 +1535,14 @@ int sftpProtocol::sftpRealPath(const KURL& url, KURL& newUrl){ kdDebug(KIO_SFTP_DB) << "sftpRealPath(" << url << ", newUrl)" << endl; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << Q_UINT32(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len); s << (Q_UINT8)SSH2_FXP_REALPATH; s << id; @@ -1552,7 +1552,7 @@ int sftpProtocol::sftpRealPath(const KURL& url, KURL& newUrl){ getPacket(p); Q_UINT8 type; - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); r >> type >> id; if( id != expectedId ) { @@ -1578,7 +1578,7 @@ int sftpProtocol::sftpRealPath(const KURL& url, KURL& newUrl){ return -1; } - QCString newPath; + TQCString newPath; r >> newPath; newPath.truncate(newPath.size()); @@ -1589,7 +1589,7 @@ int sftpProtocol::sftpRealPath(const KURL& url, KURL& newUrl){ return SSH2_FX_OK; } -sftpProtocol::Status sftpProtocol::doProcessStatus(Q_UINT8 code, const QString& message) +sftpProtocol::Status sftpProtocol::doProcessStatus(Q_UINT8 code, const TQString& message) { Status res; res.code = 0; @@ -1628,25 +1628,25 @@ sftpProtocol::Status sftpProtocol::doProcessStatus(Q_UINT8 code, const QString& } /** Process SSH_FXP_STATUS packets. */ -void sftpProtocol::processStatus(Q_UINT8 code, const QString& message){ +void sftpProtocol::processStatus(Q_UINT8 code, const TQString& message){ Status st = doProcessStatus( code, message ); if( st.code != 0 ) error( st.code, st.text ); } /** Opens a directory handle for url.path. Returns true if succeeds. */ -int sftpProtocol::sftpOpenDirectory(const KURL& url, QByteArray& handle){ +int sftpProtocol::sftpOpenDirectory(const KURL& url, TQByteArray& handle){ kdDebug(KIO_SFTP_DB) << "sftpOpenDirectory(" << url << ", handle)" << endl; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len); s << (Q_UINT8)SSH2_FXP_OPENDIR; s << (Q_UINT32)id; @@ -1655,7 +1655,7 @@ int sftpProtocol::sftpOpenDirectory(const KURL& url, QByteArray& handle){ putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -1687,15 +1687,15 @@ int sftpProtocol::sftpOpenDirectory(const KURL& url, QByteArray& handle){ } /** Closes a directory or file handle. */ -int sftpProtocol::sftpClose(const QByteArray& handle){ +int sftpProtocol::sftpClose(const TQByteArray& handle){ kdDebug(KIO_SFTP_DB) << "sftpClose()" << endl; Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + handle.size()); s << (Q_UINT8)SSH2_FXP_CLOSE; s << (Q_UINT32)id; @@ -1704,7 +1704,7 @@ int sftpProtocol::sftpClose(const QByteArray& handle){ putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -1732,14 +1732,14 @@ int sftpProtocol::sftpSetStat(const KURL& url, const sftpFileAttr& attr){ kdDebug(KIO_SFTP_DB) << "sftpSetStat(" << url << ", attr)" << endl; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len + attr.size()); s << (Q_UINT8)SSH2_FXP_SETSTAT; s << (Q_UINT32)id; @@ -1749,7 +1749,7 @@ int sftpProtocol::sftpSetStat(const KURL& url, const sftpFileAttr& attr){ putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -1778,14 +1778,14 @@ int sftpProtocol::sftpRemove(const KURL& url, bool isfile){ kdDebug(KIO_SFTP_DB) << "sftpRemove(): " << url << ", isFile ? " << isfile << endl; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len); s << (Q_UINT8)(isfile ? SSH2_FXP_REMOVE : SSH2_FXP_RMDIR); s << (Q_UINT32)id; @@ -1794,7 +1794,7 @@ int sftpProtocol::sftpRemove(const KURL& url, bool isfile){ putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -1822,8 +1822,8 @@ int sftpProtocol::sftpRename(const KURL& src, const KURL& dest){ kdDebug(KIO_SFTP_DB) << "sftpRename(" << src << " -> " << dest << ")" << endl; - QCString srcPath = remoteEncoding()->encode(src.path()); - QCString destPath = remoteEncoding()->encode(dest.path()); + TQCString srcPath = remoteEncoding()->encode(src.path()); + TQCString destPath = remoteEncoding()->encode(dest.path()); uint slen = srcPath.length(); uint dlen = destPath.length(); @@ -1831,8 +1831,8 @@ int sftpProtocol::sftpRename(const KURL& src, const KURL& dest){ Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + slen + 4 /*str length*/ + dlen); @@ -1844,7 +1844,7 @@ int sftpProtocol::sftpRename(const KURL& src, const KURL& dest){ putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -1867,7 +1867,7 @@ int sftpProtocol::sftpRename(const KURL& src, const KURL& dest){ return code; } /** Get directory listings. */ -int sftpProtocol::sftpReadDir(const QByteArray& handle, const KURL& url){ +int sftpProtocol::sftpReadDir(const TQByteArray& handle, const KURL& url){ // url is needed so we can lookup the link destination kdDebug(KIO_SFTP_DB) << "sftpReadDir(): " << url << endl; @@ -1877,8 +1877,8 @@ int sftpProtocol::sftpReadDir(const QByteArray& handle, const KURL& url){ sftpFileAttr attr (remoteEncoding()); attr.setDirAttrsFlag(true); - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); id = expectedId = mMsgId++; s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + handle.size()); s << (Q_UINT8)SSH2_FXP_READDIR; @@ -1888,7 +1888,7 @@ int sftpProtocol::sftpReadDir(const QByteArray& handle, const KURL& url){ putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); r >> type >> id; if( id != expectedId ) { @@ -1933,11 +1933,11 @@ int sftpProtocol::sftpReadDir(const QByteArray& handle, const KURL& url){ return SSH2_FX_OK; } -int sftpProtocol::sftpReadLink(const KURL& url, QString& target){ +int sftpProtocol::sftpReadLink(const KURL& url, TQString& target){ kdDebug(KIO_SFTP_DB) << "sftpReadLink(): " << url << endl; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); //kdDebug(KIO_SFTP_DB) << "sftpReadLink(): Encoded Path: " << path << endl; @@ -1946,8 +1946,8 @@ int sftpProtocol::sftpReadLink(const KURL& url, QString& target){ Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len); s << (Q_UINT8)SSH2_FXP_READLINK; s << id; @@ -1958,7 +1958,7 @@ int sftpProtocol::sftpReadLink(const KURL& url, QString& target){ getPacket(p); Q_UINT8 type; - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); r >> type >> id; if( id != expectedId ) { @@ -1985,7 +1985,7 @@ int sftpProtocol::sftpReadLink(const KURL& url, QString& target){ return -1; } - QCString linkAddress; + TQCString linkAddress; r >> linkAddress; linkAddress.truncate(linkAddress.size()); @@ -1996,10 +1996,10 @@ int sftpProtocol::sftpReadLink(const KURL& url, QString& target){ return SSH2_FX_OK; } -int sftpProtocol::sftpSymLink(const QString& _target, const KURL& dest){ +int sftpProtocol::sftpSymLink(const TQString& _target, const KURL& dest){ - QCString destPath = remoteEncoding()->encode(dest.path()); - QCString target = remoteEncoding()->encode(_target); + TQCString destPath = remoteEncoding()->encode(dest.path()); + TQCString target = remoteEncoding()->encode(_target); uint dlen = destPath.length(); uint tlen = target.length(); @@ -2008,8 +2008,8 @@ int sftpProtocol::sftpSymLink(const QString& _target, const KURL& dest){ Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + tlen + 4 /*str length*/ + dlen); @@ -2021,7 +2021,7 @@ int sftpProtocol::sftpSymLink(const QString& _target, const KURL& dest){ putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -2049,14 +2049,14 @@ int sftpProtocol::sftpStat(const KURL& url, sftpFileAttr& attr) { kdDebug(KIO_SFTP_DB) << "sftpStat(): " << url << endl; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len); s << (Q_UINT8)SSH2_FXP_LSTAT; s << (Q_UINT32)id; @@ -2065,7 +2065,7 @@ int sftpProtocol::sftpStat(const KURL& url, sftpFileAttr& attr) { putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -2094,7 +2094,7 @@ int sftpProtocol::sftpStat(const KURL& url, sftpFileAttr& attr) { // to determine the actual destination's type (file/dir). if( S_ISLNK(attr.permissions()) && isSupportedOperation(SSH2_FXP_READLINK) ) { - QString target; + TQString target; int code = sftpReadLink( url, target ); if ( code != SSH2_FX_OK ) { @@ -2134,17 +2134,17 @@ int sftpProtocol::sftpStat(const KURL& url, sftpFileAttr& attr) { int sftpProtocol::sftpOpen(const KURL& url, const Q_UINT32 pflags, - const sftpFileAttr& attr, QByteArray& handle) { + const sftpFileAttr& attr, TQByteArray& handle) { kdDebug(KIO_SFTP_DB) << "sftpOpen(" << url << ", handle" << endl; - QCString path = remoteEncoding()->encode(url.path()); + TQCString path = remoteEncoding()->encode(url.path()); uint len = path.length(); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); s << (Q_UINT32)(1 /*type*/ + 4 /*id*/ + 4 /*str length*/ + len + 4 /*pflags*/ + attr.size()); @@ -2157,7 +2157,7 @@ int sftpProtocol::sftpOpen(const KURL& url, const Q_UINT32 pflags, putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -2188,11 +2188,11 @@ int sftpProtocol::sftpOpen(const KURL& url, const Q_UINT32 pflags, } -int sftpProtocol::sftpRead(const QByteArray& handle, KIO::filesize_t offset, Q_UINT32 len, QByteArray& data) +int sftpProtocol::sftpRead(const TQByteArray& handle, KIO::filesize_t offset, Q_UINT32 len, TQByteArray& data) { // kdDebug(KIO_SFTP_DB) << "sftpRead( offset = " << offset << ", len = " << len << ")" << endl; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; @@ -2208,7 +2208,7 @@ int sftpProtocol::sftpRead(const QByteArray& handle, KIO::filesize_t offset, Q_U putPacket(p); getPacket(p); - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; @@ -2235,11 +2235,11 @@ int sftpProtocol::sftpRead(const QByteArray& handle, KIO::filesize_t offset, Q_U } -int sftpProtocol::sftpWrite(const QByteArray& handle, KIO::filesize_t offset, const QByteArray& data){ +int sftpProtocol::sftpWrite(const TQByteArray& handle, KIO::filesize_t offset, const TQByteArray& data){ // kdDebug(KIO_SFTP_DB) << "sftpWrite( offset = " << offset << // ", data sz = " << data.size() << ")" << endl; - QByteArray p; - QDataStream s(p, IO_WriteOnly); + TQByteArray p; + TQDataStream s(p, IO_WriteOnly); Q_UINT32 id, expectedId; id = expectedId = mMsgId++; @@ -2263,7 +2263,7 @@ int sftpProtocol::sftpWrite(const QByteArray& handle, KIO::filesize_t offset, co // kdDebug(KIO_SFTP_DB) << "sftpWrite(): received packet [" << p << "]" << endl; - QDataStream r(p, IO_ReadOnly); + TQDataStream r(p, IO_ReadOnly); Q_UINT8 type; r >> type >> id; diff --git a/kioslave/sftp/kio_sftp.h b/kioslave/sftp/kio_sftp.h index ff99b4760..22cd4764a 100644 --- a/kioslave/sftp/kio_sftp.h +++ b/kioslave/sftp/kio_sftp.h @@ -17,9 +17,9 @@ #ifndef __kio_sftp_h__ #define __kio_sftp_h__ -#include <qstring.h> -#include <qcstring.h> -#include <qobject.h> +#include <tqstring.h> +#include <tqcstring.h> +#include <tqobject.h> #include <kurl.h> #include <kio/global.h> @@ -37,9 +37,9 @@ class sftpProtocol : public KIO::SlaveBase { public: - sftpProtocol(const QCString &pool_socket, const QCString &app_socket); + sftpProtocol(const TQCString &pool_socket, const TQCString &app_socket); virtual ~sftpProtocol(); - virtual void setHost(const QString& h, int port, const QString& user, const QString& pass); + virtual void setHost(const TQString& h, int port, const TQString& user, const TQString& pass); virtual void get(const KURL& url); virtual void listDir(const KURL& url) ; virtual void mimetype(const KURL& url); @@ -50,7 +50,7 @@ public: virtual void slave_status(); virtual void del(const KURL &url, bool isfile); virtual void chmod(const KURL& url, int permissions); - virtual void symlink(const QString& target, const KURL& dest, bool overwrite); + virtual void symlink(const TQString& target, const KURL& dest, bool overwrite); virtual void rename(const KURL& src, const KURL& dest, bool overwrite); virtual void mkdir(const KURL&url, int permissions); virtual void openConnection(); @@ -60,7 +60,7 @@ private: // Private variables bool mConnected; /** Host we are connected to. */ - QString mHost; + TQString mHost; /** Port we are connected to. */ int mPort; @@ -69,10 +69,10 @@ private: // Private variables KSshProcess ssh; /** Username to use when connecting */ - QString mUsername; + TQString mUsername; /** User's password */ - QString mPassword; + TQString mPassword; /** Message id of the last sftp packet we sent. */ unsigned int mMsgId; @@ -87,11 +87,11 @@ private: // Private variables { int code; KIO::filesize_t size; - QString text; + TQString text; }; private: // private methods - bool getPacket(QByteArray& msg); + bool getPacket(TQByteArray& msg); /* Type is a sftp packet type found in .sftp.h'. * Example: SSH2_FXP_READLINK, SSH2_FXP_RENAME, etc. @@ -107,15 +107,15 @@ private: // private methods int sftpRealPath(const KURL& url, KURL& newUrl); /** Send an sftp packet to stdin of the ssh process. */ - bool putPacket(QByteArray& p); + bool putPacket(TQByteArray& p); /** Process SSH_FXP_STATUS packets. */ - void processStatus(Q_UINT8, const QString& message = QString::null); + void processStatus(Q_UINT8, const TQString& message = TQString::null); /** Process SSH_FXP_STATUS packes and return the result. */ - Status doProcessStatus(Q_UINT8, const QString& message = QString::null); + Status doProcessStatus(Q_UINT8, const TQString& message = TQString::null); /** Opens a directory handle for url.path. Returns true if succeeds. */ - int sftpOpenDirectory(const KURL& url, QByteArray& handle); + int sftpOpenDirectory(const KURL& url, TQByteArray& handle); /** Closes a directory or file handle. */ - int sftpClose(const QByteArray& handle); + int sftpClose(const TQByteArray& handle); /** Send a sftp command to rename a file or directoy. */ int sftpRename(const KURL& src, const KURL& dest); /** Set a files attributes. */ @@ -123,19 +123,19 @@ private: // private methods /** Sends a sftp command to remove a file or directory. */ int sftpRemove(const KURL& url, bool isfile); /** Creates a symlink named dest to target. */ - int sftpSymLink(const QString& target, const KURL& dest); + int sftpSymLink(const TQString& target, const KURL& dest); /** Get directory listings. */ - int sftpReadDir(const QByteArray& handle, const KURL& url); + int sftpReadDir(const TQByteArray& handle, const KURL& url); /** Retrieves the destination of a link. */ - int sftpReadLink(const KURL& url, QString& target); + int sftpReadLink(const KURL& url, TQString& target); /** Stats a file. */ int sftpStat(const KURL& url, sftpFileAttr& attr); /** No descriptions */ - int sftpOpen(const KURL& url, const Q_UINT32 pflags, const sftpFileAttr& attr, QByteArray& handle); + int sftpOpen(const KURL& url, const Q_UINT32 pflags, const sftpFileAttr& attr, TQByteArray& handle); /** No descriptions */ - int sftpRead(const QByteArray& handle, KIO::filesize_t offset, Q_UINT32 len, QByteArray& data); + int sftpRead(const TQByteArray& handle, KIO::filesize_t offset, Q_UINT32 len, TQByteArray& data); /** No descriptions */ - int sftpWrite(const QByteArray& handle, KIO::filesize_t offset, const QByteArray& data); + int sftpWrite(const TQByteArray& handle, KIO::filesize_t offset, const TQByteArray& data); /** Performs faster upload when the source is a local file... */ void sftpCopyPut(const KURL& src, const KURL& dest, int mode, bool overwrite); diff --git a/kioslave/sftp/ksshprocess.cpp b/kioslave/sftp/ksshprocess.cpp index c0393445d..9b2323bd6 100644 --- a/kioslave/sftp/ksshprocess.cpp +++ b/kioslave/sftp/ksshprocess.cpp @@ -67,7 +67,7 @@ #include <kstandarddirs.h> #include <klocale.h> -#include <qregexp.h> +#include <tqregexp.h> /* * The following are tables of string and regexps we match @@ -82,10 +82,10 @@ * so that is matched last. We use these generic version strings * so we can do a best effor to support unknown ssh versions. */ -QRegExp KSshProcess::versionStrs[] = { - QRegExp("OpenSSH_3\\.[6-9]|OpenSSH_[1-9]*[4-9]\\.[0-9]"), - QRegExp("OpenSSH"), - QRegExp("SSH Secure Shell") +TQRegExp KSshProcess::versionStrs[] = { + TQRegExp("OpenSSH_3\\.[6-9]|OpenSSH_[1-9]*[4-9]\\.[0-9]"), + TQRegExp("OpenSSH"), + TQRegExp("SSH Secure Shell") }; const char * const KSshProcess::passwordPrompt[] = { @@ -118,10 +118,10 @@ const char* const KSshProcess::tryAgainMsg[] = { "adjfhjsdhfdsjfsjdfhuefeufeuefe" }; -QRegExp KSshProcess::hostKeyMissingMsg[] = { - QRegExp("The authenticity of host|No (DSA|RSA) host key is known for"), - QRegExp("The authenticity of host|No (DSA|RSA) host key is known for"), - QRegExp("Host key not found from database") +TQRegExp KSshProcess::hostKeyMissingMsg[] = { + TQRegExp("The authenticity of host|No (DSA|RSA) host key is known for"), + TQRegExp("The authenticity of host|No (DSA|RSA) host key is known for"), + TQRegExp("Host key not found from database") }; const char* const KSshProcess::continuePrompt[] = { @@ -136,16 +136,16 @@ const char* const KSshProcess::hostKeyChangedMsg[] = { "WARNING: HOST IDENTIFICATION HAS CHANGED!" }; -QRegExp KSshProcess::keyFingerprintMsg[] = { - QRegExp("..(:..){15}"), - QRegExp("..(:..){15}"), - QRegExp(".....(-.....){10}") +TQRegExp KSshProcess::keyFingerprintMsg[] = { + TQRegExp("..(:..){15}"), + TQRegExp("..(:..){15}"), + TQRegExp(".....(-.....){10}") }; -QRegExp KSshProcess::knownHostsFileMsg[] = { - QRegExp("Add correct host key in (.*) to get rid of this message."), - QRegExp("Add correct host key in (.*) to get rid of this message."), - QRegExp("Add correct host key to \"(.*)\"") +TQRegExp KSshProcess::knownHostsFileMsg[] = { + TQRegExp("Add correct host key in (.*) to get rid of this message."), + TQRegExp("Add correct host key in (.*) to get rid of this message."), + TQRegExp("Add correct host key to \"(.*)\"") }; @@ -164,10 +164,10 @@ const char* const KSshProcess::changeHostKeyOnDiskPrompt[] = { // quit. The later if StrictHostKeyChecking is "no". // The former if StrictHostKeyChecking is // "yes" or explicitly set to "ask". -QRegExp KSshProcess::hostKeyVerifyFailedMsg[] = { - QRegExp("Host key verification failed\\."), - QRegExp("Host key verification failed\\."), - QRegExp("Disconnected; key exchange or algorithm? negotiation failed \\(Key exchange failed\\.\\)\\.") +TQRegExp KSshProcess::hostKeyVerifyFailedMsg[] = { + TQRegExp("Host key verification failed\\."), + TQRegExp("Host key verification failed\\."), + TQRegExp("Disconnected; key exchange or algorithm? negotiation failed \\(Key exchange failed\\.\\)\\.") }; const char * const KSshProcess::connectionClosedMsg[] = { @@ -206,14 +206,14 @@ void KSshProcess::removeSignalHandlers() { KSshProcess::KSshProcess() : mVersion(UNKNOWN_VER), mConnected(false), mRunning(false), mConnectState(0) { - mSshPath = KStandardDirs::findExe(QString::fromLatin1("ssh")); + mSshPath = KStandardDirs::findExe(TQString::fromLatin1("ssh")); kdDebug(KSSHPROC) << "KSshProcess::KSshProcess(): ssh path [" << mSshPath << "]" << endl; installSignalHandlers(); } -KSshProcess::KSshProcess(QString pathToSsh) +KSshProcess::KSshProcess(TQString pathToSsh) : mSshPath(pathToSsh), mVersion(UNKNOWN_VER), mConnected(false), mRunning(false), mConnectState(0) { installSignalHandlers(); @@ -225,7 +225,7 @@ KSshProcess::~KSshProcess(){ while(waitpid(-1, NULL, WNOHANG) > 0); } -bool KSshProcess::setSshPath(QString pathToSsh) { +bool KSshProcess::setSshPath(TQString pathToSsh) { mSshPath = pathToSsh; version(); if( mVersion == UNKNOWN_VER ) @@ -235,7 +235,7 @@ bool KSshProcess::setSshPath(QString pathToSsh) { } KSshProcess::SshVersion KSshProcess::version() { - QString cmd; + TQString cmd; cmd = mSshPath+" -V 2>&1"; // Get version string from ssh client. @@ -259,7 +259,7 @@ KSshProcess::SshVersion KSshProcess::version() { kdError(KSSHPROC) << "KSshProcess::version(): pclose failed." << endl; } buf[len] = '\0'; - QString ver; + TQString ver; ver = buf; kdDebug(KSSHPROC) << "KSshProcess::version(): " "got version string [" << ver << "]" << endl; @@ -285,14 +285,14 @@ KSshProcess::SshVersion KSshProcess::version() { return mVersion; } /* -QString KSshProcess::versionStr() { +TQString KSshProcess::versionStr() { if( mVersion == UNKNOWN_VER ) { version(); if( mVersion == UNKNOWN_VER ) - return QString::null; + return TQString::null; } - return QString::fromLatin1(versionStrs[mVersion]); + return TQString::fromLatin1(versionStrs[mVersion]); } */ @@ -300,9 +300,9 @@ bool KSshProcess::setOptions(const SshOptList& opts) { kdDebug(KSSHPROC) << "KSshProcess::setOptions()" << endl; mArgs.clear(); SshOptListConstIterator it; - QString cmd, subsystem; - mPassword = mUsername = mHost = QString::null; - QCString tmp; + TQString cmd, subsystem; + mPassword = mUsername = mHost = TQString::null; + TQCString tmp; for(it = opts.begin(); it != opts.end(); ++it) { //kdDebug(KSSHPROC) << "opt.opt = " << (*it).opt << endl; //kdDebug(KSSHPROC) << "opt.str = " << (*it).str << endl; @@ -340,7 +340,7 @@ bool KSshProcess::setOptions(const SshOptList& opts) { case SSH_PROTOCOL: if( mVersion <= OPENSSH ) { tmp = "Protocol="; - tmp += QString::number((*it).num).latin1(); + tmp += TQString::number((*it).num).latin1(); mArgs.append("-o"); mArgs.append(tmp); } @@ -445,14 +445,14 @@ bool KSshProcess::setOptions(const SshOptList& opts) { } void KSshProcess::printArgs() { - QValueListIterator<QCString> it; + TQValueListIterator<TQCString> it; for( it = mArgs.begin(); it != mArgs.end(); ++it) { kdDebug(KSSHPROC) << "arg: " << *it << endl; } } -int KSshProcess::error(QString& msg) { +int KSshProcess::error(TQString& msg) { kdDebug(KSSHPROC) << "KSshProcess::error()" << endl; kdDebug() << mErrorMsg << endl; msg = mErrorMsg; @@ -539,15 +539,15 @@ void KSshProcess::acceptHostKey(bool accept) { mAcceptHostKey = accept; } -void KSshProcess::setPassword(QString password) { +void KSshProcess::setPassword(TQString password) { kdDebug(KSSHPROC) << "KSshProcess::setPassword(password:xxxxxxxx)" << endl; mPassword = password; } -QString KSshProcess::getLine() { - static QStringList buffer; - QString line = QString::null; - QCString ptyLine, errLine; +TQString KSshProcess::getLine() { + static TQStringList buffer; + TQString line = TQString::null; + TQCString ptyLine, errLine; if( buffer.empty() ) { // PtyProcess buffers lines. First check that there @@ -559,11 +559,11 @@ QString KSshProcess::getLine() { // If PtyProcess did have something for us, get it and // place it in our line buffer. if( ! ptyLine.isEmpty() ) { - buffer.prepend(QString(ptyLine)); + buffer.prepend(TQString(ptyLine)); } if( ! errLine.isEmpty() ) { - buffer.prepend(QString(errLine)); + buffer.prepend(TQString(errLine)); } // If we still don't have anything in our buffer so there must @@ -602,13 +602,13 @@ QString KSshProcess::getLine() { kdDebug(KSSHPROC) << "KSshProcess::connect(): " << "timed out waiting for a response" << endl; mError = ERR_TIMED_OUT; - return QString::null; + return TQString::null; } else if( ret == -1 ) { kdDebug(KSSHPROC) << "KSshProcess::connect(): " << "select error: " << strerror(errno) << endl; mError = ERR_INTERNAL; - return QString::null; + return TQString::null; } // We are not respecting any type of order in which the @@ -616,14 +616,14 @@ QString KSshProcess::getLine() { // had data on it first. if( FD_ISSET(ptyfd, &rfds) ) { ptyLine = ssh.readLineFromPty(false); - buffer.prepend(QString(ptyLine)); + buffer.prepend(TQString(ptyLine)); //kdDebug(KSSHPROC) << "KSshProcess::getLine(): " // "line from pty -" << ptyLine << endl; } if( FD_ISSET(errfd, &rfds) ) { errLine = ssh.readLineFromStderr(false); - buffer.prepend(QString(errLine)); + buffer.prepend(TQString(errLine)); //kdDebug(KSSHPROC) << "KSshProcess::getLine(): " // "line from err -" << errLine << endl; } @@ -720,8 +720,8 @@ bool KSshProcess::connect() { kdDebug(KSSHPROC) << "KSshProcess::connect(): " << "Connect state " << stateStr(mConnectState) << endl; - QString line; // a line from ssh - QString msgBuf; // buffer for important messages from ssh + TQString line; // a line from ssh + TQString msgBuf; // buffer for important messages from ssh // which are to be returned to the user switch(mConnectState) { @@ -733,8 +733,8 @@ bool KSshProcess::connect() { case STATE_START: // reset some key values to safe values mAcceptHostKey = false; - mKeyFingerprint = QString::null; - mKnownHostsFile = QString::null; + mKeyFingerprint = TQString::null; + mKnownHostsFile = TQString::null; if( mArgs.isEmpty() ) { kdDebug(KSSHPROC) << "KSshProcess::connect(): ssh options " @@ -776,7 +776,7 @@ bool KSshProcess::connect() { i18n("Error encountered while talking to ssh."); mConnectState = STATE_FATAL; } - else if( line.find(QString::fromLatin1(passwordPrompt[mVersion]), 0, false) != -1 ) { + else if( line.find(TQString::fromLatin1(passwordPrompt[mVersion]), 0, false) != -1 ) { mConnectState = STATE_TRY_PASSWD; } else if( line.find(passphrasePrompt[mVersion]) != -1 ) { @@ -824,7 +824,7 @@ bool KSshProcess::connect() { // STATE_TRY_PASSWD: // If we have password send it to the ssh process, else // set error ERR_NEED_PASSWD and return false to the caller. - // The caller then must then call KSshProcess::setPassword(QString) + // The caller then must then call KSshProcess::setPassword(TQString) // before calling KSshProcess::connect() again. // // Almost exactly liek STATE_TRY_PASSPHRASE. Check there if you @@ -839,11 +839,11 @@ bool KSshProcess::connect() { ssh.writeLine(mPassword.latin1()); // Overwrite the password so it isn't in memory. - mPassword.fill(QChar('X')); + mPassword.fill(TQChar('X')); // Set the password to null so we will request another // password if this one fails. - mPassword = QString::null; + mPassword = TQString::null; mConnectState = STATE_WAIT_PROMPT; } @@ -862,7 +862,7 @@ bool KSshProcess::connect() { // STATE_TRY_KEY_PASSPHRASE: // If we have passphrase send it to the ssh process, else // set error ERR_NEED_PASSPHRASE and return false to the caller. - // The caller then must then call KSshProcess::setPassword(QString) + // The caller then must then call KSshProcess::setPassword(TQString) // before calling KSshProcess::connect() again. // // Almost exactly like STATE_TRY_PASSWD. The only difference is @@ -878,11 +878,11 @@ bool KSshProcess::connect() { ssh.writeLine(mPassword.latin1()); // Overwrite the password so it isn't in memory. - mPassword.fill(QChar('X')); + mPassword.fill(TQChar('X')); // Set the password to null so we will request another // password if this one fails. - mPassword = QString::null; + mPassword = TQString::null; mConnectState = STATE_WAIT_PROMPT; } diff --git a/kioslave/sftp/ksshprocess.h b/kioslave/sftp/ksshprocess.h index 2ec1abfd6..7fe8dd814 100644 --- a/kioslave/sftp/ksshprocess.h +++ b/kioslave/sftp/ksshprocess.h @@ -23,7 +23,7 @@ #include <signal.h> #include <unistd.h> -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <kdebug.h> @@ -69,7 +69,7 @@ * } * * int err; - * QString errMsg; + * TQString errMsg; * while( !ssh.connect() ) { * err = ssh.error(errMsg); * @@ -117,7 +117,7 @@ public: class SshOpt { public: Q_UINT32 opt; - QString str; + TQString str; Q_INT32 num; bool boolean; }; @@ -125,9 +125,9 @@ public: /** * List of SshOptions and associated iterators */ - typedef QValueList<SshOpt> SshOptList; - typedef QValueListIterator<SshOpt> SshOptListIterator; - typedef QValueListConstIterator<SshOpt> SshOptListConstIterator; + typedef TQValueList<SshOpt> SshOptList; + typedef TQValueListIterator<SshOpt> SshOptListIterator; + typedef TQValueListConstIterator<SshOpt> SshOptListConstIterator; /** * Ssh versions supported by KSshProcess. Subject to change @@ -320,7 +320,7 @@ public: * @param pathToSsh The fully qualified path name of the ssh binary * KSshProcess should use to setup a SSH connection. */ - KSshProcess(QString pathToSsh); + KSshProcess(TQString pathToSsh); ~KSshProcess(); /** @@ -333,7 +333,7 @@ public: * recognizes the version. * */ - bool setSshPath(QString pathToSsh); + bool setSshPath(TQString pathToSsh); /** * Get the ssh version. @@ -349,7 +349,7 @@ public: * * @return A string describing the ssh version recognized by KSshProcess */ - //QString versionStr(); + //TQString versionStr(); /** * Get the last error encountered by KSshProcess. @@ -358,7 +358,7 @@ public: * * @return The error number. See SshError for descriptions. */ - int error(QString& msg); + int error(TQString& msg); /** * Get the last error encountered by KSshProcess. @@ -366,7 +366,7 @@ public: */ int error() { return mError; } - QString errorMsg() { return mErrorMsg; } + TQString errorMsg() { return mErrorMsg; } /** * Send a signal to the ssh process. Do not use this to end the @@ -482,7 +482,7 @@ public: * * @param password The user password to give ssh. */ - void setPassword(QString password); + void setPassword(TQString password); /** * Access to standard in and out of the ssh process. @@ -508,7 +508,7 @@ private: /** * Path the the ssh binary. */ - QString mSshPath; + TQString mSshPath; /** * SSH version. This is an index into the supported SSH @@ -519,17 +519,17 @@ private: /** * User's password. Zero this out when it is no longer needed. */ - QString mPassword; + TQString mPassword; /** * User's username. */ - QString mUsername; + TQString mUsername; /** * Name of host we are connecting to. */ - QString mHost; + TQString mHost; /** * Accept new or changed host keys if true. @@ -552,13 +552,13 @@ private: * Save any key fingerprint msg from ssh so we can present * it to the caller. */ - QString mKeyFingerprint; + TQString mKeyFingerprint; /** * The location of the known host key file. We grab this from * any error messages ssh prints out. */ - QString mKnownHostsFile; + TQString mKnownHostsFile; /** * The state of our connect state machine. @@ -580,7 +580,7 @@ private: * An error message that corresponds to the error number set in * mError. Optional. */ - QString mErrorMsg; + TQString mErrorMsg; /** * Interface to the SSH process we ceate. Handles communication @@ -602,22 +602,22 @@ private: void installSignalHandlers(); void removeSignalHandlers(); - QString getLine(); + TQString getLine(); - static QRegExp versionStrs[]; + static TQRegExp versionStrs[]; static const char * const passwordPrompt[]; static const char * const passphrasePrompt[]; static const char * const authSuccessMsg[]; static const char * const authFailedMsg[]; - static QRegExp hostKeyMissingMsg[]; + static TQRegExp hostKeyMissingMsg[]; static const char * const hostKeyChangedMsg[]; static const char * const continuePrompt[]; static const char * const hostKeyAcceptedMsg[]; static const char * const tryAgainMsg[]; - static QRegExp hostKeyVerifyFailedMsg[]; + static TQRegExp hostKeyVerifyFailedMsg[]; static const char * const connectionClosedMsg[]; static const char * const changeHostKeyOnDiskPrompt[]; - static QRegExp keyFingerprintMsg[]; - static QRegExp knownHostsFileMsg[]; + static TQRegExp keyFingerprintMsg[]; + static TQRegExp knownHostsFileMsg[]; }; #endif diff --git a/kioslave/sftp/ksshprocesstest.cpp b/kioslave/sftp/ksshprocesstest.cpp index 3a37be02c..59dbf58c7 100644 --- a/kioslave/sftp/ksshprocesstest.cpp +++ b/kioslave/sftp/ksshprocesstest.cpp @@ -22,15 +22,15 @@ int main(int argc, char *argv[]) { opts.append(opt); opt.opt = KSshProcess::SSH_HOST; - opt.str = QString(argv[2]); + opt.str = TQString(argv[2]); opts.append(opt); opt.opt = KSshProcess::SSH_USERNAME; - opt.str = QString(argv[3]); + opt.str = TQString(argv[3]); opts.append(opt); // opt.opt = KSshProcess::SSH_PASSWD; -// opt.str = QString(argv[4]); +// opt.str = TQString(argv[4]); // opts.append(opt); if( !ssh.setOptions(opts) ) { @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) { cout << "Password: "; cin >> buf; cout << "password is " << buf << endl; - ssh.setPassword(QString(buf)); + ssh.setPassword(TQString(buf)); break; case KSshProcess::ERR_NEW_HOST_KEY: case KSshProcess::ERR_DIFF_HOST_KEY: diff --git a/kioslave/sftp/process.cpp b/kioslave/sftp/process.cpp index fcf012514..ca99b36bb 100644 --- a/kioslave/sftp/process.cpp +++ b/kioslave/sftp/process.cpp @@ -43,9 +43,9 @@ #include <sys/select.h> // Needed on some systems. #endif -#include <qglobal.h> -#include <qcstring.h> -#include <qfile.h> +#include <tqglobal.h> +#include <tqcstring.h> +#include <tqfile.h> #include <kdebug.h> #include <kstandarddirs.h> @@ -99,10 +99,10 @@ MyPtyProcess::~MyPtyProcess() */ -QCString MyPtyProcess::readLineFrom(int fd, QCString& inbuf, bool block) +TQCString MyPtyProcess::readLineFrom(int fd, TQCString& inbuf, bool block) { int pos; - QCString ret; + TQCString ret; if (!inbuf.isEmpty()) { @@ -172,7 +172,7 @@ QCString MyPtyProcess::readLineFrom(int fd, QCString& inbuf, bool block) return ret; } -void MyPtyProcess::writeLine(QCString line, bool addnl) +void MyPtyProcess::writeLine(TQCString line, bool addnl) { if (!line.isEmpty()) write(m_Fd, line, line.length()); @@ -180,7 +180,7 @@ void MyPtyProcess::writeLine(QCString line, bool addnl) write(m_Fd, "\n", 1); } -void MyPtyProcess::unreadLineFrom(QCString inbuf, QCString line, bool addnl) +void MyPtyProcess::unreadLineFrom(TQCString inbuf, TQCString line, bool addnl) { if (addnl) line += '\n'; @@ -193,7 +193,7 @@ void MyPtyProcess::unreadLineFrom(QCString inbuf, QCString line, bool addnl) * Fork and execute the command. This returns in the parent. */ -int MyPtyProcess::exec(QCString command, QCStringList args) +int MyPtyProcess::exec(TQCString command, QCStringList args) { kdDebug(PTYPROC) << "MyPtyProcess::exec(): " << command << endl;// << ", args = " << args << endl; @@ -259,18 +259,18 @@ int MyPtyProcess::exec(QCString command, QCStringList args) _exit(1); // From now on, terminal output goes through the tty. - QCString path; + TQCString path; if (command.contains('/')) path = command; else { - QString file = KStandardDirs::findExe(command); + TQString file = KStandardDirs::findExe(command); if (file.isEmpty()) { kdError(PTYPROC) << k_lineinfo << command << " not found\n"; _exit(1); } - path = QFile::encodeName(file); + path = TQFile::encodeName(file); } int i; @@ -393,7 +393,7 @@ int MyPtyProcess::waitForChild() if (ret) { - QCString line = readLine(false); + TQCString line = readLine(false); while (!line.isNull()) { if (!m_Exit.isEmpty() && !qstrnicmp(line, m_Exit, m_Exit.length())) diff --git a/kioslave/sftp/process.h b/kioslave/sftp/process.h index 64dcfb973..b0f20f77b 100644 --- a/kioslave/sftp/process.h +++ b/kioslave/sftp/process.h @@ -12,15 +12,15 @@ #ifndef __Process_h_Included__ #define __Process_h_Included__ -#include <qcstring.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qvaluelist.h> +#include <tqcstring.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqvaluelist.h> #define PTYPROC 7120 class PTY; -typedef QValueList<QCString> QCStringList; +typedef TQValueList<TQCString> QCStringList; /** * Synchronous communication with tty programs. @@ -43,7 +43,7 @@ public: * @param command The command to execute. * @param args The arguments to the command. */ - int exec(QCString command, QCStringList args); + int exec(TQCString command, QCStringList args); /** * Read a line from the program's standard out. Depending on the @em block @@ -51,16 +51,16 @@ public: * @param block Block until a full line is read? * @return The output string. */ - QCString readLine(bool block = true) + TQCString readLine(bool block = true) { return readLineFrom(m_Fd, m_ptyBuf, block); } - QCString readLineFromPty(bool block = true) + TQCString readLineFromPty(bool block = true) { return readLineFrom(m_Fd, m_ptyBuf, block); } - QCString readLineFromStdout(bool block = true) + TQCString readLineFromStdout(bool block = true) { return readLineFrom(m_stdinout, m_stdoutBuf, block); } - QCString readLineFromStderr(bool block = true) + TQCString readLineFromStderr(bool block = true) { return readLineFrom(m_err, m_stderrBuf, block); } /** @@ -68,7 +68,7 @@ public: * @param line The text to write. * @param addNewline Adds a '\n' to the line. */ - void writeLine(QCString line, bool addNewline=true); + void writeLine(TQCString line, bool addNewline=true); /** * Put back a line of input. @@ -76,23 +76,23 @@ public: * @param addNewline Adds a '\n' to the line. */ - void unreadLine(QCString line, bool addNewline = true) + void unreadLine(TQCString line, bool addNewline = true) { unreadLineFrom(m_ptyBuf, line, addNewline); } - void unreadLineFromPty(QCString line, bool addNewline = true) + void unreadLineFromPty(TQCString line, bool addNewline = true) { unreadLineFrom(m_ptyBuf, line, addNewline); } - void unreadLineFromStderr(QCString line, bool addNewline = true) + void unreadLineFromStderr(TQCString line, bool addNewline = true) { unreadLineFrom(m_stderrBuf, line, addNewline); } - void unreadLineFromStdout(QCString line, bool addNewline = true) + void unreadLineFromStdout(TQCString line, bool addNewline = true) { unreadLineFrom(m_stdoutBuf, line, addNewline); } /** * Set exit string. If a line of program output matches this, * @ref #waitForChild() will terminate the program and return. */ - void setExitString(QCString exit) { m_Exit = exit; } + void setExitString(TQCString exit) { m_Exit = exit; } /** * Wait for the child to exit. See also @ref #setExitString. @@ -129,18 +129,18 @@ public: protected: bool m_bErase, m_bTerminal; int m_Pid, m_Fd, m_stdinout, m_err; - QCString m_Command, m_Exit; + TQCString m_Command, m_Exit; private: int init(); int SetupTTY(int fd); PTY *m_pPTY; - QCString m_TTY; - QCString m_ptyBuf, m_stderrBuf, m_stdoutBuf; + TQCString m_TTY; + TQCString m_ptyBuf, m_stderrBuf, m_stdoutBuf; - QCString readLineFrom(int fd, QCString& inbuf, bool block); - void unreadLineFrom(QCString inbuf, QCString line, bool addnl); + TQCString readLineFrom(int fd, TQCString& inbuf, bool block); + void unreadLineFrom(TQCString inbuf, TQCString line, bool addnl); class PtyProcessPrivate; PtyProcessPrivate *d; }; diff --git a/kioslave/sftp/sftpfileattr.cpp b/kioslave/sftp/sftpfileattr.cpp index 07aada36d..42148ac28 100644 --- a/kioslave/sftp/sftpfileattr.cpp +++ b/kioslave/sftp/sftpfileattr.cpp @@ -21,8 +21,8 @@ #include <sys/types.h> #include <sys/stat.h> -#include <qstring.h> -#include <qdatastream.h> +#include <tqstring.h> +#include <tqdatastream.h> #include <kio/global.h> #include <kremoteencoding.h> @@ -123,7 +123,7 @@ UDSEntry sftpFileAttr::entry() { } /** Use to output the file attributes to a sftp packet */ -QDataStream& operator<< (QDataStream& s, const sftpFileAttr& fa) { +TQDataStream& operator<< (TQDataStream& s, const sftpFileAttr& fa) { s << (Q_UINT32)fa.mFlags; if( fa.mFlags & SSH2_FILEXFER_ATTR_SIZE ) @@ -148,7 +148,7 @@ QDataStream& operator<< (QDataStream& s, const sftpFileAttr& fa) { /** Use to read a file attribute from a sftp packet */ -QDataStream& operator>> (QDataStream& s, sftpFileAttr& fa) { +TQDataStream& operator>> (TQDataStream& s, sftpFileAttr& fa) { // XXX Add some error checking in here in case // we get a bad sftp packet. @@ -156,7 +156,7 @@ QDataStream& operator>> (QDataStream& s, sftpFileAttr& fa) { fa.clear(); if( fa.mDirAttrs ) { - QCString fn; + TQCString fn; s >> fn; fn.truncate( fn.size() ); @@ -203,7 +203,7 @@ QDataStream& operator>> (QDataStream& s, sftpFileAttr& fa) { /** Parse longname for the owner and group names. */ void sftpFileAttr::getUserGroupNames(){ // Get the name of the owner and group of the file from longname. - QString user, group; + TQString user, group; if( mLongname.isEmpty() ) { // do not have the user name so use the user id instead user.setNum(mUid); @@ -214,7 +214,7 @@ void sftpFileAttr::getUserGroupNames(){ int i = 0; int l = mLongname.length(); - QString longName = mEncoding->decode( mLongname ); + TQString longName = mEncoding->decode( mLongname ); kdDebug(7120) << "Decoded: " << longName << endl; @@ -285,10 +285,10 @@ void sftpFileAttr::clear(){ clearFileSize(); clearPermissions(); clearExtensions(); - mFilename = QString::null; - mGroupName = QString::null; - mUserName = QString::null; - mLinkDestination = QString::null; + mFilename = TQString::null; + mGroupName = TQString::null; + mUserName = TQString::null; + mLinkDestination = TQString::null; mFlags = 0; mLongname = "\0"; mLinkType = 0; diff --git a/kioslave/sftp/sftpfileattr.h b/kioslave/sftp/sftpfileattr.h index 28743504b..a2a9cf87e 100644 --- a/kioslave/sftp/sftpfileattr.h +++ b/kioslave/sftp/sftpfileattr.h @@ -20,9 +20,9 @@ #include <sys/types.h> -#include <qglobal.h> -#include <qstring.h> -#include <qdatastream.h> +#include <tqglobal.h> +#include <tqstring.h> +#include <tqdatastream.h> #include <kio/global.h> #include <kdebug.h> @@ -39,7 +39,7 @@ class sftpFileAttr { private: // Private attributes /** Name of file. */ - QString mFilename; + TQString mFilename; /** Specifies which fields of the file attribute are available. */ Q_UINT32 mFlags; @@ -69,13 +69,13 @@ private: // Private attributes /** Longname of the file as found in a SSH_FXP_NAME sftp packet. These contents are parse to return the file's owner name and gr oup name. */ - QCString mLongname; + TQCString mLongname; - QString mUserName; - QString mGroupName; + TQString mUserName; + TQString mGroupName; /** If file is a link, contains the destination of the link */ - QString mLinkDestination; + TQString mLinkDestination; /** If resource is a link, contains the type the link,e.g. file,dir... */ mode_t mLinkType; @@ -195,17 +195,17 @@ public: unsigned int flags() const { return mFlags; } /** Sets file's longname. See sftpFileAttr::longname. */ - void setLongname(QString l) { mLongname = l.latin1(); } + void setLongname(TQString l) { mLongname = l.latin1(); } /** Returns a string describing the file attributes. The format is specific to the implementation of the sftp server. In most cases (ie OpenSSH) this is similar to the long output of 'ls'. */ - QString longname() const { return mLongname; } + TQString longname() const { return mLongname; } - void setLinkDestination(const QString& target) + void setLinkDestination(const TQString& target) { mLinkDestination = target; } - QString linkDestination() + TQString linkDestination() { return mLinkDestination; } /** Sets the actual type a symbolic link points to. */ @@ -214,10 +214,10 @@ public: mode_t linkType() const { return mLinkType; } /** No descriptions */ - void setFilename(const QString& fn) + void setFilename(const TQString& fn) { mFilename = fn; } - QString filename() const + TQString filename() const { return mFilename; } /** Returns a UDSEntry describing the file. @@ -228,7 +228,7 @@ public: This will only write the sftp ATTR structure to the stream. It will never write the filename and longname because the client never sends those to the server. */ - friend QDataStream& operator<< (QDataStream&, const sftpFileAttr&); + friend TQDataStream& operator<< (TQDataStream&, const sftpFileAttr&); /** Use to read a file attribute from a sftp packet. Read this carefully! If the DirAttrs flag is true, this will @@ -237,7 +237,7 @@ public: If the DirAttrs flag is false, this will only read file attributes from the stream. BY DEFAULT, A NEW INSTANCE HAS DirAttrs == false */ - friend QDataStream& operator>> (QDataStream&, sftpFileAttr&); + friend TQDataStream& operator>> (TQDataStream&, sftpFileAttr&); /** Parse longname for the owner and group names. */ void getUserGroupNames(); |