diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/http | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/http')
-rw-r--r-- | src/modules/http/httpfiletransfer.cpp | 162 | ||||
-rw-r--r-- | src/modules/http/httpfiletransfer.h | 39 | ||||
-rw-r--r-- | src/modules/http/libkvihttp.cpp | 40 |
3 files changed, 121 insertions, 120 deletions
diff --git a/src/modules/http/httpfiletransfer.cpp b/src/modules/http/httpfiletransfer.cpp index 09c3b1f9..789b7a1b 100644 --- a/src/modules/http/httpfiletransfer.cpp +++ b/src/modules/http/httpfiletransfer.cpp @@ -35,10 +35,10 @@ #include "kvi_kvs_script.h" #include "kvi_tal_popupmenu.h" -#include <qpainter.h> +#include <tqpainter.h> static KviPointerList<KviHttpFileTransfer> * g_pHttpFileTransfers = 0; -static QPixmap * g_pHttpIcon = 0; +static TQPixmap * g_pHttpIcon = 0; KviHttpFileTransfer::KviHttpFileTransfer() @@ -58,16 +58,16 @@ KviHttpFileTransfer::KviHttpFileTransfer() m_pHttpRequest = new KviHttpRequest(); - connect(m_pHttpRequest,SIGNAL(status(const QString &)),this,SLOT(statusMessage(const QString &))); - connect(m_pHttpRequest,SIGNAL(terminated(bool)),this,SLOT(transferTerminated(bool))); - connect(m_pHttpRequest,SIGNAL(header(KviPointerHashTable<const char *,KviStr> *)),this,SLOT(headersReceived(KviPointerHashTable<const char *,KviStr> *))); - connect(m_pHttpRequest,SIGNAL(resolvingHost(const QString &)),this,SLOT(resolvingHost(const QString &))); - connect(m_pHttpRequest,SIGNAL(requestSent(const QStringList &)),this,SLOT(requestSent(const QStringList &))); - connect(m_pHttpRequest,SIGNAL(contactingHost(const QString &)),this,SLOT(contactingHost(const QString &))); - connect(m_pHttpRequest,SIGNAL(receivedResponse(const QString &)),this,SLOT(receivedResponse(const QString &))); - connect(m_pHttpRequest,SIGNAL(connectionEstabilished()),this,SLOT(connectionEstabilished())); + connect(m_pHttpRequest,TQT_SIGNAL(status(const TQString &)),this,TQT_SLOT(statusMessage(const TQString &))); + connect(m_pHttpRequest,TQT_SIGNAL(terminated(bool)),this,TQT_SLOT(transferTerminated(bool))); + connect(m_pHttpRequest,TQT_SIGNAL(header(KviPointerHashTable<const char *,KviStr> *)),this,TQT_SLOT(headersReceived(KviPointerHashTable<const char *,KviStr> *))); + connect(m_pHttpRequest,TQT_SIGNAL(resolvingHost(const TQString &)),this,TQT_SLOT(resolvingHost(const TQString &))); + connect(m_pHttpRequest,TQT_SIGNAL(requestSent(const TQStringList &)),this,TQT_SLOT(requestSent(const TQStringList &))); + connect(m_pHttpRequest,TQT_SIGNAL(contactingHost(const TQString &)),this,TQT_SLOT(contactingHost(const TQString &))); + connect(m_pHttpRequest,TQT_SIGNAL(receivedResponse(const TQString &)),this,TQT_SLOT(receivedResponse(const TQString &))); + connect(m_pHttpRequest,TQT_SIGNAL(connectionEstabilished()),this,TQT_SLOT(connectionEstabilished())); - m_eGeneralStatus = Initializing; + m_eGeneraltqStatus = Initializing; m_szStatusString = __tr2qs_ctx("Initializing","http"); } @@ -92,7 +92,7 @@ void KviHttpFileTransfer::die() delete this; } -QString KviHttpFileTransfer::localFileName() +TQString KviHttpFileTransfer::localFileName() { return m_pHttpRequest->fileName(); } @@ -104,26 +104,26 @@ void KviHttpFileTransfer::abort() void KviHttpFileTransfer::fillContextPopup(KviTalPopupMenu * m,int column) { - int id = m->insertItem(__tr2qs_ctx("Abort","http"),this,SLOT(abort())); + int id = m->insertItem(__tr2qs_ctx("Abort","http"),this,TQT_SLOT(abort())); if(!active())m->setItemEnabled(id,false); } bool KviHttpFileTransfer::active() { - return ((m_eGeneralStatus == Connecting) || (m_eGeneralStatus == Downloading)); + return ((m_eGeneraltqStatus == Connecting) || (m_eGeneraltqStatus == Downloading)); } -void KviHttpFileTransfer::displayPaint(QPainter * p,int column,int width,int height) +void KviHttpFileTransfer::displayPaint(TQPainter * p,int column,int width,int height) { - QString txt; - bool bIsTerminated = ((m_eGeneralStatus == Success) || (m_eGeneralStatus == Failure)); + TQString txt; + bool bIsTerminated = ((m_eGeneraltqStatus == Success) || (m_eGeneraltqStatus == Failure)); switch(column) { case COLUMN_TRANSFERTYPE: { int offset = 0; - switch(m_eGeneralStatus) + switch(m_eGeneraltqStatus) { case Initializing: offset = 0; break; case Connecting: offset = 0; break; @@ -136,53 +136,53 @@ void KviHttpFileTransfer::displayPaint(QPainter * p,int column,int width,int hei break; case COLUMN_FILEINFO: { - QFontMetrics fm(p->font()); + TQFontMetrics fm(p->font()); - QString szFrom = __tr2qs_ctx("From: ","http"); - QString szTo = __tr2qs_ctx("To: ","http"); + TQString szFrom = __tr2qs_ctx("From: ","http"); + TQString szTo = __tr2qs_ctx("To: ","http"); int daW1 = fm.width(szFrom); int daW2 = fm.width(szTo); if(daW1 < daW2)daW1 = daW2; int iLineSpacing = fm.lineSpacing(); - p->setPen(Qt::black); + p->setPen(TQt::black); int iY = 4; - p->drawText(4 + daW1,iY,width - (8 + daW1),height - 8,Qt::AlignTop | Qt::AlignLeft,m_pHttpRequest->url().url().ptr()); + p->drawText(4 + daW1,iY,width - (8 + daW1),height - 8,TQt::AlignTop | TQt::AlignLeft,m_pHttpRequest->url().url().ptr()); iY += iLineSpacing; if(!(m_pHttpRequest->fileName().isEmpty())) { - p->drawText(4 + daW1,iY,width - (8 + daW1),height - 8,Qt::AlignTop | Qt::AlignLeft,m_pHttpRequest->fileName()); + p->drawText(4 + daW1,iY,width - (8 + daW1),height - 8,TQt::AlignTop | TQt::AlignLeft,m_pHttpRequest->fileName()); } iY += iLineSpacing; - p->setPen(Qt::darkGray); + p->setPen(TQt::darkGray); - p->drawText(4,4,width - 8,height - 8,Qt::AlignTop | Qt::AlignLeft,szFrom); - p->drawText(4,4 + iLineSpacing,width - 8,height - 8,Qt::AlignTop | Qt::AlignLeft,szTo); + p->drawText(4,4,width - 8,height - 8,TQt::AlignTop | TQt::AlignLeft,szFrom); + p->drawText(4,4 + iLineSpacing,width - 8,height - 8,TQt::AlignTop | TQt::AlignLeft,szTo); - p->setPen(QColor(180,180,200)); + p->setPen(TQColor(180,180,200)); iLineSpacing += 2; p->drawRect(4,height - (iLineSpacing + 4),width - 8,iLineSpacing); - p->fillRect(5,height - (iLineSpacing + 3),width - 10,iLineSpacing - 2,bIsTerminated ? QColor(210,210,210) : QColor(190,190,240)); - p->setPen(Qt::black); - p->drawText(7,height - (iLineSpacing + 4),width - 14,iLineSpacing,Qt::AlignVCenter | Qt::AlignLeft,m_szStatusString); + p->fillRect(5,height - (iLineSpacing + 3),width - 10,iLineSpacing - 2,bIsTerminated ? TQColor(210,210,210) : TQColor(190,190,240)); + p->setPen(TQt::black); + p->drawText(7,height - (iLineSpacing + 4),width - 14,iLineSpacing,TQt::AlignVCenter | TQt::AlignLeft,m_szStatusString); } break; case COLUMN_PROGRESS: { - QFontMetrics fm(p->font()); + TQFontMetrics fm(p->font()); unsigned int uTotal = m_pHttpRequest->totalSize(); unsigned int uRecvd = m_pHttpRequest->receivedSize(); int iW = width - 8; - p->setPen(bIsTerminated ? Qt::lightGray : QColor(210,210,240)); + p->setPen(bIsTerminated ? TQt::lightGray : TQColor(210,210,240)); p->drawRect(4,4,iW,12); int iAvgSpeed = -1; @@ -209,17 +209,17 @@ void KviHttpFileTransfer::displayPaint(QPainter * p,int column,int width,int hei iW -= 2; int iL = (int) ((((double)iW) * dPerc) / 100.0); //iR = iW - iL; - p->fillRect(5,5,iL,10,bIsTerminated ? QColor(140,110,110) : QColor(200,100,100)); + p->fillRect(5,5,iL,10,bIsTerminated ? TQColor(140,110,110) : TQColor(200,100,100)); - txt = QString(__tr2qs_ctx("%1 of %2 (%3 %)","http")).arg(KviQString::makeSizeReadable(uRecvd)) - .arg(KviQString::makeSizeReadable(uTotal)).arg(dPerc,0,'f',2); + txt = TQString(__tr2qs_ctx("%1 of %2 (%3 %)","http")).tqarg(KviTQString::makeSizeReadable(uRecvd)) + .tqarg(KviTQString::makeSizeReadable(uTotal)).tqarg(dPerc,0,'f',2); } else { - txt = KviQString::makeSizeReadable(m_pHttpRequest->receivedSize()); + txt = KviTQString::makeSizeReadable(m_pHttpRequest->receivedSize()); } - p->setPen(Qt::black); + p->setPen(TQt::black); - p->drawText(4,19,width - 8,height - 8,Qt::AlignTop | Qt::AlignLeft,txt); + p->drawText(4,19,width - 8,height - 8,TQt::AlignTop | TQt::AlignLeft,txt); int iLeftHalf = (iW - 2) / 2; int iRightHalf = iW - (iLeftHalf + 1); @@ -230,7 +230,7 @@ void KviHttpFileTransfer::displayPaint(QPainter * p,int column,int width,int hei txt += " "; if(iInstantSpeed >= 0) { - QString tmpisp; + TQString tmpisp; KviNetUtils::formatNetworkBandwidthString(tmpisp,iAvgSpeed); txt += tmpisp; } else { @@ -242,7 +242,7 @@ void KviHttpFileTransfer::displayPaint(QPainter * p,int column,int width,int hei txt += " "; if(iAvgSpeed >= 0) { - QString tmpspd; + TQString tmpspd; KviNetUtils::formatNetworkBandwidthString(tmpspd,iAvgSpeed); txt += tmpspd; } else { @@ -253,11 +253,11 @@ void KviHttpFileTransfer::displayPaint(QPainter * p,int column,int width,int hei int iDaH = height - (iLineSpacing + 4); - p->setPen(QColor(180,180,200)); + p->setPen(TQColor(180,180,200)); p->drawRect(4,iDaH,iLeftHalf,iLineSpacing); - p->fillRect(5,iDaH + 1,iLeftHalf - 2,iLineSpacing - 2,bIsTerminated ? QColor(210,210,210) : QColor(190,190,240)); - p->setPen(bIsTerminated ? Qt::darkGray : Qt::black); - p->drawText(6,iDaH,iLeftHalf - 4,iLineSpacing,Qt::AlignLeft | Qt::AlignVCenter,txt); + p->fillRect(5,iDaH + 1,iLeftHalf - 2,iLineSpacing - 2,bIsTerminated ? TQColor(210,210,210) : TQColor(190,190,240)); + p->setPen(bIsTerminated ? TQt::darkGray : TQt::black); + p->drawText(6,iDaH,iLeftHalf - 4,iLineSpacing,TQt::AlignLeft | TQt::AlignVCenter,txt); unsigned int uD,uH,uM,uS; @@ -265,27 +265,27 @@ void KviHttpFileTransfer::displayPaint(QPainter * p,int column,int width,int hei { KviTimeUtils::secondsToDaysHoursMinsSecs(kvi_timeSpan(m_tTransferEndTime,m_tTransferStartTime),&uD,&uH,&uM,&uS); txt = "TOT: "; - if(uD > 0)txt += QString(__tr2qs_ctx("%1d %2h %3m %4s","http")).arg(uD).arg(uH).arg(uM).arg(uS); - else if(uH > 0)txt += QString(__tr2qs_ctx("%2h %3m %4s","http")).arg(uH).arg(uM).arg(uS); - else txt += QString(__tr2qs_ctx("%3m %4s","http")).arg(uM).arg(uS); + if(uD > 0)txt += TQString(__tr2qs_ctx("%1d %2h %3m %4s","http")).tqarg(uD).tqarg(uH).tqarg(uM).tqarg(uS); + else if(uH > 0)txt += TQString(__tr2qs_ctx("%2h %3m %4s","http")).tqarg(uH).tqarg(uM).tqarg(uS); + else txt += TQString(__tr2qs_ctx("%3m %4s","http")).tqarg(uM).tqarg(uS); } else { if(iEta >= 0) { KviTimeUtils::secondsToDaysHoursMinsSecs(iEta,&uD,&uH,&uM,&uS); txt = "ETA: "; - if(uD > 0)txt += QString(__tr2qs_ctx("%1d %2h %3m %4s","http")).arg(uD).arg(uH).arg(uM).arg(uS); - else if(uH > 0)txt += QString(__tr2qs_ctx("%2h %3m %4s","http")).arg(uH).arg(uM).arg(uS); - else txt += QString(__tr2qs_ctx("%3m %4s","http")).arg(uM).arg(uS); + if(uD > 0)txt += TQString(__tr2qs_ctx("%1d %2h %3m %4s","http")).tqarg(uD).tqarg(uH).tqarg(uM).tqarg(uS); + else if(uH > 0)txt += TQString(__tr2qs_ctx("%2h %3m %4s","http")).tqarg(uH).tqarg(uM).tqarg(uS); + else txt += TQString(__tr2qs_ctx("%3m %4s","http")).tqarg(uM).tqarg(uS); } else { txt = "ETA: Unknown"; } } - p->setPen(QColor(180,180,200)); + p->setPen(TQColor(180,180,200)); p->drawRect(width - (4 + iRightHalf),iDaH,iRightHalf,iLineSpacing); - p->fillRect(width - (3 + iRightHalf),iDaH + 1,iRightHalf - 2,iLineSpacing - 2,bIsTerminated ? QColor(210,210,210) : QColor(190,190,240)); - p->setPen(bIsTerminated ? Qt::darkGray : Qt::black); - p->drawText(width - (2 + iRightHalf),iDaH,iRightHalf - 4,iLineSpacing,Qt::AlignLeft | Qt::AlignVCenter,txt); + p->fillRect(width - (3 + iRightHalf),iDaH + 1,iRightHalf - 2,iLineSpacing - 2,bIsTerminated ? TQColor(210,210,210) : TQColor(190,190,240)); + p->setPen(bIsTerminated ? TQt::darkGray : TQt::black); + p->drawText(width - (2 + iRightHalf),iDaH,iRightHalf - 4,iLineSpacing,TQt::AlignLeft | TQt::AlignVCenter,txt); } break; @@ -298,16 +298,16 @@ int KviHttpFileTransfer::displayHeight(int iLineSpacing) return iH >= 70 ? iH : 70; } -QString KviHttpFileTransfer::tipText() +TQString KviHttpFileTransfer::tipText() { - QString s; - s = QString("<table><tr><td bgcolor=\"#000000\"><font color=\"#FFFFFF\"><b>HTTP Transfer (ID %1)</b></font></td></tr>").arg(id()); + TQString s; + s = TQString("<table><tr><td bgcolor=\"#000000\"><font color=\"#FFFFFF\"><b>HTTP Transfer (ID %1)</b></font></td></tr>").tqarg(id()); if(m_lRequest.count() > 0) { s += "<tr><td bgcolor=\"#404040\"><font color=\"#FFFFFF\">Request Headers</font></td></tr>"; s += "<tr><td bgcolor=\"#C0C0C0\">"; - for(QStringList::ConstIterator it = m_lRequest.begin();it != m_lRequest.end();++it) + for(TQStringList::ConstIterator it = m_lRequest.begin();it != m_lRequest.end();++it) { s += " "; s += *it; @@ -320,7 +320,7 @@ QString KviHttpFileTransfer::tipText() { s += "<tr><td bgcolor=\"#404040\"><font color=\"#FFFFFF\">Response Headers</font></td></tr>"; s += "<tr><td bgcolor=\"#C0C0C0\">"; - for(QStringList::ConstIterator it = m_lHeaders.begin();it != m_lHeaders.end();++it) + for(TQStringList::ConstIterator it = m_lHeaders.begin();it != m_lHeaders.end();++it) { s += " "; s += *it; @@ -340,9 +340,9 @@ void KviHttpFileTransfer::init() g_pHttpFileTransfers = new KviPointerList<KviHttpFileTransfer>; g_pHttpFileTransfers->setAutoDelete(false); - QPixmap * pix = g_pIconManager->getImage("kvi_httpicons.png"); - if(pix)g_pHttpIcon = new QPixmap(*pix); - else g_pHttpIcon = new QPixmap(192,48); + TQPixmap * pix = g_pIconManager->getImage("kvi_httpicons.png"); + if(pix)g_pHttpIcon = new TQPixmap(*pix); + else g_pHttpIcon = new TQPixmap(192,48); } void KviHttpFileTransfer::done() @@ -362,7 +362,7 @@ unsigned int KviHttpFileTransfer::runningTransfers() return g_pHttpFileTransfers->count(); } -void KviHttpFileTransfer::requestSent(const QStringList &requestHeaders) +void KviHttpFileTransfer::requestSent(const TQStringList &requestHeaders) { m_szStatusString = __tr2qs_ctx("Request sent, waiting for reply...","http"); displayUpdate(); @@ -373,7 +373,7 @@ void KviHttpFileTransfer::requestSent(const QStringList &requestHeaders) if(!m_bNoOutput) out->output(KVI_OUT_GENERICSTATUS,__tr2qs_ctx("[HTTP %d]: Request data sent:","http"),id()); - for(QStringList::ConstIterator it = requestHeaders.begin();it != requestHeaders.end();++it) + for(TQStringList::ConstIterator it = requestHeaders.begin();it != requestHeaders.end();++it) { if(!m_bNoOutput) out->output(KVI_OUT_GENERICSTATUS,"[HTTP %d]: %s",id(),(*it).utf8().data()); @@ -388,29 +388,29 @@ void KviHttpFileTransfer::connectionEstabilished() displayUpdate(); } -void KviHttpFileTransfer::resolvingHost(const QString &hostname) +void KviHttpFileTransfer::resolvingHost(const TQString &hostname) { - m_szStatusString = __tr2qs_ctx("Resolving host %1","http").arg(hostname); + m_szStatusString = __tr2qs_ctx("Resolving host %1","http").tqarg(hostname); displayUpdate(); } -void KviHttpFileTransfer::contactingHost(const QString &ipandport) +void KviHttpFileTransfer::contactingHost(const TQString &ipandport) { - m_szStatusString = __tr2qs_ctx("Contacting host %1","http").arg(ipandport); + m_szStatusString = __tr2qs_ctx("Contacting host %1","http").tqarg(ipandport); displayUpdate(); } -void KviHttpFileTransfer::receivedResponse(const QString &response) +void KviHttpFileTransfer::receivedResponse(const TQString &response) { m_lHeaders.clear(); m_lHeaders.append(response); - m_szStatusString = __tr2qs_ctx("Transferring data (%1)","http").arg(response); + m_szStatusString = __tr2qs_ctx("Transferring data (%1)","http").tqarg(response); m_tTransferStartTime = kvi_unixTime(); - m_eGeneralStatus = Downloading; + m_eGeneraltqStatus = Downloading; displayUpdate(); } -void KviHttpFileTransfer::statusMessage(const QString &txt) +void KviHttpFileTransfer::statusMessage(const TQString &txt) { KviWindow * out = transferWindow(); if(out && (!m_bNoOutput)) @@ -439,25 +439,25 @@ void KviHttpFileTransfer::transferTerminated(bool bSuccess) if(bSuccess) { m_szStatusString = __tr2qs_ctx("Transfer completed","http"); - m_eGeneralStatus = Success; + m_eGeneraltqStatus = Success; displayUpdate(); if(out && (!m_bNoOutput))out->output(KVI_OUT_GENERICSUCCESS,__tr2qs_ctx("[HTTP %d]: Transfer completed","http"),id()); - g_pApp->fileDownloadTerminated(true,m_pHttpRequest->url().url().ptr(),m_pHttpRequest->fileName(),QString::null,QString::null,!m_bNotifyCompletion); + g_pApp->fileDownloadTerminated(true,m_pHttpRequest->url().url().ptr(),m_pHttpRequest->fileName(),TQString(),TQString(),!m_bNotifyCompletion); } else { m_szStatusString = __tr2qs_ctx("Transfer failed","http"); m_szStatusString += ": "; m_szStatusString += m_pHttpRequest->lastError(); - m_eGeneralStatus = Failure; + m_eGeneraltqStatus = Failure; displayUpdate(); if(out && (!m_bNoOutput))out->output(KVI_OUT_GENERICERROR,__tr2qs_ctx("[HTTP %d]: Transfer failed: %Q","http"),id(),&(m_pHttpRequest->lastError())); - g_pApp->fileDownloadTerminated(false,m_pHttpRequest->url().url().ptr(),m_pHttpRequest->fileName(),QString::null,m_pHttpRequest->lastError(),!m_bNotifyCompletion); + g_pApp->fileDownloadTerminated(false,m_pHttpRequest->url().url().ptr(),m_pHttpRequest->fileName(),TQString(),m_pHttpRequest->lastError(),!m_bNotifyCompletion); } if(m_bAutoClean) { if(m_pAutoCleanTimer)delete m_pAutoCleanTimer; - m_pAutoCleanTimer = new QTimer(); - connect(m_pAutoCleanTimer,SIGNAL(timeout()),this,SLOT(autoClean())); + m_pAutoCleanTimer = new TQTimer(); + connect(m_pAutoCleanTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(autoClean())); m_pAutoCleanTimer->start(100,true); } } @@ -471,7 +471,7 @@ void KviHttpFileTransfer::headersReceived(KviPointerHashTable<const char *,KviSt KviPointerHashTableIterator<const char *,KviStr> it(*h); while(KviStr * s = it.current()) { - QString szHeader = it.currentKey(); + TQString szHeader = it.currentKey(); szHeader += ": "; szHeader += s->ptr(); m_lHeaders.append(szHeader); @@ -482,7 +482,7 @@ void KviHttpFileTransfer::headersReceived(KviPointerHashTable<const char *,KviSt bool KviHttpFileTransfer::startDownload() { - m_eGeneralStatus = Connecting; + m_eGeneraltqStatus = Connecting; return m_pHttpRequest->start(); } diff --git a/src/modules/http/httpfiletransfer.h b/src/modules/http/httpfiletransfer.h index e6c5006e..792205b1 100644 --- a/src/modules/http/httpfiletransfer.h +++ b/src/modules/http/httpfiletransfer.h @@ -30,26 +30,27 @@ #include "kvi_kvs_variant.h" -#include <qstringlist.h> -#include <qtimer.h> +#include <tqstringlist.h> +#include <tqtimer.h> -class QPainter; +class TQPainter; class KviTalPopupMenu; class KviHttpFileTransfer : public KviFileTransfer { - enum GeneralStatus { Initializing, Connecting, Downloading, Success, Failure }; + enum GeneraltqStatus { Initializing, Connecting, Downloading, Success, Failure }; Q_OBJECT + TQ_OBJECT public: KviHttpFileTransfer(); ~KviHttpFileTransfer(); private: KviHttpRequest * m_pHttpRequest; - GeneralStatus m_eGeneralStatus; - QString m_szStatusString; + GeneraltqStatus m_eGeneraltqStatus; + TQString m_szStatusString; - QStringList m_lHeaders; - QStringList m_lRequest; + TQStringList m_lHeaders; + TQStringList m_lRequest; kvi_time_t m_tStartTime; kvi_time_t m_tTransferStartTime; @@ -60,9 +61,9 @@ private: bool m_bAutoClean; bool m_bNoOutput; - QTimer * m_pAutoCleanTimer; + TQTimer * m_pAutoCleanTimer; - QString m_szCompletionCallback; + TQString m_szCompletionCallback; public: KviHttpRequest * request(){ return m_pHttpRequest; }; static unsigned int runningTransfers(); @@ -71,28 +72,28 @@ public: virtual bool startDownload(); - void setCompletionCallback(const QString &szCallback){ m_szCompletionCallback = szCallback; }; + void setCompletionCallback(const TQString &szCallback){ m_szCompletionCallback = szCallback; }; void setMagicIdentifier(const KviKvsVariant &vIdentifier){ m_vMagicIdentifier = vIdentifier; }; void setNotifyCompletion(bool bNotify){ m_bNotifyCompletion = bNotify; }; void setAutoClean(bool bAutoClean){ m_bAutoClean = bAutoClean; }; void setNoOutput(bool bNoOutput){ m_bNoOutput = bNoOutput; }; - virtual void displayPaint(QPainter * p,int column,int width,int height); + virtual void displayPaint(TQPainter * p,int column,int width,int height); virtual int displayHeight(int iLineSpacing); virtual void fillContextPopup(KviTalPopupMenu * m,int column); virtual bool active(); virtual void die(); - virtual QString tipText(); - virtual QString localFileName(); + virtual TQString tipText(); + virtual TQString localFileName(); protected slots: - void statusMessage(const QString &txt); + void statusMessage(const TQString &txt); void transferTerminated(bool bSuccess); void headersReceived(KviPointerHashTable<const char *,KviStr> *h); - void requestSent(const QStringList &sl); + void requestSent(const TQStringList &sl); - void resolvingHost(const QString &hostname); - void contactingHost(const QString &ipandport); - void receivedResponse(const QString &response); + void resolvingHost(const TQString &hostname); + void contactingHost(const TQString &ipandport); + void receivedResponse(const TQString &response); void connectionEstabilished(); void abort(); diff --git a/src/modules/http/libkvihttp.cpp b/src/modules/http/libkvihttp.cpp index eb6f28fb..8b98b218 100644 --- a/src/modules/http/libkvihttp.cpp +++ b/src/modules/http/libkvihttp.cpp @@ -36,7 +36,7 @@ #include "httpfiletransfer.h" -static bool http_kvs_complete_get(KviKvsModuleCommandCall * c,QString &szUrl,QString &szFileName,const QString &szCallback) +static bool http_kvs_complete_get(KviKvsModuleCommandCall * c,TQString &szUrl,TQString &szFileName,const TQString &szCallback) { if(szUrl.isEmpty()) { @@ -46,17 +46,17 @@ static bool http_kvs_complete_get(KviKvsModuleCommandCall * c,QString &szUrl,QSt KviUrl url(szUrl); - QString tmp; + TQString tmp; if(szFileName.isEmpty()) { - if(c->switches()->find('a',"auto-file-name")) + if(c->switches()->tqfind('a',"auto-file-name")) { tmp = szUrl; - tmp.replace('/',"_"); - tmp.replace(':',"_"); - tmp.replace('@',"_"); - tmp.replace('?',"_"); + tmp.tqreplace('/',"_"); + tmp.tqreplace(':',"_"); + tmp.tqreplace('@',"_"); + tmp.tqreplace('?',"_"); // http____path_path2_path3_filename.ext g_pApp->getLocalKvircDirectory(szFileName,KviApp::Incoming,tmp); } else { @@ -68,7 +68,7 @@ static bool http_kvs_complete_get(KviKvsModuleCommandCall * c,QString &szUrl,QSt KviHttpFileTransfer * hft = new KviHttpFileTransfer(); - bool bHead = c->switches()->find('h',"head"); + bool bHead = c->switches()->tqfind('h',"head"); if(c->switches()->getAsStringIfExisting('p',"post-data",tmp)) { @@ -86,13 +86,13 @@ static bool http_kvs_complete_get(KviKvsModuleCommandCall * c,QString &szUrl,QSt if(c->switches()->getAsStringIfExisting('e',"existing-file-action",tmp)) { - if(KviQString::equalCI(tmp,"e")) + if(KviTQString::equalCI(tmp,"e")) hft->request()->setExistingFileAction(KviHttpRequest::RenameExisting); - else if(KviQString::equalCI(tmp,"i")) + else if(KviTQString::equalCI(tmp,"i")) hft->request()->setExistingFileAction(KviHttpRequest::RenameIncoming); - else if(KviQString::equalCI(tmp,"o")) + else if(KviTQString::equalCI(tmp,"o")) hft->request()->setExistingFileAction(KviHttpRequest::Overwrite); - else if(KviQString::equalCI(tmp,"r")) + else if(KviTQString::equalCI(tmp,"r")) hft->request()->setExistingFileAction(KviHttpRequest::Resume); } @@ -114,25 +114,25 @@ static bool http_kvs_complete_get(KviKvsModuleCommandCall * c,QString &szUrl,QSt if(c->switches()->getAsStringIfExisting('w',"winctrl",tmp)) { - if(!tmp.contains('h'))hft->invokeTransferWindow(c->window(),tmp.contains('m'),tmp.contains('n')); + if(!tmp.tqcontains('h'))hft->invokeTransferWindow(c->window(),tmp.tqcontains('m'),tmp.tqcontains('n')); } else { hft->invokeTransferWindow(c->window(),false,false); } - KviKvsVariant * v = c->switches()->find('i',"identifier"); + KviKvsVariant * v = c->switches()->tqfind('i',"identifier"); if(v) hft->setMagicIdentifier(*v); - if(c->switches()->find('q',"quiet")) + if(c->switches()->tqfind('q',"quiet")) hft->setNotifyCompletion(false); - if(c->switches()->find('y',"no-output")) + if(c->switches()->tqfind('y',"no-output")) hft->setNoOutput(true); if(!szCallback.isEmpty()) hft->setCompletionCallback(szCallback); - if(c->switches()->find('c',"clear")) + if(c->switches()->tqfind('c',"clear")) hft->setAutoClean(true); if(!hft->startDownload()) @@ -242,13 +242,13 @@ static bool http_kvs_complete_get(KviKvsModuleCommandCall * c,QString &szUrl,QSt static bool http_kvs_cmd_get(KviKvsModuleCommandCall * c) { - QString szUrl,szFileName; + TQString szUrl,szFileName; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("url",KVS_PT_NONEMPTYSTRING,0,szUrl) KVSM_PARAMETER("filename",KVS_PT_STRING,KVS_PF_OPTIONAL,szFileName) KVSM_PARAMETERS_END(c) - return http_kvs_complete_get(c,szUrl,szFileName,QString::null); + return http_kvs_complete_get(c,szUrl,szFileName,TQString()); } /* @doc: http.asyncGet @@ -281,7 +281,7 @@ static bool http_kvs_cmd_get(KviKvsModuleCommandCall * c) static bool http_kvs_cmd_asyncGet(KviKvsModuleCallbackCommandCall * c) { - QString szUrl,szFileName; + TQString szUrl,szFileName; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("url",KVS_PT_NONEMPTYSTRING,0,szUrl) KVSM_PARAMETER("filename",KVS_PT_STRING,KVS_PF_OPTIONAL,szFileName) |