diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /knewsticker/common/newsiconmgr.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knewsticker/common/newsiconmgr.cpp')
-rw-r--r-- | knewsticker/common/newsiconmgr.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/knewsticker/common/newsiconmgr.cpp b/knewsticker/common/newsiconmgr.cpp index 69617490..b6787dff 100644 --- a/knewsticker/common/newsiconmgr.cpp +++ b/knewsticker/common/newsiconmgr.cpp @@ -16,15 +16,15 @@ #include <kiconloader.h> #include <kstandarddirs.h> -#include <qbuffer.h> -#include <qfile.h> -#include <qimage.h> +#include <tqbuffer.h> +#include <tqfile.h> +#include <tqimage.h> struct KIODownload { KURL url; - QByteArray data; - QIODevice::Offset dataOffset; + TQByteArray data; + TQIODevice::Offset dataOffset; }; NewsIconMgr *NewsIconMgr::m_instance = 0; @@ -37,13 +37,13 @@ NewsIconMgr *NewsIconMgr::self() return m_instance; } -NewsIconMgr::NewsIconMgr(QObject *parent, const char *name) - : QObject(parent, name), DCOPObject("NewsIconMgr"), - m_stdIcon(SmallIcon(QString::fromLatin1("news"))) +NewsIconMgr::NewsIconMgr(TQObject *parent, const char *name) + : TQObject(parent, name), DCOPObject("NewsIconMgr"), + m_stdIcon(SmallIcon(TQString::fromLatin1("news"))) { connectDCOPSignal("kded", - "favicons", "iconChanged(bool, QString, QString)", - "slotGotIcon(bool, QString, QString)", + "favicons", "iconChanged(bool, TQString, TQString)", + "slotGotIcon(bool, TQString, TQString)", false); } @@ -60,11 +60,11 @@ void NewsIconMgr::getIcon(const KURL &url) } if (url.isLocalFile()) { - if (QFile::exists(url.encodedPathAndQuery())) { - QPixmap icon(url.encodedPathAndQuery()); + if (TQFile::exists(url.encodedPathAndQuery())) { + TQPixmap icon(url.encodedPathAndQuery()); if (!icon.isNull()) { - if (icon.size() != QSize(16, 16)) { - if (!icon.convertFromImage(icon.convertToImage().smoothScale(16, 16, QImage::ScaleMin))) { + if (icon.size() != TQSize(16, 16)) { + if (!icon.convertFromImage(icon.convertToImage().smoothScale(16, 16, TQImage::ScaleMin))) { emit gotIcon(url, m_stdIcon); return; } @@ -79,19 +79,19 @@ void NewsIconMgr::getIcon(const KURL &url) if (url.encodedPathAndQuery() == "/favicon.ico") { if (favicon(url).isNull()) { - QByteArray data; - QDataStream ds(data, IO_WriteOnly); + TQByteArray data; + TQDataStream ds(data, IO_WriteOnly); ds << url; kapp->dcopClient()->send("kded", "favicons", "downloadHostIcon(KURL)", data); } else { - emit gotIcon(url, QPixmap(KGlobal::dirs()->findResource("cache", - QString::fromLatin1("favicons/%1.png").arg(url.host())))); + emit gotIcon(url, TQPixmap(KGlobal::dirs()->findResource("cache", + TQString::fromLatin1("favicons/%1.png").arg(url.host())))); } } else { KIO::Job *job = KIO::get(url, true, false); - connect(job, SIGNAL(data(KIO::Job *, const QByteArray &)), - SLOT(slotData(KIO::Job *, const QByteArray &))); - connect(job, SIGNAL(result(KIO::Job *)), SLOT(slotResult(KIO::Job *))); + connect(job, TQT_SIGNAL(data(KIO::Job *, const TQByteArray &)), + TQT_SLOT(slotData(KIO::Job *, const TQByteArray &))); + connect(job, TQT_SIGNAL(result(KIO::Job *)), TQT_SLOT(slotResult(KIO::Job *))); KIODownload download; download.url = url; @@ -100,7 +100,7 @@ void NewsIconMgr::getIcon(const KURL &url) } } -bool NewsIconMgr::isStdIcon(const QPixmap &pixmap) const +bool NewsIconMgr::isStdIcon(const TQPixmap &pixmap) const { if (!pixmap.isNull()) return pixmap.convertToImage() == m_stdIcon.convertToImage(); @@ -108,9 +108,9 @@ bool NewsIconMgr::isStdIcon(const QPixmap &pixmap) const return false; } -void NewsIconMgr::slotData(KIO::Job *job, const QByteArray &data) +void NewsIconMgr::slotData(KIO::Job *job, const TQByteArray &data) { - QBuffer buf(m_kioDownload[job].data); + TQBuffer buf(m_kioDownload[job].data); buf.open(IO_WriteOnly); buf.at(m_kioDownload[job].dataOffset); buf.writeBlock(data); @@ -119,41 +119,41 @@ void NewsIconMgr::slotData(KIO::Job *job, const QByteArray &data) void NewsIconMgr::slotResult(KIO::Job *job) { - emit gotIcon(m_kioDownload[job].url, QPixmap(m_kioDownload[job].data)); + emit gotIcon(m_kioDownload[job].url, TQPixmap(m_kioDownload[job].data)); m_kioDownload.remove(job); } -void NewsIconMgr::slotGotIcon(bool isHost, QString hostOrURL, QString iconName) +void NewsIconMgr::slotGotIcon(bool isHost, TQString hostOrURL, TQString iconName) { KURL url = KURL(hostOrURL); if (!isHost) - url.setProtocol(QString::fromLatin1("http")); + url.setProtocol(TQString::fromLatin1("http")); if (iconName.isNull()) emit gotIcon(url, m_stdIcon); else - emit gotIcon(url, QPixmap(KGlobal::dirs()->findResource("cache", - QString::fromLatin1("favicons/%1.png").arg(url.host())))); + emit gotIcon(url, TQPixmap(KGlobal::dirs()->findResource("cache", + TQString::fromLatin1("favicons/%1.png").arg(url.host())))); } -QString NewsIconMgr::favicon(const KURL &url) const +TQString NewsIconMgr::favicon(const KURL &url) const { - QByteArray data, reply; - QCString replyType; - QDataStream ds(data, IO_WriteOnly); + TQByteArray data, reply; + TQCString replyType; + TQDataStream ds(data, IO_WriteOnly); ds << url; kapp->dcopClient()->call("kded", "favicons", "iconForURL(KURL)", data, replyType, reply); - if (replyType == "QString") { - QDataStream replyStream(reply, IO_ReadOnly); - QString result; + if (replyType == "TQString") { + TQDataStream replyStream(reply, IO_ReadOnly); + TQString result; replyStream >> result; return result; } - return QString::null; + return TQString::null; } #include "newsiconmgr.moc" |