summaryrefslogtreecommitdiffstats
path: root/src/ftpthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ftpthread.cpp')
-rw-r--r--src/ftpthread.cpp148
1 files changed, 74 insertions, 74 deletions
diff --git a/src/ftpthread.cpp b/src/ftpthread.cpp
index 842fecc..dda0463 100644
--- a/src/ftpthread.cpp
+++ b/src/ftpthread.cpp
@@ -25,9 +25,9 @@
#include <kstandarddirs.h>
-#include <qapplication.h>
-#include <qevent.h>
-#include <qdir.h>
+#include <ntqapplication.h>
+#include <ntqevent.h>
+#include <ntqdir.h>
#include <iostream>
#include <list>
@@ -52,7 +52,7 @@ there is a value to be returned, it's named out_.
*/
-FtpThread::FtpThread() : QThread()
+FtpThread::FtpThread() : TQThread()
{
mp_eventreceiver = NULL;
mp_ftp = new ftplib();
@@ -106,27 +106,27 @@ void FtpThread::CallbackLog(char *log, void *arg, bool out)
if (out)
{
int pos;
- QString buffer = ftp->m_linebuffer + log;
+ TQString buffer = ftp->m_linebuffer + log;
while ((pos = buffer.find('\n')) != -1)
{
- ftp->Event(EventHandler::outlog, new QString(buffer.left(pos + 1)));
+ ftp->Event(EventHandler::outlog, new TQString(buffer.left(pos + 1)));
buffer.remove(0, pos + 1);
}
ftp->m_linebuffer = buffer;
}
- else ftp->Event(EventHandler::inlog, new QString(log));
+ else ftp->Event(EventHandler::inlog, new TQString(log));
}
/* set the receiver for the events the thread posts when a certain ftp operation is done */
-void FtpThread::SetEventReceiver(QObject* eventreceiver)
+void FtpThread::SetEventReceiver(TQObject* eventreceiver)
{
mp_eventreceiver = eventreceiver;
}
/* connect to host */
-bool FtpThread::Connect(QString host)
+bool FtpThread::Connect(TQString host)
{
InitInternals();
@@ -141,7 +141,7 @@ bool FtpThread::Connect(QString host)
/* login with user and pass */
-bool FtpThread::Login(QString user, QString pass)
+bool FtpThread::Login(TQString user, TQString pass)
{
if (running()) return false;
else
@@ -167,7 +167,7 @@ bool FtpThread::Quit()
/* get file */
-bool FtpThread::Transfer_Get(QString src, QString dst, int tls, off64_t resume)
+bool FtpThread::Transfer_Get(TQString src, TQString dst, int tls, off64_t resume)
{
if (running()) return false;
else
@@ -183,7 +183,7 @@ bool FtpThread::Transfer_Get(QString src, QString dst, int tls, off64_t resume)
/* fxp file */
-bool FtpThread::Transfer_Fxp(QString src, QString dst, FtpThread *dstftp, int srctls, int dsttls, off64_t resume, int alt)
+bool FtpThread::Transfer_Fxp(TQString src, TQString dst, FtpThread *dstftp, int srctls, int dsttls, off64_t resume, int alt)
{
if (running()) return false;
else
@@ -202,7 +202,7 @@ bool FtpThread::Transfer_Fxp(QString src, QString dst, FtpThread *dstftp, int sr
/* put file */
-bool FtpThread::Transfer_Put(QString src, QString dst, int tls, off64_t resume)
+bool FtpThread::Transfer_Put(TQString src, TQString dst, int tls, off64_t resume)
{
if (running()) return false;
else
@@ -218,7 +218,7 @@ bool FtpThread::Transfer_Put(QString src, QString dst, int tls, off64_t resume)
/* transfer mkdir */
-bool FtpThread::Transfer_Mkdir(QString dir)
+bool FtpThread::Transfer_Mkdir(TQString dir)
{
if (running()) return false;
else
@@ -231,7 +231,7 @@ bool FtpThread::Transfer_Mkdir(QString dir)
/* rename file */
-bool FtpThread::Rename(QString src, QString dst)
+bool FtpThread::Rename(TQString src, TQString dst)
{
if (running()) return false;
else
@@ -284,7 +284,7 @@ bool FtpThread::Pwd()
/* change working dir to the given path */
-bool FtpThread::Chdir(QString path)
+bool FtpThread::Chdir(TQString path)
{
if (running()) return false;
else
@@ -297,7 +297,7 @@ bool FtpThread::Chdir(QString path)
/* change working dir to the given path, used by transfers */
-bool FtpThread::Transfer_Changedir(QString dir, int tls)
+bool FtpThread::Transfer_Changedir(TQString dir, int tls)
{
if (running()) return false;
else
@@ -311,7 +311,7 @@ bool FtpThread::Transfer_Changedir(QString dir, int tls)
/* creates a directory */
-bool FtpThread::Mkdir(QString path)
+bool FtpThread::Mkdir(TQString path)
{
if (running()) return false;
else
@@ -361,7 +361,7 @@ bool FtpThread::Authtls()
/* delete a file */
-bool FtpThread::Rm(QString name)
+bool FtpThread::Rm(TQString name)
{
wait(KB_THREAD_TIMEOUT);
if (running()) return false;
@@ -375,7 +375,7 @@ bool FtpThread::Rm(QString name)
/* delete a directory */
-bool FtpThread::Rmdir(QString name)
+bool FtpThread::Rmdir(TQString name)
{
if (running()) return false;
else
@@ -388,7 +388,7 @@ bool FtpThread::Rmdir(QString name)
/* issue raw command */
-bool FtpThread::Raw(QString cmd)
+bool FtpThread::Raw(TQString cmd)
{
if (running()) return false;
else
@@ -416,14 +416,14 @@ bool FtpThread::Scandir(KbDirInfo* dir)
void FtpThread::Connect_thread()
{
int result;
- QString host = m_stringlist.front();
+ TQString host = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Connect(host.latin1());
//unsigned long int xxx = mp_ftp->mp_netbuf->ipappr;
- //qWarning("INFO %lu.%lu.%lu.%lu", xxx & 0xff, (xxx >> 8) & 0xff, (xxx >> 16) & 0xff, (xxx >> 24) & 0xff);
- //qWarning("INFO: ip:%lu", mp_ftp->mp_netbuf->ipappr);
+ //tqWarning("INFO %lu.%lu.%lu.%lu", xxx & 0xff, (xxx >> 8) & 0xff, (xxx >> 16) & 0xff, (xxx >> 24) & 0xff);
+ //tqWarning("INFO: ip:%lu", mp_ftp->mp_netbuf->ipappr);
if (result) Event(EventHandler::connect_success);
else
@@ -450,9 +450,9 @@ void FtpThread::Authtls_thread()
void FtpThread::Login_thread()
{
int result;
- QString user = m_stringlist.front();
+ TQString user = m_stringlist.front();
m_stringlist.pop_front();
- QString pass = m_stringlist.front();
+ TQString pass = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Login(user.latin1(), pass.latin1());
@@ -506,11 +506,11 @@ void FtpThread::Transfer_Changedir_thread()
{
int result;
char buffer[1024];
- QString dirname;
+ TQString dirname;
- dirname = locateLocal("appdata", QString::number(rand()) + ".dir");
+ dirname = locateLocal("appdata", TQString::number(rand()) + ".dir");
- QString path = m_stringlist.front();
+ TQString path = m_stringlist.front();
m_stringlist.pop_front();
int tls = m_intlist.front();
m_intlist.pop_front();
@@ -534,7 +534,7 @@ void FtpThread::Transfer_Changedir_thread()
result = mp_ftp->Pwd(buffer, 1024);
if (result)
{
- Event(EventHandler::pwd_success, new QString(buffer));
+ Event(EventHandler::pwd_success, new TQString(buffer));
m_pwd = buffer;
}
else
@@ -581,13 +581,13 @@ void FtpThread::Transfer_Changedir_thread()
if (!result) Event(EventHandler::transfer_failure);
else Event(EventHandler::transfer_success);
- QFile::remove(dirname);
+ TQFile::remove(dirname);
}
void FtpThread::Transfer_Mkdir_thread()
{
int result;
- QString dir = m_stringlist.front();
+ TQString dir = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Mkdir(dir.latin1());
@@ -607,9 +607,9 @@ void FtpThread::Transfer_Get_thread()
{
int result;
- QString src = m_stringlist.front();
+ TQString src = m_stringlist.front();
m_stringlist.pop_front();
- QString dst = m_stringlist.front();
+ TQString dst = m_stringlist.front();
m_stringlist.pop_front();
int tls = m_intlist.front();
m_intlist.pop_front();
@@ -653,9 +653,9 @@ void FtpThread::Transfer_Put_thread()
{
int result;
- QString src = m_stringlist.front();
+ TQString src = m_stringlist.front();
m_stringlist.pop_front();
- QString dst = m_stringlist.front();
+ TQString dst = m_stringlist.front();
m_stringlist.pop_front();
int tls = m_intlist.front();
m_intlist.pop_front();
@@ -714,9 +714,9 @@ void FtpThread::Transfer_Fxp_thread()
int result = 0;
ftplib::ftp method;
- QString src = m_stringlist.front();
+ TQString src = m_stringlist.front();
m_stringlist.pop_front();
- QString dst = m_stringlist.front();
+ TQString dst = m_stringlist.front();
m_stringlist.pop_front();
FtpThread* dstftp = m_ftplist.front();
m_ftplist.pop_front();
@@ -750,9 +750,9 @@ void FtpThread::Transfer_Fxp_thread()
if (alt) method = ftplib::alternativefxp;
else method = ftplib::defaultfxp;
- qWarning("bla_thread: %d", alt);
+ tqWarning("bla_thread: %d", alt);
- if (resume) qWarning("WARNING: fxp resume isn't supported. overwriting file instead");
+ if (resume) tqWarning("WARNING: fxp resume isn't supported. overwriting file instead");
result == ftplib::Fxp(mp_ftp, dstftp->Ftp(), src, dst, ftplib::image, method);
FxpReportResult(result);
@@ -798,7 +798,7 @@ void FtpThread::Pwd_thread()
if (result)
{
- Event(EventHandler::pwd_success, new QString(buffer));
+ Event(EventHandler::pwd_success, new TQString(buffer));
m_pwd = buffer;
}
else
@@ -812,7 +812,7 @@ void FtpThread::Chdir_thread()
{
int result;
- QString path = m_stringlist.front();
+ TQString path = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Chdir(path.latin1());
@@ -829,7 +829,7 @@ void FtpThread::Mkdir_thread()
{
int result;
- QString path = m_stringlist.front();
+ TQString path = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Mkdir(path.latin1());
@@ -860,7 +860,7 @@ void FtpThread::Rm_thread()
{
int result;
- QString name = m_stringlist.front();
+ TQString name = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Delete(name.latin1());
@@ -877,9 +877,9 @@ void FtpThread::Rename_thread()
{
int result;
- QString src = m_stringlist.front();
+ TQString src = m_stringlist.front();
m_stringlist.pop_front();
- QString dst = m_stringlist.front();
+ TQString dst = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Rename(src.latin1(),dst.latin1());
@@ -895,13 +895,13 @@ void FtpThread::Rename_thread()
void FtpThread::Dir_thread()
{
int result;
- QString dirname;
+ TQString dirname;
int cacheindex = -1;
int force = m_intlist.front();
m_intlist.pop_front();
- dirname = locateLocal("appdata", QString::number(rand()) + ".dir");
+ dirname = locateLocal("appdata", TQString::number(rand()) + ".dir");
if (KbConfig::dirCachingIsEnabled())
{
@@ -944,7 +944,7 @@ void FtpThread::Dir_thread()
else Event(EventHandler::dir_failure, &m_dircontent);
}
- QFile::remove(dirname);
+ TQFile::remove(dirname);
}
void FtpThread::Scandir_thread()
@@ -969,7 +969,7 @@ void FtpThread::Rmdir_thread()
{
bool result;
- QString name = m_stringlist.front();
+ TQString name = m_stringlist.front();
m_stringlist.pop_front();
result = Delete_recurse(name.latin1());
@@ -986,7 +986,7 @@ void FtpThread::Raw_thread()
{
bool result;
- QString cmd = m_stringlist.front();
+ TQString cmd = m_stringlist.front();
m_stringlist.pop_front();
result = mp_ftp->Raw(cmd.latin1());
@@ -1081,18 +1081,18 @@ void FtpThread::run()
void FtpThread::Event(EventHandler::EventType type, void *data)
{
- if (mp_eventreceiver == NULL) qWarning("WARNING: mp_eventreceiver is NULL");
+ if (mp_eventreceiver == NULL) tqWarning("WARNING: mp_eventreceiver is NULL");
else
{
- QCustomEvent* e = new QCustomEvent(type);
+ TQCustomEvent* e = new TQCustomEvent(type);
if (data != NULL) e->setData(data);
- qApp->postEvent(mp_eventreceiver, e);
+ tqApp->postEvent(mp_eventreceiver, e);
}
}
/* parses the dir file */
-bool FtpThread::FormatFilelist(const char *filename, QString current, filist *dirtable, filist *filetable)
+bool FtpThread::FormatFilelist(const char *filename, TQString current, filist *dirtable, filist *filetable)
{
int i, blocks, space, month_int = 1;
unsigned int loc, fileloc, datebegin, sizebegin = 0;
@@ -1110,7 +1110,7 @@ bool FtpThread::FormatFilelist(const char *filename, QString current, filist *di
dirfile = fopen(filename, "r");
if (dirfile == NULL)
{
- qWarning("ERROR: failed open dirfile");
+ tqWarning("ERROR: failed open dirfile");
return false;
}
@@ -1130,7 +1130,7 @@ bool FtpThread::FormatFilelist(const char *filename, QString current, filist *di
}
if( loc == string::npos )
{
- qWarning("INFO: no month entry found");
+ tqWarning("INFO: no month entry found");
loc = buffer.length();
}
@@ -1167,11 +1167,11 @@ bool FtpThread::FormatFilelist(const char *filename, QString current, filist *di
}
if (blocks != 3)
{
- qWarning("INFO: ignoring invalid line in dirlist");
+ tqWarning("INFO: ignoring invalid line in dirlist");
}
else
{
- QString date(buffer.substr( datebegin, loc - datebegin - 1).c_str());
+ TQString date(buffer.substr( datebegin, loc - datebegin - 1).c_str());
int day_int = date.section( ' ', 1, 1 ).toInt();
int year_int = date.section( ' ', -1, -1 ).toInt();
@@ -1182,9 +1182,9 @@ bool FtpThread::FormatFilelist(const char *filename, QString current, filist *di
if (year_int == 0)
{
- year_int = QDate::currentDate().year();
- if (month_int > QDate::currentDate().month()) year_int--;
- QTime mytime = QTime::fromString(date.section( ' ', -1, -1 ));
+ year_int = TQDate::currentDate().year();
+ if (month_int > TQDate::currentDate().month()) year_int--;
+ TQTime mytime = TQTime::fromString(date.section( ' ', -1, -1 ));
hour_int = mytime.hour();
minute_int = mytime.minute();
}
@@ -1239,7 +1239,7 @@ bool FtpThread::FormatFilelist(const char *filename, QString current, filist *di
}
else if ((*file == 'l') || (*file == 'L'))
{
- qWarning("INFO: links to files not supported yet");
+ tqWarning("INFO: links to files not supported yet");
}
else
{
@@ -1255,13 +1255,13 @@ bool FtpThread::FormatFilelist(const char *filename, QString current, filist *di
/* recursive method to check content of a directory */
-bool FtpThread::Scandir_recurse(KbDirInfo *dir, QString path)
+bool FtpThread::Scandir_recurse(KbDirInfo *dir, TQString path)
{
char currentpath[1024];
int result;
filist dirlist;
filist filelist;
- QString dirname;
+ TQString dirname;
result = mp_ftp->Pwd(currentpath, 1024);
@@ -1281,7 +1281,7 @@ bool FtpThread::Scandir_recurse(KbDirInfo *dir, QString path)
}
else Event(EventHandler::misc_success);
- dirname = locateLocal("appdata", QString::number(rand()) + ".dir");
+ dirname = locateLocal("appdata", TQString::number(rand()) + ".dir");
result = mp_ftp->Dir(dirname.latin1(), "");
@@ -1294,7 +1294,7 @@ bool FtpThread::Scandir_recurse(KbDirInfo *dir, QString path)
if(!FormatFilelist(dirname.latin1(), path, &dirlist, &filelist)) return false;
- QFile::remove(dirname);
+ TQFile::remove(dirname);
filist::iterator end_file = filelist.end();
for(filist::iterator fiIterator = filelist.begin(); fiIterator != end_file; fiIterator++)
@@ -1323,13 +1323,13 @@ bool FtpThread::Scandir_recurse(KbDirInfo *dir, QString path)
/* recursive method to delete directories */
-bool FtpThread::Delete_recurse(QString name)
+bool FtpThread::Delete_recurse(TQString name)
{
char currentdir[1024];
int result;
filist dirlist;
filist filelist;
- QString dirname;
+ TQString dirname;
result = mp_ftp->Pwd(currentdir, 1024);
@@ -1349,11 +1349,11 @@ bool FtpThread::Delete_recurse(QString name)
}
else Event(EventHandler::misc_success);
- //dirname = QDir::homeDirPath() +
+ //dirname = TQDir::homeDirPath() +
//"/.kasablanca/" +
- //QString::number((int) time(NULL) & 0xffff) +
+ //TQString::number((int) time(NULL) & 0xffff) +
//".dir";
- dirname = locateLocal("appdata", QString::number(rand()) + ".dir");
+ dirname = locateLocal("appdata", TQString::number(rand()) + ".dir");
result = mp_ftp->Dir(dirname.latin1(), "");
@@ -1366,7 +1366,7 @@ bool FtpThread::Delete_recurse(QString name)
if(!FormatFilelist(dirname.latin1(), "", &dirlist, &filelist)) return false;
- QFile::remove(dirname);
+ TQFile::remove(dirname);
filist::iterator end_file = filelist.end();
for(filist::iterator fiIterator = filelist.begin(); fiIterator != end_file; fiIterator++)
@@ -1411,7 +1411,7 @@ bool FtpThread::Delete_recurse(QString name)
bool FtpThread::ConnectionLost()
{
- QString response;
+ TQString response;
response = mp_ftp->LastResponse();