summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Appelhans <[email protected]>2014-10-24 18:00:03 +0200
committerLukas Appelhans <[email protected]>2014-10-24 18:00:03 +0200
commit7ff765cdd6d56abde06bf5de23a966217262e649 (patch)
tree05a8bb73464006166d7d7e83aa8a7cfd61aa5713
parent8bf5d0567840ec33331555374ee6b5c4ca2df4f1 (diff)
Port kDebug to qCDebug, and finally a basic transfer is working
-rw-r--r--CMakeLists.txt2
-rw-r--r--conf/transfersgrouptree.cpp9
-rw-r--r--core/datasourcefactory.cpp71
-rw-r--r--core/download.cpp15
-rw-r--r--core/job.cpp8
-rw-r--r--core/jobqueue.cpp5
-rw-r--r--core/keydownloader.cpp21
-rw-r--r--core/kget.cpp66
-rw-r--r--core/kgetglobaljob.cpp6
-rw-r--r--core/kgetkjobadapter.cpp4
-rw-r--r--core/kuiserverjobs.cpp9
-rw-r--r--core/mostlocalurl.cpp13
-rw-r--r--core/scheduler.cpp33
-rw-r--r--core/signature.cpp21
-rw-r--r--core/signaturethread.cpp5
-rw-r--r--core/transferdatasource.cpp7
-rw-r--r--core/transfergroup.cpp17
-rw-r--r--core/transfergrouphandler.cpp11
-rw-r--r--core/transfergroupscheduler.cpp5
-rw-r--r--core/transferhandler.cpp9
-rw-r--r--core/transferhistorystore_sqlite.cpp15
-rw-r--r--core/transferhistorystore_xml.cpp7
-rw-r--r--core/transfertreemodel.cpp21
-rw-r--r--core/urlchecker.cpp8
-rw-r--r--core/verificationmodel.cpp5
-rw-r--r--core/verificationthread.cpp9
-rw-r--r--core/verifier.cpp5
-rw-r--r--dbus/dbuskgetwrapper.cpp5
-rw-r--r--extensions/webinterface/httpserver.cpp6
-rw-r--r--kget_debug.cpp23
-rw-r--r--kget_debug.h28
-rw-r--r--mainwindow.cpp11
-rw-r--r--plasma/applet/common/kgetapplet.cpp6
-rw-r--r--tests/testtransfers.cpp62
-rw-r--r--tests/verifiertest.cpp6
-rw-r--r--transfer-plugins/bittorrent/advanceddetails/btadvanceddetailswidget.cpp2
-rw-r--r--transfer-plugins/bittorrent/btcache.cpp4
-rw-r--r--transfer-plugins/bittorrent/btdatasource.cpp6
-rw-r--r--transfer-plugins/bittorrent/btdetailswidget.cpp2
-rw-r--r--transfer-plugins/bittorrent/btsettingswidget.cpp2
-rw-r--r--transfer-plugins/bittorrent/bttransfer.cpp20
-rw-r--r--transfer-plugins/bittorrent/bttransferfactory.cpp6
-rw-r--r--transfer-plugins/bittorrent/bttransferhandler.cpp6
-rw-r--r--transfer-plugins/checksumsearch/checksumsearch.cpp12
-rw-r--r--transfer-plugins/checksumsearch/checksumsearchfactory.cpp2
-rw-r--r--transfer-plugins/checksumsearch/checksumsearchtransferdatasource.cpp28
-rw-r--r--transfer-plugins/checksumsearch/dlgchecksumsearch.cpp2
-rw-r--r--transfer-plugins/contentfetch/contentfetch.cpp6
-rw-r--r--transfer-plugins/contentfetch/contentfetchfactory.cpp2
-rw-r--r--transfer-plugins/kio/CMakeLists.txt1
-rw-r--r--transfer-plugins/kio/transferKio.cpp20
-rw-r--r--transfer-plugins/kio/transferKioFactory.cpp10
-rw-r--r--transfer-plugins/kio/transferKioFactory.h4
-rw-r--r--transfer-plugins/metalink/CMakeLists.txt4
-rw-r--r--transfer-plugins/metalink/abstractmetalink.cpp4
-rw-r--r--transfer-plugins/metalink/metalink.cpp10
-rw-r--r--transfer-plugins/metalink/metalinkfactory.cpp5
-rw-r--r--transfer-plugins/metalink/metalinkhttp.cpp9
-rw-r--r--transfer-plugins/metalink/metalinkxml.cpp11
-rw-r--r--transfer-plugins/mirrorsearch/CMakeLists.txt2
-rw-r--r--transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp5
-rw-r--r--transfer-plugins/mirrorsearch/mirrors.cpp13
-rw-r--r--transfer-plugins/mirrorsearch/mirrorsearchfactory.cpp7
-rw-r--r--transfer-plugins/mirrorsearch/mirrorsearchtransferdatasource.cpp12
-rwxr-xr-xtransfer-plugins/mmsthreads/CMakeLists.txt2
-rwxr-xr-xtransfer-plugins/mmsthreads/mmstransfer.cpp6
-rwxr-xr-xtransfer-plugins/mmsthreads/mmstransferfactory.cpp9
-rw-r--r--transfer-plugins/multisegmentkio/CMakeLists.txt2
-rw-r--r--transfer-plugins/multisegmentkio/multisegkiodatasource.cpp27
-rw-r--r--transfer-plugins/multisegmentkio/segment.cpp37
-rw-r--r--transfer-plugins/multisegmentkio/transfermultisegkio.cpp17
-rw-r--r--transfer-plugins/multisegmentkio/transfermultisegkiofactory.cpp9
-rw-r--r--ui/history/transferhistory.cpp4
-rw-r--r--ui/linkview/kget_linkview.cpp4
-rw-r--r--ui/metalinkcreator/metalinker.cpp13
-rw-r--r--ui/newtransferdialog.cpp32
-rw-r--r--ui/signaturedlg.cpp14
-rw-r--r--ui/transferdetails.cpp6
-rw-r--r--ui/transfersview.cpp13
-rw-r--r--ui/transfersviewdelegate.cpp15
-rw-r--r--ui/tray.cpp7
81 files changed, 568 insertions, 420 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92fedc4..88a59a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,6 +141,7 @@ remove_definitions(-DQT_NO_HTTP)
# kgetcore
set(kgetcore_SRCS
+ kget_debug.cpp
core/job.cpp
core/jobqueue.cpp
core/kget.cpp
@@ -229,6 +230,7 @@ install(TARGETS kgetcore ${INSTALL_TARGETS_DEFAULT_ARGS})
# kget
set(kget_SRCS ${kget_adaptor_SRCS} ${kget_transfer_adaptor_SRCS}
+ kget_debug.cpp
conf/autopastemodel.cpp
conf/integrationpreferences.cpp
conf/dlgwebinterface.cpp
diff --git a/conf/transfersgrouptree.cpp b/conf/transfersgrouptree.cpp
index e436e87..ee8fe85 100644
--- a/conf/transfersgrouptree.cpp
+++ b/conf/transfersgrouptree.cpp
@@ -18,6 +18,9 @@
#include "core/transfertreemodel.h"
#include "core/transfertreeselectionmodel.h"
+#include "kget_debug.h"
+#include <qdebug.h>
+
#include <QHeaderView>
#include <KLineEdit>
@@ -81,7 +84,7 @@ void TransfersGroupTree::setModel(QAbstractItemModel *model)
int nGroups = model->rowCount(QModelIndex());
for (int i = 0; i < nGroups; i++) {
- kDebug(5001) << "openEditor for row " << i;
+ qCDebug(KGET_DEBUG) << "openEditor for row " << i;
openPersistentEditor(model->index(i, TransferTreeModel::Status, QModelIndex()));
}
@@ -92,7 +95,7 @@ void TransfersGroupTree::rowsInserted(const QModelIndex &parent, int start, int
{
if (!parent.isValid()) {
for (int i = start; i <= end; ++i) {
- kDebug(5001) << "openEditor for row " << i;
+ qCDebug(KGET_DEBUG) << "openEditor for row " << i;
openPersistentEditor(model()->index(i, TransferTreeModel::Status, parent));
}
}
@@ -135,7 +138,7 @@ void TransfersGroupTree::renameSelectedGroup()
void TransfersGroupTree::changeIcon(const QString &icon)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
TransferTreeSelectionModel *selModel = KGet::selectionModel();
QModelIndexList indexList = selModel->selectedRows();
diff --git a/core/datasourcefactory.cpp b/core/datasourcefactory.cpp
index 5817f30..4b6e754 100644
--- a/core/datasourcefactory.cpp
+++ b/core/datasourcefactory.cpp
@@ -29,7 +29,8 @@
#include <KMessageBox>
#include <kmountpoint.h>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <kde_file.h>
@@ -67,7 +68,7 @@ DataSourceFactory::DataSourceFactory(QObject *parent, const QUrl &dest, KIO::fil
m_verifier(0),
m_signature(0)
{
- kDebug(5001) << "Initialize DataSourceFactory: Dest: " + m_dest.url() + "Size: " + QString::number(m_size) + "SegSize: " + QString::number(m_segSize);
+ qCDebug(KGET_DEBUG) << "Initialize DataSourceFactory: Dest: " + m_dest.url() + "Size: " + QString::number(m_size) + "SegSize: " + QString::number(m_segSize);
m_prevDownloadedSizes.append(0);
}
@@ -118,7 +119,7 @@ void DataSourceFactory::deinit()
void DataSourceFactory::findFileSize()
{
- kDebug(5001) << "Find the filesize" << this;
+ qCDebug(KGET_DEBUG) << "Find the filesize" << this;
if (!m_size && !m_dest.isEmpty() && !m_sources.isEmpty()) {
foreach (TransferDataSource *source, m_sources) {
if (source->capabilities() & Transfer::Cap_FindFilesize) {
@@ -138,7 +139,7 @@ void DataSourceFactory::findFileSize()
void DataSourceFactory::slotFoundFileSize(TransferDataSource *source, KIO::filesize_t fileSize, const QPair<int, int> &segmentRange)
{
m_size = fileSize;
- kDebug(5001) << source << "found size" << m_size << "and is assigned segments" << segmentRange << this;
+ qCDebug(KGET_DEBUG) << source << "found size" << m_size << "and is assigned segments" << segmentRange << this;
emit dataSourceFactoryChange(Transfer::Tc_TotalSize);
init();
@@ -177,7 +178,7 @@ bool DataSourceFactory::checkLocalFile()
fd = KDE::open(_dest, O_CREAT | O_TRUNC | O_WRONLY, initialMode);
if ( fd < 0 )
{
- kDebug(5001) << " error";
+ qCDebug(KGET_DEBUG) << " error";
return false;
}
else
@@ -186,13 +187,13 @@ bool DataSourceFactory::checkLocalFile()
}
}
- kDebug(5001) << "success";
+ qCDebug(KGET_DEBUG) << "success";
return true;
}
void DataSourceFactory::start()
{
- kDebug(5001) << "Start DataSourceFactory";
+ qCDebug(KGET_DEBUG) << "Start DataSourceFactory";
if (m_movingFile || (m_status == Job::Finished))
{
return;
@@ -206,7 +207,7 @@ void DataSourceFactory::start()
//the file already exists, even though DataSourceFactory has not been initialized remove it
//to avoid problems like over methods not finished removing it because of a redownload
if (!m_downloadInitialized && QFile::exists(m_dest.toLocalFile())) {
- kDebug(5001) << "Removing existing file.";
+ qCDebug(KGET_DEBUG) << "Removing existing file.";
m_startTried = true;
FileDeleter::deleteFile(m_dest, this, SLOT(slotRemovedFile()));
return;
@@ -250,11 +251,11 @@ void DataSourceFactory::start()
if (assignNeeded()) {
if (m_sources.count()) {
- kDebug(5001) << "Assigning a TransferDataSource.";
+ qCDebug(KGET_DEBUG) << "Assigning a TransferDataSource.";
//simply assign a TransferDataSource
assignSegments(*m_sources.begin());
} else if (m_unusedUrls.count()) {
- kDebug(5001) << "Assigning an unused mirror";
+ qCDebug(KGET_DEBUG) << "Assigning an unused mirror";
//takes the first unused mirror
addMirror(m_unusedUrls.takeFirst(), true, m_unusedConnections.takeFirst());
}
@@ -297,7 +298,7 @@ void DataSourceFactory::start()
void DataSourceFactory::slotRemovedFile()
{
- kDebug(5001) << "File has been removed" << this;
+ qCDebug(KGET_DEBUG) << "File has been removed" << this;
if (m_startTried) {
m_startTried = false;
start();
@@ -307,7 +308,7 @@ void DataSourceFactory::slotRemovedFile()
void DataSourceFactory::open(KIO::Job *job)
{
Q_UNUSED(job)
- kDebug(5001) << "File opened" << this;
+ qCDebug(KGET_DEBUG) << "File opened" << this;
if (!m_speedTimer)
{
@@ -326,7 +327,7 @@ void DataSourceFactory::open(KIO::Job *job)
void DataSourceFactory::stop()
{
- kDebug(5001) << "Stopping" << this;
+ qCDebug(KGET_DEBUG) << "Stopping" << this;
if (m_movingFile || (m_status == Job::Finished))
{
return;
@@ -384,7 +385,7 @@ void DataSourceFactory::addMirror(const QUrl &url, bool used, int numParalellCon
{
if (!url.isValid() || url.isEmpty())
{
- kDebug(5001) << "Url is not useable: " << url.toString();
+ qCDebug(KGET_DEBUG) << "Url is not useable: " << url.toString();
return;
}
if (numParalellConnections <= 0)
@@ -409,7 +410,7 @@ void DataSourceFactory::addMirror(const QUrl &url, bool used, int numParalellCon
for (int i = source->changeNeeded(); i < 0; ++i)
{
const QPair<int, int> removed = source->removeConnection();
- kDebug(5001) << "Remove connection with segments" << removed;
+ qCDebug(KGET_DEBUG) << "Remove connection with segments" << removed;
const int start = removed.first;
const int end = removed.second;
if ((start != -1) && (end != -1)) {
@@ -425,7 +426,7 @@ void DataSourceFactory::addMirror(const QUrl &url, bool used, int numParalellCon
TransferDataSource *source = KGet::createTransferDataSource(url, QDomElement(), this);
if (source)
{
- kDebug(5001) << "Successfully created a TransferDataSource for " << url.toString() << this;
+ qCDebug(KGET_DEBUG) << "Successfully created a TransferDataSource for " << url.toString() << this;
//url might have been an unused Mirror, so remove it in any case
const int index = m_unusedUrls.indexOf(url);
@@ -462,7 +463,7 @@ void DataSourceFactory::addMirror(const QUrl &url, bool used, int numParalellCon
}
else
{
- kDebug(5001) << "A TransferDataSource could not be created for " << url.toString();
+ qCDebug(KGET_DEBUG) << "A TransferDataSource could not be created for " << url.toString();
}
}
else if (usedDefined)
@@ -502,7 +503,7 @@ void DataSourceFactory::slotUrlChanged(const QUrl &old, const QUrl &newUrl)
void DataSourceFactory::removeMirror(const QUrl &url)
{
- kDebug(5001) << "Removing mirror: " << url;
+ qCDebug(KGET_DEBUG) << "Removing mirror: " << url;
if (m_sources.contains(url))
{
TransferDataSource *source = m_sources[url];
@@ -519,7 +520,7 @@ void DataSourceFactory::removeMirror(const QUrl &url)
const int end = assigned[i].second;
if ((start != -1) && (end != -1)) {
m_startedChunks->setRange(start, end, false);
- kDebug(5001) << "Segmentrange" << start << '-' << end << "not assigned anymore.";
+ qCDebug(KGET_DEBUG) << "Segmentrange" << start << '-' << end << "not assigned anymore.";
}
}
}
@@ -528,7 +529,7 @@ void DataSourceFactory::removeMirror(const QUrl &url)
//here we only handle the case when there are existing TransferDataSources,
//the other case is triggered when stopping and then starting again
if (m_sources.count()) {
- kDebug(5001) << "Assigning a TransferDataSource.";
+ qCDebug(KGET_DEBUG) << "Assigning a TransferDataSource.";
//simply assign a TransferDataSource
assignSegments(*m_sources.begin());
}
@@ -596,7 +597,7 @@ bool DataSourceFactory::assignNeeded() const
void DataSourceFactory::brokenSegments(TransferDataSource *source, const QPair<int, int> &segmentRange)
{
- kDebug(5001) << "Segments" << segmentRange << "broken," << source;
+ qCDebug(KGET_DEBUG) << "Segments" << segmentRange << "broken," << source;
if (!source || !m_startedChunks || !m_finishedChunks || (segmentRange.first < 0) || (segmentRange.second < 0) || (static_cast<quint32>(segmentRange.second) > m_finishedChunks->getNumBits()))
{
return;
@@ -614,7 +615,7 @@ void DataSourceFactory::brokenSegments(TransferDataSource *source, const QPair<i
void DataSourceFactory::broken(TransferDataSource *source, TransferDataSource::Error error)
{
- kDebug(5001) << source << "is broken with error" << error;
+ qCDebug(KGET_DEBUG) << source << "is broken with error" << error;
const QString url = source->sourceUrl().toString();
removeMirror(source->sourceUrl());
@@ -627,13 +628,13 @@ void DataSourceFactory::broken(TransferDataSource *source, TransferDataSource::E
void DataSourceFactory::slotFreeSegments(TransferDataSource *source, QPair<int, int> segmentRange)
{
- kDebug(5001) << "Segments freed:" << source << segmentRange;
+ qCDebug(KGET_DEBUG) << "Segments freed:" << source << segmentRange;
const int start = segmentRange.first;
const int end = segmentRange.second;
if ((start != -1) && (end != -1)) {
m_startedChunks->setRange(start, end, false);
- kDebug(5001) << "Segmentrange" << start << '-' << end << "not assigned anymore.";
+ qCDebug(KGET_DEBUG) << "Segmentrange" << start << '-' << end << "not assigned anymore.";
}
assignSegments(source);
@@ -643,7 +644,7 @@ void DataSourceFactory::finishedSegment(TransferDataSource *source, int segmentN
{
if (!source || (segmentNumber < 0) || (static_cast<quint32>(segmentNumber) > m_finishedChunks->getNumBits()))
{
- kDebug(5001) << "Incorrect data";
+ qCDebug(KGET_DEBUG) << "Incorrect data";
return;
}
@@ -651,7 +652,7 @@ void DataSourceFactory::finishedSegment(TransferDataSource *source, int segmentN
if (!connectionFinished)
{
- kDebug(5001) << "Some segments still not finished";
+ qCDebug(KGET_DEBUG) << "Some segments still not finished";
return;
}
@@ -669,19 +670,19 @@ void DataSourceFactory::assignSegments(TransferDataSource *source)
{
if (!m_startedChunks || !m_finishedChunks)
{
- kDebug(5001) << "Assign tried";
+ qCDebug(KGET_DEBUG) << "Assign tried";
m_assignTried = true;
return;
}
if (m_finishedChunks->allOn())
{
- kDebug(5001) << "All segments are finished already.";
+ qCDebug(KGET_DEBUG) << "All segments are finished already.";
return;
}
//no more segments needed for that TransferDataSource
if (source->changeNeeded() <= 0) {
- kDebug(5001) << "No change needed for" << source;
+ qCDebug(KGET_DEBUG) << "No change needed for" << source;
return;
}
@@ -713,7 +714,7 @@ void DataSourceFactory::assignSegments(TransferDataSource *source)
if ((newStart == -1) || (newEnd == -1))
{
- kDebug(5001) << "No segment can be assigned.";
+ qCDebug(KGET_DEBUG) << "No segment can be assigned.";
return;
}
@@ -722,7 +723,7 @@ void DataSourceFactory::assignSegments(TransferDataSource *source)
//the lastSegsize is rest, but only if there is a rest and it is the last segment of the download
const KIO::fileoffset_t lastSegSize = ((static_cast<uint>(newEnd + 1) == m_startedChunks->getNumBits() && rest) ? rest : m_segSize);
- kDebug(5001) << "Segments assigned:" << newStart << "-" << newEnd << "segment-size:" << m_segSize << "rest:" << rest;
+ qCDebug(KGET_DEBUG) << "Segments assigned:" << newStart << "-" << newEnd << "segment-size:" << m_segSize << "rest:" << rest;
m_startedChunks->setRange(newStart, newEnd, true);
source->addSegments(qMakePair(m_segSize, lastSegSize), qMakePair(newStart, newEnd));
@@ -806,7 +807,7 @@ void DataSourceFactory::killPutJob()
{
if (m_putJob)
{
- kDebug(5001) << "Closing the file";
+ qCDebug(KGET_DEBUG) << "Closing the file";
m_open = false;
m_putJob->close();
m_putJob = 0;
@@ -906,7 +907,7 @@ void DataSourceFactory::slotRepair(const QList<KIO::fileoffset_t> &offsets, KIO:
if (!m_startedChunks || !m_finishedChunks)
{
- kDebug(5001) << "Redownload everything";
+ qCDebug(KGET_DEBUG) << "Redownload everything";
m_downloadedSize = 0;
}
else
@@ -915,7 +916,7 @@ void DataSourceFactory::slotRepair(const QList<KIO::fileoffset_t> &offsets, KIO:
m_startedChunks->clear();
m_finishedChunks->clear();
}
- kDebug(5001) << "Redownload broken pieces";
+ qCDebug(KGET_DEBUG) << "Redownload broken pieces";
for (int i = 0; i < offsets.count(); ++i) {
const int start = offsets[i] / m_segSize;
const int end = std::ceil(length / static_cast<double>(m_segSize)) - 1 + start;
@@ -1025,7 +1026,7 @@ void DataSourceFactory::load(const QDomElement *element)
if (!m_finishedChunks)
{
m_finishedChunks = new BitSet(data.data(), numBits);
- kDebug(5001) << m_finishedChunks->numOnBits() << " bits on of " << numBits << " bits.";
+ qCDebug(KGET_DEBUG) << m_finishedChunks->numOnBits() << " bits on of " << numBits << " bits.";
}
//set the finished chunks to started
diff --git a/core/download.cpp b/core/download.cpp
index 378f86e..f689e19 100644
--- a/core/download.cpp
+++ b/core/download.cpp
@@ -11,13 +11,14 @@
#include <QFile>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
Download::Download(const QUrl &srcUrl, const QUrl &destUrl)
: m_srcUrl(srcUrl),
m_destUrl(destUrl)
{
- kDebug(5001) << "DownloadFile: " << m_srcUrl.url() << " to dest: " << m_destUrl.url();
+ qCDebug(KGET_DEBUG) << "DownloadFile: " << m_srcUrl.url() << " to dest: " << m_destUrl.url();
m_copyJob = KIO::get(m_srcUrl, KIO::NoReload, KIO::HideProgressInfo);
connect(m_copyJob, SIGNAL(data(KIO::Job*,QByteArray)), SLOT(slotData(KIO::Job*,QByteArray)));
connect(m_copyJob, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)));
@@ -30,7 +31,7 @@ Download::~Download()
void Download::slotData(KIO::Job *job, const QByteArray& data)
{
Q_UNUSED(job)
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
/**if (data.size() == 0)
{
slotResult(job);
@@ -41,12 +42,12 @@ void Download::slotData(KIO::Job *job, const QByteArray& data)
void Download::slotResult(KJob * job)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
switch (job->error())
{
case 0://The download has finished
{
- kDebug(5001) << "Downloading successfully finished" << m_destUrl.url();
+ qCDebug(KGET_DEBUG) << "Downloading successfully finished" << m_destUrl.url();
QFile torrentFile(m_destUrl.toLocalFile());
if (!torrentFile.open(QIODevice::WriteOnly | QIODevice::Text)) {}
//TODO: Do a Message box here
@@ -58,14 +59,14 @@ void Download::slotResult(KJob * job)
}
case KIO::ERR_FILE_ALREADY_EXIST:
{
- kDebug(5001) << "ERROR - File already exists";
+ qCDebug(KGET_DEBUG) << "ERROR - File already exists";
QFile file(m_destUrl.toLocalFile());
emit finishedSuccessfully(m_destUrl, file.readAll());
m_data = 0;
break;
}
default:
- kDebug(5001) << "We are sorry to say you, that there were errors while downloading :(";
+ qCDebug(KGET_DEBUG) << "We are sorry to say you, that there were errors while downloading :(";
m_data = 0;
emit finishedWithError();
break;
diff --git a/core/job.cpp b/core/job.cpp
index 81e27b8..aef08b0 100644
--- a/core/job.cpp
+++ b/core/job.cpp
@@ -13,8 +13,8 @@
#include "core/jobqueue.h"
#include "core/scheduler.h"
-
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
Job::Job(Scheduler * scheduler, JobQueue * parent)
: QObject(parent),
@@ -47,7 +47,7 @@ void Job::setStatus(Status jobStatus)
void Job::setStartStatus(Status jobStatus)
{
- kDebug(5001) << "Setting start status to " << jobStatus;
+ qCDebug(KGET_DEBUG) << "Setting start status to " << jobStatus;
m_startStatus = jobStatus;
}
@@ -56,7 +56,7 @@ void Job::setPolicy(Policy jobPolicy)
if(jobPolicy == m_policy)
return;
- kDebug(5001) << "Job::setPolicy(" << jobPolicy << ")";
+ qCDebug(KGET_DEBUG) << "Job::setPolicy(" << jobPolicy << ")";
m_policy = jobPolicy;
m_scheduler->jobChangedEvent(this, m_policy);
diff --git a/core/jobqueue.cpp b/core/jobqueue.cpp
index a1e6252..9b51036 100644
--- a/core/jobqueue.cpp
+++ b/core/jobqueue.cpp
@@ -12,7 +12,8 @@
#include "core/scheduler.h"
#include "settings.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
JobQueue::JobQueue(Scheduler * parent)
: QObject(parent),
@@ -122,7 +123,7 @@ void JobQueue::remove(const QList<Job*> jobs)
void JobQueue::move(Job * job, Job * after)
{
- kDebug(5001) << "JobQueue::move";
+ qCDebug(KGET_DEBUG) << "JobQueue::move";
if( (m_jobs.removeAll(job) == 0) || (job == after) ||
((after) && (after->jobQueue() != this)) )
diff --git a/core/keydownloader.cpp b/core/keydownloader.cpp
index 9526b30..b86e0a2 100644
--- a/core/keydownloader.cpp
+++ b/core/keydownloader.cpp
@@ -21,7 +21,8 @@
#include "settings.h"
#include "signature_p.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <KIO/Job>
#include <KLocale>
#include <KMessageBox>
@@ -105,7 +106,7 @@ void KeyDownloader::downloadKey(QString fingerprint, Signature *sig, bool mirror
url.setQuery("op=get&options=mr&search=" + fingerprint);
url.setPort(11371);
- kDebug(5001) << "Dowloading:" << url;
+ qCDebug(KGET_DEBUG) << "Dowloading:" << url;
KIO::StoredTransferJob *job = KIO::storedGet(url, KIO::Reload, KIO::HideProgressInfo);
m_jobs[job] = fingerprint;
@@ -124,7 +125,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
KIO::StoredTransferJob *transferJob = static_cast<KIO::StoredTransferJob*>(job);
if (transferJob->isErrorPage()) {
- kDebug(5001) << "Mirror did not work, try another one.";
+ qCDebug(KGET_DEBUG) << "Mirror did not work, try another one.";
downloadKey(fingerprint, 0, true);
return;
}
@@ -132,7 +133,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
QByteArray data = transferJob->data();
if (data.isEmpty()) {
- kDebug(5001) << "Downloaded data is empty.";
+ qCDebug(KGET_DEBUG) << "Downloaded data is empty.";
downloadKey(fingerprint, 0, true);
return;
}
@@ -140,7 +141,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
const int indexStart = data.indexOf("<pre>");
const int indexEnd = data.indexOf("</pre>", indexStart);
if ((indexStart == -1) || (indexEnd == -1)) {
- kDebug(5001) << "Could not find a key.";
+ qCDebug(KGET_DEBUG) << "Could not find a key.";
downloadKey(fingerprint, 0, true);
return;
}
@@ -150,13 +151,13 @@ void KeyDownloader::slotDownloaded(KJob *job)
GpgME::initializeLibrary();
GpgME::Error err = GpgME::checkEngine(GpgME::OpenPGP);
if (err) {
- kDebug(5001) << "Problem checking the engine.";
+ qCDebug(KGET_DEBUG) << "Problem checking the engine.";
return;
}
QScopedPointer<GpgME::Context> context(GpgME::Context::createForProtocol(GpgME::OpenPGP));
if (!context.data()) {
- kDebug(5001) << "Could not create context.";
+ qCDebug(KGET_DEBUG) << "Could not create context.";
return;
}
@@ -165,11 +166,11 @@ void KeyDownloader::slotDownloaded(KJob *job)
GpgME::ImportResult importResult = context->importKeys(key);
err = importResult.error();
if (err) {
- kDebug(5001) << "Error while importing key.";;
+ qCDebug(KGET_DEBUG) << "Error while importing key.";;
return;
}
- kDebug(5001) << "Key downloaded, notifying requesters.";
+ qCDebug(KGET_DEBUG) << "Key downloaded, notifying requesters.";
QList<Signature*> sigs = m_downloading.values(fingerprint);
foreach (Signature *sig, sigs) {
@@ -178,7 +179,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
m_downloading.remove(fingerprint);
#else //HAVE_QGPGME
Q_UNUSED(job)
- kWarning(5001) << "No QGPGME support.";
+ qCWarning(KGET_DEBUG) << "No QGPGME support.";
#endif //HAVE_QGPGME
}
diff --git a/core/kget.cpp b/core/kget.cpp
index af91471..cd16bcf 100644
--- a/core/kget.cpp
+++ b/core/kget.cpp
@@ -28,6 +28,10 @@
#include "core/transfergroupscheduler.h"
#include "settings.h"
#include "core/transferhistorystore.h"
+
+#include "kget_debug.h"
+#include <qdebug.h>
+
#include <iostream>
#include <kinputdialog.h>
#include <kfiledialog.h>
@@ -97,7 +101,7 @@ KGet* KGet::self( MainWindow * mainWindow )
bool KGet::addGroup(const QString& groupName)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
// Check if a group with that name already exists
if (m_transferTreeModel->findGroup(groupName))
@@ -178,7 +182,7 @@ TransferHandler * KGet::addTransfer(QUrl srcUrl, QString destDir, QString sugges
{
srcUrl = mostLocalUrl(srcUrl);
// Note: destDir may actually be a full path to a file :-(
- kDebug(5001) << "Source:" << srcUrl.url() << ", dest: " << destDir << ", sugg file: " << suggestedFileName << endl;
+ qCDebug(KGET_DEBUG) << "Source:" << srcUrl.url() << ", dest: " << destDir << ", sugg file: " << suggestedFileName << endl;
QUrl destUrl; // the final destination, including filename
@@ -268,7 +272,7 @@ QList<TransferHandler*> KGet::addTransfers(const QList<QDomElement> &elements, c
QUrl destUrl = QUrl(e.attribute("Dest"));
data << TransferData(srcUrl, destUrl, groupName, false, &e);
- kDebug(5001) << "src=" << srcUrl << " dest=" << destUrl << " group=" << groupName;
+ qCDebug(KGET_DEBUG) << "src=" << srcUrl << " dest=" << destUrl << " group=" << groupName;
}
return createTransfers(data);
@@ -411,7 +415,7 @@ void KGet::redownloadTransfer(TransferHandler * transfer)
QList<TransferHandler *> KGet::selectedTransfers()
{
-// kDebug(5001) << "KGet::selectedTransfers";
+// qCDebug(KGET_DEBUG) << "KGet::selectedTransfers";
QList<TransferHandler *> selectedTransfers;
@@ -503,7 +507,7 @@ NepomukController *KGet::nepomukController()
void KGet::load( QString filename ) // krazy:exclude=passbyvalue
{
- kDebug(5001) << "(" << filename << ")";
+ qCDebug(KGET_DEBUG) << "(" << filename << ")";
if(filename.isEmpty())
filename = KStandardDirs::locateLocal("appdata", "transfers.kgt");
@@ -520,7 +524,7 @@ void KGet::load( QString filename ) // krazy:exclude=passbyvalue
QFile file(tmpFile);
QDomDocument doc;
- kDebug(5001) << "file:" << filename;
+ qCDebug(KGET_DEBUG) << "file:" << filename;
if(doc.setContent(&file))
{
@@ -533,11 +537,11 @@ void KGet::load( QString filename ) // krazy:exclude=passbyvalue
{
TransferGroup * foundGroup = m_transferTreeModel->findGroup( nodeList.item(i).toElement().attribute("Name") );
- kDebug(5001) << "KGet::load -> group = " << nodeList.item(i).toElement().attribute("Name");
+ qCDebug(KGET_DEBUG) << "KGet::load -> group = " << nodeList.item(i).toElement().attribute("Name");
if( !foundGroup )
{
- kDebug(5001) << "KGet::load -> group not found";
+ qCDebug(KGET_DEBUG) << "KGet::load -> group not found";
TransferGroup * newGroup = new TransferGroup(m_transferTreeModel, m_scheduler);
@@ -547,7 +551,7 @@ void KGet::load( QString filename ) // krazy:exclude=passbyvalue
}
else
{
- kDebug(5001) << "KGet::load -> group found";
+ qCDebug(KGET_DEBUG) << "KGet::load -> group found";
//A group with this name already exists.
//Integrate the group's transfers with the ones read from file
@@ -557,7 +561,7 @@ void KGet::load( QString filename ) // krazy:exclude=passbyvalue
}
else
{
- kWarning(5001) << "Error reading the transfers file";
+ qCWarning(KGET_DEBUG) << "Error reading the transfers file";
}
if (m_transferTreeModel->transferGroups().isEmpty()) //Create the default group
@@ -583,7 +587,7 @@ void KGet::save( QString filename, bool plain ) // krazy:exclude=passbyvalue
KSaveFile file(filename);
if ( !file.open( QIODevice::WriteOnly ) )
{
- //kWarning(5001)<<"Unable to open output file when saving";
+ //qCWarning(KGET_DEBUG)<<"Unable to open output file when saving";
KGet::showNotification(m_mainWindow, "error",
i18n("Unable to save to: %1", filename));
return;
@@ -695,7 +699,7 @@ TransferGroupHandler * KGet::findGroup(const QString &name)
void KGet::checkSystemTray()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
bool running = false;
foreach (TransferHandler *handler, KGet::allTransfers())
@@ -712,7 +716,7 @@ void KGet::checkSystemTray()
void KGet::settingsChanged()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
foreach (TransferFactory *factory, m_transferFactories)
{
@@ -867,19 +871,19 @@ QList<TransferHandler*> KGet::createTransfers(const QList<TransferData> &dataIte
QStringList urlsFailed;
foreach (const TransferData &data, dataItems) {
- kDebug(5001) << "srcUrl=" << data.src << " destUrl=" << data.dest << " group=" << data.groupName;
+ qCDebug(KGET_DEBUG) << "srcUrl=" << data.src << " destUrl=" << data.dest << " group=" << data.groupName;
TransferGroup *group = m_transferTreeModel->findGroup(data.groupName);
if (!group) {
- kDebug(5001) << "KGet::createTransfer -> group not found";
+ qCDebug(KGET_DEBUG) << "KGet::createTransfer -> group not found";
group = m_transferTreeModel->transferGroups().first();
}
Transfer *newTransfer = 0;
foreach (TransferFactory *factory, m_transferFactories) {
- kDebug(5001) << "Trying plugin n.plugins=" << m_transferFactories.size() << factory->displayName();
+ qCDebug(KGET_DEBUG) << "Trying plugin n.plugins=" << m_transferFactories.size() << factory->displayName();
if ((newTransfer = factory->createTransfer(data.src, data.dest, group, m_scheduler, data.e))) {
- // kDebug(5001) << "KGet::createTransfer -> CREATING NEW TRANSFER ON GROUP: _" << group->name() << "_";
+ // qCDebug(KGET_DEBUG) << "KGet::createTransfer -> CREATING NEW TRANSFER ON GROUP: _" << group->name() << "_";
newTransfer->create();
newTransfer->load(data.e);
handlers << newTransfer->handler();
@@ -890,7 +894,7 @@ QList<TransferHandler*> KGet::createTransfers(const QList<TransferData> &dataIte
}
if (!newTransfer) {
urlsFailed << data.src.url();
- kWarning(5001) << "Warning! No plugin found to handle" << data.src;
+ qCWarning(KGET_DEBUG) << "Warning! No plugin found to handle" << data.src;
}
}
@@ -926,7 +930,7 @@ QList<TransferHandler*> KGet::createTransfers(const QList<TransferData> &dataIte
TransferDataSource * KGet::createTransferDataSource(const QUrl &src, const QDomElement &type, QObject *parent)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
TransferDataSource *dataSource;
foreach (TransferFactory *factory, m_transferFactories)
@@ -1061,7 +1065,7 @@ bool KGet::isValidSource(const QUrl &source)
bool KGet::isValidDestDirectory(const QString & destDir)
{
- kDebug(5001) << destDir;
+ qCDebug(KGET_DEBUG) << destDir;
if (!QFileInfo(destDir).isDir())
{
if (QFileInfo(QUrl(destDir).adjusted(QUrl::RemoveFilename).toString()).isWritable())
@@ -1164,7 +1168,7 @@ void KGet::loadPlugins()
for ( int i = 0; i < offers.count(); ++i )
{
services[ offers[i]->property( "X-KDE-KGet-rank" ).toInt() ] = offers[i];
- kDebug(5001) << " TransferFactory plugin found:" << endl <<
+ qCDebug(KGET_DEBUG) << " TransferFactory plugin found:" << endl <<
" rank = " << offers[i]->property( "X-KDE-KGet-rank" ).toInt() << endl <<
" plugintype = " << offers[i]->property( "X-KDE-KGet-plugintype" ) << endl;
}
@@ -1182,7 +1186,7 @@ void KGet::loadPlugins()
info.load(plugins);
if( !info.isPluginEnabled() ) {
- kDebug(5001) << "TransferFactory plugin (" << service->library()
+ qCDebug(KGET_DEBUG) << "TransferFactory plugin (" << service->library()
<< ") found, but not enabled";
continue;
}
@@ -1193,12 +1197,12 @@ void KGet::loadPlugins()
const QString pluginName = info.name();
pluginList.prepend(plugin);
- kDebug(5001) << "TransferFactory plugin (" << (service)->library()
+ qCDebug(KGET_DEBUG) << "TransferFactory plugin (" << (service)->library()
<< ") found and added to the list of available plugins";
}
else
{
- kDebug(5001) << "Error loading TransferFactory plugin ("
+ qCDebug(KGET_DEBUG) << "Error loading TransferFactory plugin ("
<< service->library() << ")";
}
}
@@ -1208,13 +1212,13 @@ void KGet::loadPlugins()
m_transferFactories.append(qobject_cast<TransferFactory *>(plugin));
}
- kDebug(5001) << "Number of factories = " << m_transferFactories.size();
+ qCDebug(KGET_DEBUG) << "Number of factories = " << m_transferFactories.size();
}
void KGet::setHasNetworkConnection(bool hasConnection)
{
- kDebug(5001) << "Existing internet connection:" << hasConnection << "old:" << m_hasConnection;
+ qCDebug(KGET_DEBUG) << "Existing internet connection:" << hasConnection << "old:" << m_hasConnection;
if (hasConnection == m_hasConnection) {
return;
}
@@ -1247,7 +1251,7 @@ KGetPlugin * KGet::createPluginFromService( const KService::Ptr &service )
KGet::showNotification(m_mainWindow, "error",
i18n("Plugin loader could not load the plugin: %1.", service->library()),
"dialog-info");
- kError(5001) << "KPluginFactory could not load the plugin:" << service->library();
+ qCCritical(KGET_DEBUG) << "KPluginFactory could not load the plugin:" << service->library();
return 0;
}
KGetPlugin * plugin = factory->create< TransferFactory >(KGet::m_mainWindow);
@@ -1433,7 +1437,7 @@ void GenericObserver::transfersChangedEvent(QMap<TransferHandler*, Transfer::Cha
//case if checkSysTray is set to true)
if (checkSysTray && Settings::afterFinishActionEnabled() && allFinished)
{
- kDebug(5001) << "All finished";
+ qCDebug(KGET_DEBUG) << "All finished";
KNotification *notification = 0;
if (!m_finishAction) {
@@ -1552,11 +1556,11 @@ bool GenericObserver::allTransfersFinished()
void GenericObserver::slotAfterFinishAction()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
switch (Settings::afterFinishAction()) {
case KGet::Quit:
- kDebug(5001) << "Quit Kget.";
+ qCDebug(KGET_DEBUG) << "Quit Kget.";
QTimer::singleShot(0, KGet::m_mainWindow, SLOT(slotQuit()));
break;
#ifdef HAVE_KWORKSPACE
@@ -1592,7 +1596,7 @@ void GenericObserver::slotAfterFinishAction()
void GenericObserver::slotAbortAfterFinishAction()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
m_finishAction->stop();
}
diff --git a/core/kgetglobaljob.cpp b/core/kgetglobaljob.cpp
index eb0431d..ebf457d 100644
--- a/core/kgetglobaljob.cpp
+++ b/core/kgetglobaljob.cpp
@@ -12,6 +12,8 @@
#include "transferhandler.h"
#include "kget.h"
+#include "kget_debug.h"
+#include <qdebug.h>
#include <klocale.h>
#include <kuiserverjobtracker.h>
@@ -44,7 +46,7 @@ void KGetGlobalJob::update()
}
}
-// kDebug(5001) << totalAmount;
+// qCDebug(KGET_DEBUG) << totalAmount;
if (totalAmount > 0)
percent = 100 * processedAmount / totalAmount;
@@ -63,7 +65,7 @@ void KGetGlobalJob::update()
bool KGetGlobalJob::doKill()
{
- kDebug(5001) << "Kill of global job called:" << this;
+ qCDebug(KGET_DEBUG) << "Kill of global job called:" << this;
emit requestStop(this, 0);
return KJob::doKill();
}
diff --git a/core/kgetkjobadapter.cpp b/core/kgetkjobadapter.cpp
index 360e567..377534e 100644
--- a/core/kgetkjobadapter.cpp
+++ b/core/kgetkjobadapter.cpp
@@ -10,6 +10,8 @@
*/
#include "kgetkjobadapter.h"
+#include "kget_debug.h"
+#include <qdebug.h>
#include <KLocale>
KGetKJobAdapter::KGetKJobAdapter(QObject *parent, TransferHandler *transfer)
@@ -54,7 +56,7 @@ void KGetKJobAdapter::slotUpdateDescription()
bool KGetKJobAdapter::doKill()
{
- kDebug(5001) << "Kill of job adapter called:" << this << m_transferHandler->dest();
+ qCDebug(KGET_DEBUG) << "Kill of job adapter called:" << this << m_transferHandler->dest();
emit requestStop(this, m_transferHandler);
return KJob::doKill();
}
diff --git a/core/kuiserverjobs.cpp b/core/kuiserverjobs.cpp
index 0fd5e97..e758775 100644
--- a/core/kuiserverjobs.cpp
+++ b/core/kuiserverjobs.cpp
@@ -18,8 +18,9 @@
#include "settings.h"
#include "kget.h"
+#include "kget_debug.h"
+#include <qdebug.h>
#include <kuiserverjobtracker.h>
-#include <kdebug.h>
KUiServerJobs::KUiServerJobs(QObject *parent)
: QObject(parent), m_globalJob(0)
@@ -55,7 +56,7 @@ void KUiServerJobs::settingsChanged()
void KUiServerJobs::slotTransfersAdded(QList<TransferHandler*> transfers)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
foreach (TransferHandler *transfer, transfers) {
if(shouldBeShown(transfer))
@@ -72,7 +73,7 @@ void KUiServerJobs::slotTransfersAdded(QList<TransferHandler*> transfers)
void KUiServerJobs::slotTransfersAboutToBeRemoved(const QList<TransferHandler*> &transfers)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
m_invalidTransfers << transfers;
foreach (TransferHandler *transfer, transfers) {
@@ -89,7 +90,7 @@ void KUiServerJobs::slotTransfersAboutToBeRemoved(const QList<TransferHandler*>
void KUiServerJobs::slotTransfersChanged(QMap<TransferHandler *, Transfer::ChangesFlags> transfers)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if(!Settings::enableKUIServerIntegration())
return;
diff --git a/core/mostlocalurl.cpp b/core/mostlocalurl.cpp
index b35b01f..057d5ad 100644
--- a/core/mostlocalurl.cpp
+++ b/core/mostlocalurl.cpp
@@ -21,12 +21,13 @@
#include "kget.h"
#include "plugin/transferfactory.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <KIO/NetAccess>
QUrl mostLocalUrl(const QUrl &url)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
const QString protocol = url.scheme();
foreach (TransferFactory *factory, KGet::factories()) {
if (factory->addsProtocols().contains(protocol)) {
@@ -34,7 +35,7 @@ QUrl mostLocalUrl(const QUrl &url)
}
}
- kDebug(5001) << "Starting KIO::NetAccess::mostLocalUrl for:" << url;
+ qCDebug(KGET_DEBUG) << "Starting KIO::NetAccess::mostLocalUrl for:" << url;
return KIO::NetAccess::mostLocalUrl(url, 0);
}
@@ -71,7 +72,7 @@ void MostLocalUrlJob::start()
}
if (startJob) {
- kDebug(5001) << "Starting KIO::mostLocalUrl for:" << m_url;
+ qCDebug(KGET_DEBUG) << "Starting KIO::mostLocalUrl for:" << m_url;
KIO::Job *job = KIO::mostLocalUrl(m_url, KIO::HideProgressInfo);
addSubjob(job);
} else {
@@ -83,11 +84,11 @@ void MostLocalUrlJob::start()
void MostLocalUrlJob::slotResult(KJob* job)
{
if (job->error()) {
- kWarning(5001) << "Error" << job->error() << "happened for:" << m_url;
+ qCWarning(KGET_DEBUG) << "Error" << job->error() << "happened for:" << m_url;
m_mostLocalUrl = m_url;
} else {
m_mostLocalUrl = static_cast<KIO::StatJob*>(job)->mostLocalUrl();
}
- kDebug(5001) << "Setting mostLocalUrl to" << m_mostLocalUrl;
+ qCDebug(KGET_DEBUG) << "Setting mostLocalUrl to" << m_mostLocalUrl;
emitResult();
}
diff --git a/core/scheduler.cpp b/core/scheduler.cpp
index 0a48990..ae17ddd 100644
--- a/core/scheduler.cpp
+++ b/core/scheduler.cpp
@@ -17,7 +17,8 @@
#include <algorithm>
#include <boost/bind.hpp>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
Scheduler::Scheduler(QObject * parent)
: QObject(parent),
@@ -169,7 +170,7 @@ void Scheduler::jobQueueRemovedJobsEvent(JobQueue *queue, const QList<Job*> jobs
void Scheduler::jobChangedEvent(Job * job, Job::Status status)
{
- kDebug(5001) << "Scheduler::jobChangedEvent (job=" << job << " status=" << status << ")";
+ qCDebug(KGET_DEBUG) << "Scheduler::jobChangedEvent (job=" << job << " status=" << status << ")";
if (!m_failureCheckTimer)
m_failureCheckTimer = startTimer(1000);
@@ -190,25 +191,25 @@ void Scheduler::jobChangedEvent(Job * job, JobFailure failure)
switch(failure.status)
{
case None:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = None ";
+ qCDebug(KGET_DEBUG) << "job = " << job << " failure (#" << failure.count << ") = None ";
break;
case AboutToStall:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = AboutToStall ";
+ qCDebug(KGET_DEBUG) << "job = " << job << " failure (#" << failure.count << ") = AboutToStall ";
break;
case Stall:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = Stall ";
+ qCDebug(KGET_DEBUG) << "job = " << job << " failure (#" << failure.count << ") = Stall ";
break;
case StallTimeout:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = StallTimeout ";
+ qCDebug(KGET_DEBUG) << "job = " << job << " failure (#" << failure.count << ") = StallTimeout ";
break;
case Abort:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = Abort ";
+ qCDebug(KGET_DEBUG) << "job = " << job << " failure (#" << failure.count << ") = Abort ";
break;
case AbortTimeout:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = AbortTimeout ";
+ qCDebug(KGET_DEBUG) << "job = " << job << " failure (#" << failure.count << ") = AbortTimeout ";
break;
case Error:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = Error ";
+ qCDebug(KGET_DEBUG) << "job = " << job << " failure (#" << failure.count << ") = Error ";
break;
}
@@ -276,8 +277,8 @@ void Scheduler::updateQueue( JobQueue * queue )
for( int job=0 ; it!=itEnd ; ++it, ++job)
{
- //kDebug(5001) << "MaxSimJobs " << queue->maxSimultaneousJobs();
- kDebug(5001) << "Scheduler: Evaluating job " << job;
+ //qCDebug(KGET_DEBUG) << "MaxSimJobs " << queue->maxSimultaneousJobs();
+ qCDebug(KGET_DEBUG) << "Scheduler: Evaluating job " << job;
JobFailure failure = m_failedJobs.value(*it);
@@ -287,7 +288,7 @@ void Scheduler::updateQueue( JobQueue * queue )
{
if( !shouldBeRunning(*it) )
{
- kDebug(5001) << "Scheduler: stopping job";
+ qCDebug(KGET_DEBUG) << "Scheduler: stopping job";
(*it)->stop();
}
else if(failure.status == None || failure.status == AboutToStall)
@@ -299,7 +300,7 @@ void Scheduler::updateQueue( JobQueue * queue )
{
if( shouldBeRunning(*it) )
{
- kDebug(5001) << "Scheduler: starting job";
+ qCDebug(KGET_DEBUG) << "Scheduler: starting job";
(*it)->start();
if((failure.status == None || failure.status == AboutToStall) && (*it)->status() != Job::FinishedKeepAlive)
runningJobs++;
@@ -311,7 +312,7 @@ void Scheduler::updateQueue( JobQueue * queue )
else
{
//Stop all the other running downloads
- kDebug(5001) << "Scheduler: stopping job over maxSimJobs limit";
+ qCDebug(KGET_DEBUG) << "Scheduler: stopping job over maxSimJobs limit";
(*it)->stop();
}
}
@@ -348,7 +349,7 @@ bool Scheduler::shouldBeRunning( Job * job )
void Scheduler::timerEvent( QTimerEvent * event )
{
Q_UNUSED(event)
-// kDebug(5001);
+// qCDebug(KGET_DEBUG);
if (!shouldUpdate()) {
return;
@@ -429,7 +430,7 @@ void Scheduler::timerEvent( QTimerEvent * event )
m_failedJobs.remove(*it);
// if(failure.isValid() || prevFailure.isValid())
-// kDebug(5001) << "failure = " << failure.status << " T=" << failure.time << " prevFailure = " << prevFailure.status;
+// qCDebug(KGET_DEBUG) << "failure = " << failure.status << " T=" << failure.time << " prevFailure = " << prevFailure.status;
if(failure.status != prevFailure.status)
jobChangedEvent(*it, failure); // Notify the scheduler
diff --git a/core/signature.cpp b/core/signature.cpp
index a86b099..69f17ce 100644
--- a/core/signature.cpp
+++ b/core/signature.cpp
@@ -21,7 +21,8 @@
#include "keydownloader.h"
#include "settings.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <KLocale>
#include <KMessageBox>
@@ -56,7 +57,7 @@ SignaturePrivate::~SignaturePrivate()
void SignaturePrivate::signatureDownloaded()
{
if (verifyTried) {
- kDebug(5001) << "Rerun verification.";
+ qCDebug(KGET_DEBUG) << "Rerun verification.";
q->verify();
}
}
@@ -72,13 +73,13 @@ GpgME::VerificationResult SignaturePrivate::verify(const KUrl &dest, const QByte
GpgME::initializeLibrary();
GpgME::Error error = GpgME::checkEngine(GpgME::OpenPGP);
if (error) {
- kDebug(5001) << "OpenPGP not supported!";
+ qCDebug(KGET_DEBUG) << "OpenPGP not supported!";
return result;
}
QScopedPointer<GpgME::Context> context(GpgME::Context::createForProtocol(GpgME::OpenPGP));
if (!context.data()) {
- kDebug(5001) << "Could not create context.";
+ qCDebug(KGET_DEBUG) << "Could not create context.";
return result;
}
@@ -177,7 +178,7 @@ QString Signature::fingerprint()
void Signature::downloadKey(QString fingerprint) // krazy:exclude=passbyvalue
{
#ifdef HAVE_QGPGME
- kDebug(5001) << "Downloading key:" << fingerprint;
+ qCDebug(KGET_DEBUG) << "Downloading key:" << fingerprint;
signatureDownloader->downloadKey(fingerprint, this);
#else
Q_UNUSED(fingerprint)
@@ -207,7 +208,7 @@ void Signature::slotVerified(const GpgME::VerificationResult &result)
d->status = Signature::NotWorked;
if (!d->verificationResult.numSignatures()) {
- kDebug(5001) << "No signatures\n";
+ qCDebug(KGET_DEBUG) << "No signatures\n";
emit verified(d->status);
return;
}
@@ -217,12 +218,12 @@ void Signature::slotVerified(const GpgME::VerificationResult &result)
d->error = signature.status().code();
d->fingerprint = signature.fingerprint();
- kDebug(5001) << "Fingerprint:" << d->fingerprint;
- kDebug(5001) << "Signature summary:" << d->sigSummary;
- kDebug(5001) << "Error code:" << d->error;
+ qCDebug(KGET_DEBUG) << "Fingerprint:" << d->fingerprint;
+ qCDebug(KGET_DEBUG) << "Signature summary:" << d->sigSummary;
+ qCDebug(KGET_DEBUG) << "Error code:" << d->error;
if (d->sigSummary & GpgME::Signature::KeyMissing) {
- kDebug(5001) << "Public key missing.";
+ qCDebug(KGET_DEBUG) << "Public key missing.";
if (Settings::signatureAutomaticDownloading() ||
(KMessageBox::warningYesNoCancel(0,
i18n("The key to verify the signature is missing, do you want to download it?")) == KMessageBox::Yes)) {
diff --git a/core/signaturethread.cpp b/core/signaturethread.cpp
index a152231..93b085f 100644
--- a/core/signaturethread.cpp
+++ b/core/signaturethread.cpp
@@ -20,7 +20,8 @@
#include "signaturethread.h"
#include "signature_p.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
SignatureThread::SignatureThread(QObject *parent)
: QThread(parent),
@@ -73,6 +74,6 @@ void SignatureThread::run()
}
}
#else //HAVE_QGPGME
- kWarning(5001) << "No QGPGME support.";
+ qCWarning(KGET_DEBUG) << "No QGPGME support.";
#endif //HAVE_QGPGME
}
diff --git a/core/transferdatasource.cpp b/core/transferdatasource.cpp
index 4fef2e4..f745df0 100644
--- a/core/transferdatasource.cpp
+++ b/core/transferdatasource.cpp
@@ -10,7 +10,8 @@
#include "transferdatasource.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
TransferDataSource::TransferDataSource(const QUrl &srcUrl, QObject *parent)
: QObject(parent),
@@ -21,12 +22,12 @@ TransferDataSource::TransferDataSource(const QUrl &srcUrl, QObject *parent)
m_currentSegments(0),
m_capabilities(0)
{
- kDebug(5001) ;
+ qCDebug(KGET_DEBUG) ;
}
TransferDataSource::~TransferDataSource()
{
- kDebug(5001) ;
+ qCDebug(KGET_DEBUG) ;
}
Transfer::Capabilities TransferDataSource::capabilities() const
diff --git a/core/transfergroup.cpp b/core/transfergroup.cpp
index 2bc9081..e6deaae 100644
--- a/core/transfergroup.cpp
+++ b/core/transfergroup.cpp
@@ -14,7 +14,8 @@
#include "core/transfergrouphandler.h"
#include "core/kget.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <kio/global.h>
#include <QDomElement>
@@ -225,14 +226,14 @@ int TransferGroup::downloadLimit(Transfer::SpeedLimit limit) const
void TransferGroup::calculateSpeedLimits()
{
- kDebug(5001) << "We will calculate the new SpeedLimits now";
+ qCDebug(KGET_DEBUG) << "We will calculate the new SpeedLimits now";
calculateDownloadLimit();
calculateUploadLimit();
}
void TransferGroup::calculateDownloadLimit()
{
- kDebug(5001) << "Calculate new DownloadLimit of " + QString::number(m_downloadLimit);
+ qCDebug(KGET_DEBUG) << "Calculate new DownloadLimit of " + QString::number(m_downloadLimit);
if (supportsSpeedLimits())
{
const QList<Job*> running = runningJobs();
@@ -275,7 +276,7 @@ void TransferGroup::calculateDownloadLimit()
void TransferGroup::calculateUploadLimit()
{
- kDebug(5001) << "Calculate new Upload Limit of " + QString::number(m_uploadLimit);
+ qCDebug(KGET_DEBUG) << "Calculate new Upload Limit of " + QString::number(m_uploadLimit);
if (supportsSpeedLimits())
{
const QList<Job*> running = runningJobs();
@@ -318,7 +319,7 @@ void TransferGroup::calculateUploadLimit()
void TransferGroup::save(QDomElement e) // krazy:exclude=passbyvalue
{
- //kDebug(5001) << " --> " << name();
+ //qCDebug(KGET_DEBUG) << " --> " << name();
e.setAttribute("Name", m_name);
e.setAttribute("DefaultFolder", m_defaultFolder);
@@ -346,7 +347,7 @@ void TransferGroup::save(QDomElement e) // krazy:exclude=passbyvalue
for( ; it!=itEnd; ++it )
{
Transfer* transfer = static_cast<Transfer*>(*it);
- kDebug(5001) << " --> " << name() << " transfer: " << transfer->source();
+ qCDebug(KGET_DEBUG) << " --> " << name() << " transfer: " << transfer->source();
QDomElement t = e.ownerDocument().createElement("Transfer");
e.appendChild(t);
transfer->save(t);
@@ -355,7 +356,7 @@ void TransferGroup::save(QDomElement e) // krazy:exclude=passbyvalue
void TransferGroup::load(const QDomElement & e)
{
- kDebug(5001) << "TransferGroup::load";
+ qCDebug(KGET_DEBUG) << "TransferGroup::load";
m_name = e.attribute("Name");
m_defaultFolder = e.attribute("DefaultFolder");
@@ -391,6 +392,6 @@ void TransferGroup::load(const QDomElement & e)
elements << nodeList.item(i).toElement();
}
- kDebug(5001) << "TransferGroup::load ->" << "add" << nItems << "transfers";
+ qCDebug(KGET_DEBUG) << "TransferGroup::load ->" << "add" << nItems << "transfers";
KGet::addTransfers(elements, name());
}
diff --git a/core/transfergrouphandler.cpp b/core/transfergrouphandler.cpp
index 878b45e..be08136 100644
--- a/core/transfergrouphandler.cpp
+++ b/core/transfergrouphandler.cpp
@@ -17,7 +17,8 @@
#include "core/transfer.h"
#include "core/kget.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QAction>
#include <kactioncollection.h>
#include <klocale.h>
@@ -36,13 +37,13 @@ TransferGroupHandler::~TransferGroupHandler()
void TransferGroupHandler::start()
{
- kDebug(5001) << "TransferGroupHandler::start()";
+ qCDebug(KGET_DEBUG) << "TransferGroupHandler::start()";
m_group->setStatus( JobQueue::Running );
}
void TransferGroupHandler::stop()
{
- kDebug(5001) << "TransferGroupHandler::stop()";
+ qCDebug(KGET_DEBUG) << "TransferGroupHandler::stop()";
m_group->setStatus( JobQueue::Stopped );
}
@@ -69,7 +70,7 @@ void TransferGroupHandler::move(QList<TransferHandler *> transfers, TransferHand
TransferHandler * TransferGroupHandler::operator[] (int i)
{
-// kDebug(5001) << "TransferGroupHandler::operator[" << i << "]";
+// qCDebug(KGET_DEBUG) << "TransferGroupHandler::operator[" << i << "]";
return (*m_group)[i]->handler();
}
@@ -81,7 +82,7 @@ void TransferGroupHandler::setName(const QString &name)
QVariant TransferGroupHandler::data(int column)
{
-// kDebug(5001) << "TransferGroupHandler::data(" << column << ")";
+// qCDebug(KGET_DEBUG) << "TransferGroupHandler::data(" << column << ")";
switch(column)
{
diff --git a/core/transfergroupscheduler.cpp b/core/transfergroupscheduler.cpp
index a695198..f89381d 100644
--- a/core/transfergroupscheduler.cpp
+++ b/core/transfergroupscheduler.cpp
@@ -13,6 +13,9 @@
#include "transfergrouphandler.h"
#include "settings.h"
+#include "kget_debug.h"
+#include <qdebug.h>
+
TransferGroupScheduler::TransferGroupScheduler(QObject *parent)
: Scheduler(parent),
m_downloadLimit(0),
@@ -74,7 +77,7 @@ void TransferGroupScheduler::calculateDownloadLimit()
void TransferGroupScheduler::calculateUploadLimit()
{
int n = KGet::allTransferGroups().count();
- kDebug(5001) << n;
+ qCDebug(KGET_DEBUG) << n;
int pool = 0;//We create a pool where we have some KiB/s to go to other groups...
QList<TransferGroupHandler*> transfergroupsNeedSpeed;
foreach (TransferGroupHandler *handler, KGet::allTransferGroups())
diff --git a/core/transferhandler.cpp b/core/transferhandler.cpp
index 5efb8bc..ed98cb4 100644
--- a/core/transferhandler.cpp
+++ b/core/transferhandler.cpp
@@ -20,7 +20,8 @@
#include "mainwindow.h"
#include "kgetkjobadapter.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <klocale.h>
#include <QAction>
#include <QVariant>
@@ -119,7 +120,7 @@ int TransferHandler::uploadSpeed() const
QVariant TransferHandler::data(int column)
{
-// kDebug(5001) << "TransferHandler::data(" << column << ")";
+// qCDebug(KGET_DEBUG) << "TransferHandler::data(" << column << ")";
switch(column)
{
@@ -183,9 +184,9 @@ void TransferHandler::resetChangesFlags()
void TransferHandler::destroy()
{
- kDebug(5001) << "TransferHandler::destroy() ENTERING";
+ qCDebug(KGET_DEBUG) << "TransferHandler::destroy() ENTERING";
- kDebug(5001) << "TransferHandler::destroy() LEAVING";
+ qCDebug(KGET_DEBUG) << "TransferHandler::destroy() LEAVING";
}
void TransferHandler::setTransferChange(ChangesFlags change, bool notifyModel)
diff --git a/core/transferhistorystore_sqlite.cpp b/core/transferhistorystore_sqlite.cpp
index 1a09e2f..25bad91 100644
--- a/core/transferhistorystore_sqlite.cpp
+++ b/core/transferhistorystore_sqlite.cpp
@@ -18,7 +18,8 @@
#include <QFile>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
SQLiteStore::SQLiteStore(const QString &database) : TransferHistoryStore(),
m_dbName(database),
@@ -44,7 +45,7 @@ void SQLiteStore::load()
QSqlQuery query = sql().exec("SELECT * FROM transfer_history_item");
if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
+ qCDebug(KGET_DEBUG) << query.lastError().text();
}
else {
QSqlRecord rec = query.record();
@@ -86,7 +87,7 @@ void SQLiteStore::saveItems(const QList<TransferHistoryItem> &items)
}
if (!sql().transaction()) {
- kWarning(5001) << "Could not establish a transaction, might be slow.";
+ qCWarning(KGET_DEBUG) << "Could not establish a transaction, might be slow.";
}
foreach (const TransferHistoryItem &item, items) {
@@ -97,13 +98,13 @@ void SQLiteStore::saveItems(const QList<TransferHistoryItem> &items)
+ QString::number(item.state())+"')");
if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
+ qCDebug(KGET_DEBUG) << query.lastError().text();
}
m_items << item;
}
if (!sql().commit()) {
- kWarning(5001) << "Could not commit changes.";
+ qCWarning(KGET_DEBUG) << "Could not commit changes.";
}
}
sql().close();
@@ -122,7 +123,7 @@ void SQLiteStore::deleteItem(const TransferHistoryItem &item)
" source = '" + item.source() + "';");
if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
+ qCDebug(KGET_DEBUG) << query.lastError().text();
}
sql().commit();
@@ -150,7 +151,7 @@ void SQLiteStore::createTables()
"state int, PRIMARY KEY(dest, source));");
if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
+ qCDebug(KGET_DEBUG) << query.lastError().text();
}
}
diff --git a/core/transferhistorystore_xml.cpp b/core/transferhistorystore_xml.cpp
index d3adce2..f94b8da 100644
--- a/core/transferhistorystore_xml.cpp
+++ b/core/transferhistorystore_xml.cpp
@@ -14,7 +14,8 @@
#include <QFile>
#include <QTextStream>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
XmlStore::SaveThread::SaveThread(QObject *parent, const QString &url, const QList<TransferHistoryItem> &list) : QThread(parent),
m_url(url),
@@ -86,7 +87,7 @@ void XmlStore::DeleteThread::run()
if (!doc.setContent(&file, &error, &line, &column))
{
- kDebug(5001) << "Error1" << error << line << column;
+ qCDebug(KGET_DEBUG) << "Error1" << error << line << column;
return;
}
file.close();
@@ -140,7 +141,7 @@ void XmlStore::LoadThread::run()
if (!doc.setContent(&file, &error, &line, &column))
{
- kDebug(5001) << "Error1" << error << line << column;
+ qCDebug(KGET_DEBUG) << "Error1" << error << line << column;
file.close();
return;
}
diff --git a/core/transfertreemodel.cpp b/core/transfertreemodel.cpp
index 6e79690..cdc8831 100644
--- a/core/transfertreemodel.cpp
+++ b/core/transfertreemodel.cpp
@@ -23,7 +23,8 @@
#include "settings.h"
#include "transfergroupscheduler.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <klocale.h>
#include <KMimeType>
@@ -524,7 +525,7 @@ void TransferTreeModel::postDataChangedEvent(TransferGroupHandler * group)
Qt::ItemFlags TransferTreeModel::flags (const QModelIndex & index) const
{
-// kDebug(5001) << "TransferTreeModel::flags()";
+// qCDebug(KGET_DEBUG) << "TransferTreeModel::flags()";
if (!index.isValid())
return Qt::ItemIsEnabled;
@@ -596,31 +597,31 @@ bool TransferTreeModel::dropMimeData(const QMimeData * mdata, Qt::DropAction act
const ItemMimeData *itemData = qobject_cast<const ItemMimeData*>(mdata);
if (!itemData) {
- kWarning(5001) << "Unsuported mime data dropped.";
+ qCWarning(KGET_DEBUG) << "Unsuported mime data dropped.";
return false;
}
TransferGroup *destGroup = findGroup(data(parent, Qt::DisplayRole).toString());
if (!destGroup) {
- kWarning(5001) << "No group could be found where the transfers should be inserted to.";
+ qCWarning(KGET_DEBUG) << "No group could be found where the transfers should be inserted to.";
return false;
}
if (parent.isValid())
- kDebug(5001) << "TransferTreeModel::dropMimeData" << " " << row << " "
+ qCDebug(KGET_DEBUG) << "TransferTreeModel::dropMimeData" << " " << row << " "
<< column << endl;
QList<QWeakPointer<TransferHandler> > transfers = itemData->transfers();
- kDebug(5001) << "TransferTreeModel::dropMimeData:" << transfers.count() << "transfers.";
+ qCDebug(KGET_DEBUG) << "TransferTreeModel::dropMimeData:" << transfers.count() << "transfers.";
const bool droppedInsideGroup = parent.isValid();
Transfer * after = 0;
for (int i = 0; i < transfers.count(); ++i) {
bool b = destGroup->size() > row && row - 1 >= 0;
if (b)
- kDebug(5001) << "TRANSFER AFTER:" << destGroup->operator[](row - 1)->source();
+ qCDebug(KGET_DEBUG) << "TRANSFER AFTER:" << destGroup->operator[](row - 1)->source();
else
- kDebug(5001) << "TRANSFER AFTER NOT EXISTING";
+ qCDebug(KGET_DEBUG) << "TRANSFER AFTER NOT EXISTING";
if (!after) {
bool rowValid = (row - 1 >= 0) && (destGroup->size() >= row);
@@ -700,7 +701,7 @@ int TransferTreeModel::column(TransferGroup::GroupChange flag)
void TransferTreeModel::timerEvent(QTimerEvent *event)
{
Q_UNUSED(event)
-// kDebug(5001) << "TransferTreeModel::timerEvent";
+// qCDebug(KGET_DEBUG) << "TransferTreeModel::timerEvent";
QMap<TransferHandler *, Transfer::ChangesFlags> updatedTransfers;
QMap<TransferGroupHandler *, TransferGroup::ChangesFlags> updatedGroups;
@@ -716,7 +717,7 @@ void TransferTreeModel::timerEvent(QTimerEvent *event)
int row = group->indexOf(transfer);
-// kDebug(5001) << "CHILD = " << item->child(row, column(Transfer::Tc_FileName));
+// qCDebug(KGET_DEBUG) << "CHILD = " << item->child(row, column(Transfer::Tc_FileName));
// Now, check that model child items already exist (there are some cases when the transfer
// can notify for changes before the gui has been correctly initialized)
diff --git a/core/urlchecker.cpp b/core/urlchecker.cpp
index b8f8ea6..0988603 100644
--- a/core/urlchecker.cpp
+++ b/core/urlchecker.cpp
@@ -31,6 +31,8 @@
#include <algorithm>
#include <boost/bind.hpp>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QFileInfo>
#include <QCheckBox>
#include <QHBoxLayout>
@@ -155,7 +157,7 @@ UrlChecker::UrlError UrlChecker::checkSource(const QUrl &src, bool showNotificat
}*/
if (showNotification && (error != NoError)) {
- kDebug(5001) << "Source:" << src << "has error:" << error;
+ qCDebug(KGET_DEBUG) << "Source:" << src << "has error:" << error;
KGet::showNotification(KGet::m_mainWindow, "error", message(src, Source, error));
}
@@ -185,7 +187,7 @@ UrlChecker::UrlError UrlChecker::checkDestination(const QUrl &destination, bool
}
}
- kDebug(5001) << "Destination:" << destination << "has error:" << error;
+ qCDebug(KGET_DEBUG) << "Destination:" << destination << "has error:" << error;
if (showNotification && (error != NoError)) {
KGet::showNotification(KGet::m_mainWindow, "error", message(destination, Destination, error));
@@ -218,7 +220,7 @@ UrlChecker::UrlError UrlChecker::checkFolder(const QUrl &folder, bool showNotifi
}
if (showNotification && (error != NoError)) {
- kDebug(5001) << "Folder:" << folder << "has error:" << error;
+ qCDebug(KGET_DEBUG) << "Folder:" << folder << "has error:" << error;
KGet::showNotification(KGet::m_mainWindow, "error", message(folder, Folder, error));
}
diff --git a/core/verificationmodel.cpp b/core/verificationmodel.cpp
index f154293..84eee81 100644
--- a/core/verificationmodel.cpp
+++ b/core/verificationmodel.cpp
@@ -22,7 +22,8 @@
#include <QStringList>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QIcon>
#include <KLocale>
@@ -179,7 +180,7 @@ bool VerificationModel::removeRows(int row, int count, const QModelIndex &parent
void VerificationModel::addChecksum(const QString &type, const QString &checksum, int verified)
{
if (!Verifier::isChecksum(type, checksum)) {
- kWarning(5001) << "Could not add checksum.\nType:" << type << "\nChecksum:" << checksum;
+ qCWarning(KGET_DEBUG) << "Could not add checksum.\nType:" << type << "\nChecksum:" << checksum;
return;
}
diff --git a/core/verificationthread.cpp b/core/verificationthread.cpp
index df254b9..feb203f 100644
--- a/core/verificationthread.cpp
+++ b/core/verificationthread.cpp
@@ -20,7 +20,8 @@
#include "verificationthread.h"
#include "verifier.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QFile>
@@ -112,7 +113,7 @@ void VerificationThread::doVerify()
}
const QString hash = Verifier::checksum(url, type, &m_abort);
- kDebug(5001) << "Type:" << type << "Calculated checksum:" << hash << "Entered checksum:" << checksum;
+ qCDebug(KGET_DEBUG) << "Type:" << type << "Calculated checksum:" << hash << "Entered checksum:" << checksum;
const bool fileVerified = (hash == checksum);
if (m_abort)
@@ -168,7 +169,7 @@ void VerificationThread::doBrokenPieces()
if (fileChecksums.size() != checksums.size())
{
- kDebug(5001) << "Number of checksums differs!";
+ qCDebug(KGET_DEBUG) << "Number of checksums differs!";
emit brokenPieces(broken, length);
return;
}
@@ -178,7 +179,7 @@ void VerificationThread::doBrokenPieces()
if (fileChecksums.at(i) != checksums.at(i))
{
const int brokenStart = length * i;
- kDebug(5001) << url << "broken segment" << i << "start" << brokenStart << "length" << length;
+ qCDebug(KGET_DEBUG) << url << "broken segment" << i << "start" << brokenStart << "length" << length;
broken.append(brokenStart);
}
}
diff --git a/core/verifier.cpp b/core/verifier.cpp
index 682fbb2..de74b12 100644
--- a/core/verifier.cpp
+++ b/core/verifier.cpp
@@ -26,7 +26,8 @@
#include <QFile>
#include <QDomElement>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#ifdef HAVE_QCA2
#endif
@@ -352,7 +353,7 @@ QPair<QString, PartialChecksums*> Verifier::availablePartialChecksum(Verifier::C
void Verifier::changeStatus(const QString &type, bool isVerified)
{
- kDebug(5001) << "Verified:" << isVerified;
+ qCDebug(KGET_DEBUG) << "Verified:" << isVerified;
d->status = isVerified ? Verifier::Verified : Verifier::NotVerified;
d->model->setVerificationStatus(type, d->status);
emit verified(isVerified);
diff --git a/dbus/dbuskgetwrapper.cpp b/dbus/dbuskgetwrapper.cpp
index 208ae34..69c1d24 100644
--- a/dbus/dbuskgetwrapper.cpp
+++ b/dbus/dbuskgetwrapper.cpp
@@ -32,7 +32,8 @@
#include "ui/linkview/kget_linkview.h"
#include "ui/newtransferdialog.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
DBusKGetWrapper::DBusKGetWrapper(MainWindow *parent)
: QObject(parent),
@@ -71,7 +72,7 @@ QStringList DBusKGetWrapper::addTransfer(const QString& src, const QString& dest
bool DBusKGetWrapper::delTransfer(const QString& dbusObjectPath)
{
- kDebug(5001) << "deleting Transfer";
+ qCDebug(KGET_DEBUG) << "deleting Transfer";
Transfer *transfer = KGet::model()->findTransferByDBusObjectPath(dbusObjectPath);
diff --git a/extensions/webinterface/httpserver.cpp b/extensions/webinterface/httpserver.cpp
index d8e638e..e14e4a5 100644
--- a/extensions/webinterface/httpserver.cpp
+++ b/extensions/webinterface/httpserver.cpp
@@ -125,7 +125,7 @@ void HttpServer::handleRequest()
}
data.append("]}");
} else if (header.path().startsWith(QLatin1String("/do"))) {
- kDebug(5001) << request;
+ qCDebug(KGET_DEBUG) << request;
QString args = header.path().right(header.path().length() - 4);
@@ -144,7 +144,7 @@ void HttpServer::handleRequest()
else if (map.at(0) == "group")
group = QUrl::fromPercentEncoding(QByteArray(map.at(1).toUtf8()));
}
- kDebug(5001) << action << data << group;
+ qCDebug(KGET_DEBUG) << action << data << group;
if (action == "add") {
//find a folder to store the download in
QString defaultFolder;
@@ -180,7 +180,7 @@ void HttpServer::handleRequest()
if (transfer)
KGet::delTransfer(transfer);
} else {
- kWarning(5001) << "not implemented action" << action << data;
+ qCWarning(KGET_DEBUG) << "not implemented action" << action << data;
}
}
} else { // read it from filesystem
diff --git a/kget_debug.cpp b/kget_debug.cpp
new file mode 100644
index 0000000..be9fb9a
--- /dev/null
+++ b/kget_debug.cpp
@@ -0,0 +1,23 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Laurent Montel <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kget_debug.h"
+Q_LOGGING_CATEGORY(KGET_DEBUG, "log_kget")
+
+
diff --git a/kget_debug.h b/kget_debug.h
new file mode 100644
index 0000000..bea5ab8
--- /dev/null
+++ b/kget_debug.h
@@ -0,0 +1,28 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Laurent Montel <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KGET_DEBUG_H
+#define KGET_DEBUG_H
+
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(KGET_DEBUG)
+
+#endif
+
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 43d9c26..df13583 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -38,6 +38,9 @@
#include "tests/testkget.h"
#endif
+#include "kget_debug.h"
+#include <qdebug.h>
+
#include <kapplication.h>
#include <kstandarddirs.h>
#include <KInputDialog>
@@ -540,7 +543,7 @@ void MainWindow::slotTransfersChanged(QMap<TransferHandler*, Transfer::ChangesFl
break;
}
-// kDebug(5001) << it.key() << ": " << it.value() << endl;
+// qCDebug(KGET_DEBUG) << it.key() << ": " << it.value() << endl;
}
if (update)
@@ -1107,7 +1110,7 @@ void MainWindow::slotShowMenubar()
void MainWindow::setSystemTrayDownloading(bool running)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (m_dock)
m_dock->setDownloading(running);
@@ -1121,7 +1124,7 @@ void MainWindow::slotTransferHistory()
void MainWindow::slotTransferGroupSettings()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
QList<TransferGroupHandler*> list = KGet::selectedTransferGroups();
foreach(TransferGroupHandler* group, list)
{
@@ -1133,7 +1136,7 @@ void MainWindow::slotTransferGroupSettings()
void MainWindow::slotTransferSettings()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
QList<TransferHandler*> list = KGet::selectedTransfers();
foreach(TransferHandler* transfer, list)
{
diff --git a/plasma/applet/common/kgetapplet.cpp b/plasma/applet/common/kgetapplet.cpp
index 67d6e48..4397432 100644
--- a/plasma/applet/common/kgetapplet.cpp
+++ b/plasma/applet/common/kgetapplet.cpp
@@ -146,7 +146,7 @@ void KGetApplet::init()
if (m_engine) {
m_engine->connectSource("KGet", this);
} else {
- kDebug(5001) << "KGet Engine could not be loaded";
+ qCDebug(KGET_DEBUG) << "KGet Engine could not be loaded";
}
m_globalProgress = new Plasma::Meter(this);
m_globalProgress->setMeterType(Plasma::Meter::BarMeterHorizontal);
@@ -347,7 +347,7 @@ bool KGetApplet::sceneEventFilter(QGraphicsItem * watched, QEvent * event)
void KGetApplet::dropEvent(QGraphicsSceneDragDropEvent * event)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
QStringList urls;
if (event->mimeData()->hasUrls())
@@ -377,7 +377,7 @@ void KGetApplet::dropEvent(QGraphicsSceneDragDropEvent * event)
void KGetApplet::dropEvent(QDropEvent * event)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
QStringList urls;
if (event->mimeData()->hasUrls())
diff --git a/tests/testtransfers.cpp b/tests/testtransfers.cpp
index 0e0ef61..d13cc0c 100644
--- a/tests/testtransfers.cpp
+++ b/tests/testtransfers.cpp
@@ -81,7 +81,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
const QString typeString = elem.attribute("type").toLower();
if (!s_stringCommands.contains(typeString)) {
- kDebug(5001) << "Error while parsing, type" << typeString << "not supported.";
+ qCDebug(KGET_DEBUG) << "Error while parsing, type" << typeString << "not supported.";
QWARN("Problem while parsing.");
return commands;
}
@@ -110,7 +110,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
break;
}
}
- kDebug(5001) << "Parsing IsVerifyable/Verified/Repair failed.";
+ qCDebug(KGET_DEBUG) << "Parsing IsVerifyable/Verified/Repair failed.";
QWARN("Problem while parsing.");
break;
case AddChecksum:
@@ -118,7 +118,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
data = args;
commands.append(QPair<int, QVariant>(type, data));
} else {
- kDebug(5001) << "Parsing setHash failed.";
+ qCDebug(KGET_DEBUG) << "Parsing setHash failed.";
QWARN("Problem while parsing.");
}
break;
@@ -138,7 +138,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
break;
}
}
- kDebug(5001) << "Parsing AddPartialChecksums failed.";
+ qCDebug(KGET_DEBUG) << "Parsing AddPartialChecksums failed.";
QWARN("Problem while parsing.");
break;
}
@@ -157,7 +157,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
commands.append(QPair<int, QVariant>(type, data));
break;
}
- kDebug(5001) << "Parsing BrokenPieces failed.";
+ qCDebug(KGET_DEBUG) << "Parsing BrokenPieces failed.";
QWARN("Problem while parsing.");
break;
}
@@ -184,7 +184,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
}
}
}
- kDebug(5001) << "Parsing RandomAction failed.";
+ qCDebug(KGET_DEBUG) << "Parsing RandomAction failed.";
QWARN("Problem while parsing.");
break;
}
@@ -204,7 +204,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
break;
}
}
- kDebug(5001) << "Parsing SetDirectory failed.";
+ qCDebug(KGET_DEBUG) << "Parsing SetDirectory failed.";
QWARN("Problem while parsing.");
break;
case Wait:
@@ -216,7 +216,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
break;
}
}
- kDebug(5001) << "Parsing Wait failed.";
+ qCDebug(KGET_DEBUG) << "Parsing Wait failed.";
QWARN("Problem while parsing.");
break;
case ChangedEvent:
@@ -242,7 +242,7 @@ QList<QPair<int, QVariant> > Commands::parseCommands(const QDomElement& e, TestT
}
}
}
- kDebug(5001) << "Parsing ChangedEvent failed" << args;
+ qCDebug(KGET_DEBUG) << "Parsing ChangedEvent failed" << args;
QWARN("Problem while parsing.");
break;
default:
@@ -270,7 +270,7 @@ void Commands::associateTransfer(OrgKdeKgetTransferInterface *transfer)
}
m_transfer = transfer;
- kDebug(5001) << this << "associated with" << m_transfer << m_source;
+ qCDebug(KGET_DEBUG) << this << "associated with" << m_transfer << m_source;
QDBusPendingReply<QString> reply = m_transfer->dest();
const QString dest = reply.value();
@@ -300,10 +300,10 @@ void Commands::timerEvent(QTimerEvent *event)
const int value = qrand() % 10;
//70% of the cases start, in 30% stop
if (value > 2) {
- kDebug(5001) << this << "is randomly started.";
+ qCDebug(KGET_DEBUG) << this << "is randomly started.";
m_transfer->start();
} else {
- kDebug(5001) << this << "is randomly stopped";
+ qCDebug(KGET_DEBUG) << this << "is randomly stopped";
m_transfer->stop();
}
}
@@ -337,21 +337,21 @@ void Commands::executeCommands()
switch (type) {
case Start:
m_transfer->start();
- kDebug(5001) << this << "is started.";
+ qCDebug(KGET_DEBUG) << this << "is started.";
break;
case Stop:
m_transfer->stop();
- kDebug(5001) << this << "is stopped.";
+ qCDebug(KGET_DEBUG) << this << "is stopped.";
break;
case AddChecksum: {
QStringList hash = command.toStringList();
- kDebug(5001) << this << "adding hash" << hash;
+ qCDebug(KGET_DEBUG) << this << "adding hash" << hash;
QDBusPendingReply<void> reply = m_verifier->addChecksum(hash.takeFirst(), hash.takeLast());
break;
}
case AddPartialChecksums: {
QList<QVariant> list = command.toList();
- kDebug(5001) << this << "adding partial hash" << list;
+ qCDebug(KGET_DEBUG) << this << "adding partial hash" << list;
const QString type = list.takeFirst().toString();
const qulonglong length = list.takeFirst().toULongLong();
QStringList checksums;
@@ -364,17 +364,17 @@ void Commands::executeCommands()
case IsVerifyable: {
const bool shouldWork = command.toBool();
QDBusPendingReply<bool> reply = m_verifier->isVerifyable();
- kDebug(5001) << this << "isVerifyable" << reply.value();
+ qCDebug(KGET_DEBUG) << this << "isVerifyable" << reply.value();
QVERIFY(reply.value() == shouldWork);
break;
}
case Verify: {
- kDebug(5001) << this << "verification started.";
+ qCDebug(KGET_DEBUG) << this << "verification started.";
m_verifier->verify();
break;
}
case FindBrokenPieces:
- kDebug(5001) << this << "find broken pieces.";
+ qCDebug(KGET_DEBUG) << this << "find broken pieces.";
m_verifier->brokenPieces();
break;
case Repair: {
@@ -383,7 +383,7 @@ void Commands::executeCommands()
QDBusPendingReply<bool> reply = m_transfer->repair(dest.value());
const bool isRepairable = reply.value();
- kDebug(5001) << this << "repair started" << isRepairable;
+ qCDebug(KGET_DEBUG) << this << "repair started" << isRepairable;
QVERIFY(isRepairable == shouldWork);
break;
}
@@ -394,13 +394,13 @@ void Commands::executeCommands()
QDBusPendingReply<bool> reply = m_transfer->setDirectory(newDirectory);
const bool moveStarted = reply.value();
- kDebug(5001) << this << "set changing directory started" << moveStarted;
+ qCDebug(KGET_DEBUG) << this << "set changing directory started" << moveStarted;
QVERIFY(moveStarted == shouldWork);
break;
}
case Wait: {
const int time = command.toInt();
- kDebug(5001) << this << "waiting for" << time << "msecs" << m_transfer;
+ qCDebug(KGET_DEBUG) << this << "waiting for" << time << "msecs" << m_transfer;
QTimer::singleShot(time, this, SLOT(slotWaitEvent()));
return;
break;
@@ -410,15 +410,15 @@ void Commands::executeCommands()
const bool turnOn = commands.takeFirst().toBool();
if (m_timerId == -1) {
if (turnOn) {
- kDebug(5001) << this << "starting random timer.";
+ qCDebug(KGET_DEBUG) << this << "starting random timer.";
m_timerId = startTimer(commands.takeFirst().toInt());
}
} else {
- kDebug(5001) << this << "killing random timer.";
+ qCDebug(KGET_DEBUG) << this << "killing random timer.";
killTimer(m_timerId);
m_timerId = -1;
if (turnOn) {
- kDebug(5001) << this << "starting random timer.";
+ qCDebug(KGET_DEBUG) << this << "starting random timer.";
m_timerId = startTimer(commands.takeFirst().toInt());
}
}
@@ -473,7 +473,7 @@ void Commands::slotChangedEvent(int event)
case Transfer::Tc_Percent: {
QDBusPendingReply<int> reply = m_transfer->percent();
if (reply.value() >= compareValue) {
- kDebug(5001) << this << "ChangedEvent percent.";
+ qCDebug(KGET_DEBUG) << this << "ChangedEvent percent.";
m_commands.takeFirst();
executeCommands();
}
@@ -499,7 +499,7 @@ void Commands::slotVerified(bool verified)
m_commands.takeFirst();
if (command.canConvert(QVariant::Bool)) {
const bool shouldWork = command.toBool();
- kDebug(5001) << this << "is verified" << verified;
+ qCDebug(KGET_DEBUG) << this << "is verified" << verified;
QVERIFY(verified == shouldWork);
}
@@ -508,7 +508,7 @@ void Commands::slotVerified(bool verified)
}
}
- kDebug(5001) << this << "is verified" << verified;
+ qCDebug(KGET_DEBUG) << this << "is verified" << verified;
QVERIFY(verified);
}
@@ -544,7 +544,7 @@ TestTransfers::TestTransfers()
}
m_dir.reset(new KTempDir());
- kDebug(5001) << "Using temp dir:" << tempDir();
+ qCDebug(KGET_DEBUG) << "Using temp dir:" << tempDir();
//TODO add a signal to check if the move worked!!
@@ -620,7 +620,7 @@ void TestTransfers::createTransfer()
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget")) {
- kDebug(5001) << "Service not registered yet, retrying.";
+ qCDebug(KGET_DEBUG) << "Service not registered yet, retrying.";
QTimer::singleShot(500, this, SLOT(createTransfer()));
return;
}
@@ -633,7 +633,7 @@ void TestTransfers::createTransfer()
reply.waitForFinished();
if (reply.value().size()) {
- kDebug(5001) << "TestTransfers::createTransfer -> transfer = " << reply.value();
+ qCDebug(KGET_DEBUG) << "TestTransfers::createTransfer -> transfer = " << reply.value();
OrgKdeKgetTransferInterface *transfer = new OrgKdeKgetTransferInterface("org.kde.kget", reply.value().first(), QDBusConnection::sessionBus(), this);
command->associateTransfer(transfer);
diff --git a/tests/verifiertest.cpp b/tests/verifiertest.cpp
index e40ddeb..2e28346 100644
--- a/tests/verifiertest.cpp
+++ b/tests/verifiertest.cpp
@@ -28,7 +28,7 @@ VerfierTest::VerfierTest(QObject *parent)
path.append("test.txt");
QFile file(path);
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- kError(5001) << "Creating file failed:" << path;
+ qCCritical(KGET_DEBUG) << "Creating file failed:" << path;
abort();
}
m_file = KUrl(path);
@@ -37,12 +37,12 @@ VerfierTest::VerfierTest(QObject *parent)
const qint64 size = data.size();
for (int i = 0; i < 50000; ++i) {
if (file.write(data) != size) {
- kError(5001) << "Creating file failed:" << path;
+ qCCritical(KGET_DEBUG) << "Creating file failed:" << path;
abort();
}
}
- kDebug(5001) << "Supported types:" << m_supported;
+ qCDebug(KGET_DEBUG) << "Supported types:" << m_supported;
//Otherwise testVerify fails
qRegisterMetaType<KUrl>("KUrl");
diff --git a/transfer-plugins/bittorrent/advanceddetails/btadvanceddetailswidget.cpp b/transfer-plugins/bittorrent/advanceddetails/btadvanceddetailswidget.cpp
index 7584d5c..97a4155 100644
--- a/transfer-plugins/bittorrent/advanceddetails/btadvanceddetailswidget.cpp
+++ b/transfer-plugins/bittorrent/advanceddetails/btadvanceddetailswidget.cpp
@@ -92,7 +92,7 @@ kt::Monitor* BTAdvancedDetailsWidget::torrentMonitor() const
void BTAdvancedDetailsWidget::slotTransferChanged(TransferHandler * transfer, TransferHandler::ChangesFlags flags)
{
- kDebug(5001) << "BTAdvancedDetailsWidget::slotTransferChanged" ;
+ qCDebug(KGET_DEBUG) << "BTAdvancedDetailsWidget::slotTransferChanged" ;
Q_UNUSED(transfer)
diff --git a/transfer-plugins/bittorrent/btcache.cpp b/transfer-plugins/bittorrent/btcache.cpp
index dc2de07..8403f95 100644
--- a/transfer-plugins/bittorrent/btcache.cpp
+++ b/transfer-plugins/bittorrent/btcache.cpp
@@ -36,7 +36,7 @@ void BTCache::save(Chunk* c)
/*if (c->getStatus() == Chunk::MMAPPED)
{
KIO::fileoffset_t off = c->getIndex() * tor.getChunkSize();
- kDebug(5001) << "Fileoffset is: " + QString::number(off);
+ qCDebug(KGET_DEBUG) << "Fileoffset is: " + QString::number(off);
QByteArray data;
QDataStream s(&data, QIODevice::WriteOnly | QIODevice::Unbuffered);
s << c->getData();
@@ -47,7 +47,7 @@ void BTCache::save(Chunk* c)
else if (c->getStatus() == Chunk::BUFFERED)
{*/
KIO::fileoffset_t off = c->getIndex() * tor.getChunkSize();
- kDebug(5001) << "Fileoffset is: " + QString::number(off);
+ qCDebug(KGET_DEBUG) << "Fileoffset is: " + QString::number(off);
QByteArray data;
QDataStream s(&data, QIODevice::WriteOnly | QIODevice::Unbuffered);
s << c->getData();
diff --git a/transfer-plugins/bittorrent/btdatasource.cpp b/transfer-plugins/bittorrent/btdatasource.cpp
index 74a23e3..6262c8d 100644
--- a/transfer-plugins/bittorrent/btdatasource.cpp
+++ b/transfer-plugins/bittorrent/btdatasource.cpp
@@ -42,7 +42,7 @@ BTDataSource::BTDataSource(const KUrl &srcUrl, QObject *parent)
bt::Uint16 i = 0;
do
{
- kDebug(5001) << "Trying to set port to" << BittorrentSettings::port() + i;
+ qCDebug(KGET_DEBUG) << "Trying to set port to" << BittorrentSettings::port() + i;
bt::Globals::instance().initServer(BittorrentSettings::port() + i);
i++;
}while (!bt::Globals::instance().getServer().isOK() && i < 10);
@@ -131,7 +131,7 @@ void BTDataSource::init(const KUrl &torrentSource, const QByteArray &data)
}
catch (bt::Error &err)
{
- kDebug(5001) << err.toString();
+ qCDebug(KGET_DEBUG) << err.toString();
//m_ready = false;
}
start();
@@ -139,7 +139,7 @@ void BTDataSource::init(const KUrl &torrentSource, const QByteArray &data)
void BTDataSource::addSegment(const KIO::fileoffset_t offset, const KIO::fileoffset_t bytes, int segmentNum)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (offset < m_offset)
{
diff --git a/transfer-plugins/bittorrent/btdetailswidget.cpp b/transfer-plugins/bittorrent/btdetailswidget.cpp
index 3b21a69..52280a9 100644
--- a/transfer-plugins/bittorrent/btdetailswidget.cpp
+++ b/transfer-plugins/bittorrent/btdetailswidget.cpp
@@ -48,7 +48,7 @@ void BTDetailsWidget::slotTransferChanged(TransferHandler * transfer, TransferHa
{
Q_UNUSED(transfer)
- kDebug(5001) << "BTDetailsWidget::slotTransferChanged";
+ qCDebug(KGET_DEBUG) << "BTDetailsWidget::slotTransferChanged";
if(flags & Transfer::Tc_DownloadSpeed)
dlSpeedLabel->setText(KFormat().formatByteSize(m_transfer->downloadSpeed()) + "/s");
diff --git a/transfer-plugins/bittorrent/btsettingswidget.cpp b/transfer-plugins/bittorrent/btsettingswidget.cpp
index 6ce10c6..aaf3d83 100644
--- a/transfer-plugins/bittorrent/btsettingswidget.cpp
+++ b/transfer-plugins/bittorrent/btsettingswidget.cpp
@@ -42,7 +42,7 @@ void BTSettingsWidget::load()
void BTSettingsWidget::save()
{
- kDebug(5001) << "Save Bittorrent-config";
+ qCDebug(KGET_DEBUG) << "Save Bittorrent-config";
BittorrentSettings::setPort(portBox->value());
BittorrentSettings::setUploadLimit(uploadBox->value());
BittorrentSettings::setDownloadLimit(downloadBox->value());
diff --git a/transfer-plugins/bittorrent/bttransfer.cpp b/transfer-plugins/bittorrent/bttransfer.cpp
index b43dbd9..d391dcb 100644
--- a/transfer-plugins/bittorrent/bttransfer.cpp
+++ b/transfer-plugins/bittorrent/bttransfer.cpp
@@ -81,7 +81,7 @@ void BTTransfer::deinit(Transfer::DeleteOptions options)
}
if (options & Transfer::DeleteTemporaryFiles) {
QDir tmpDir(m_tmp);
- kDebug(5001) << m_tmp + m_source.fileName().remove(".torrent");
+ qCDebug(KGET_DEBUG) << m_tmp + m_source.fileName().remove(".torrent");
tmpDir.rmdir(m_source.fileName().remove(".torrent") + "/dnd");
tmpDir.cd(m_source.fileName().remove(".torrent"));
QStringList list = tmpDir.entryList();
@@ -93,7 +93,7 @@ void BTTransfer::deinit(Transfer::DeleteOptions options)
//only remove the .torrent file if it was downloaded by KGet
if (!m_tmpTorrentFile.isEmpty()) {
- kDebug(5001) << "Removing" << m_tmpTorrentFile;
+ qCDebug(KGET_DEBUG) << "Removing" << m_tmpTorrentFile;
QFile torrentFile(m_tmpTorrentFile);
torrentFile.remove();
}
@@ -125,7 +125,7 @@ void BTTransfer::start()
{
if (!m_source.isLocalFile())
{
- kDebug(5001) << m_dest.path();
+ qCDebug(KGET_DEBUG) << m_dest.path();
m_tmpTorrentFile = QString(KStandardDirs::locateLocal("appdata", "tmp/") + m_dest.fileName());
Download *download = new Download(m_source, m_tmpTorrentFile);
@@ -219,7 +219,7 @@ void BTTransfer::load(const QDomElement *element)
// void BTTransfer::save(const QDomElement &element)
// {
-// kDebug(5001);
+// qCDebug(KGET_DEBUG);
//
// QDomElement e = element;
//
@@ -237,7 +237,7 @@ void BTTransfer::setPort(int port)
void BTTransfer::setSpeedLimits(int ulLimit, int dlLimit)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (!torrent)
return;
@@ -246,7 +246,7 @@ void BTTransfer::setSpeedLimits(int ulLimit, int dlLimit)
void BTTransfer::addTracker(const QString &url)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if(torrent->getStats().priv_torrent) {
KMessageBox::sorry(0, i18n("Cannot add a tracker to a private torrent."));
return;
@@ -266,7 +266,7 @@ void BTTransfer::startTorrent()
{
if (m_ready)
{
- //kDebug(5001) << "Going to download that stuff :-0";
+ //qCDebug(KGET_DEBUG) << "Going to download that stuff :-0";
setSpeedLimits(uploadLimit(Transfer::InvisibleSpeedLimit), downloadLimit(Transfer::InvisibleSpeedLimit));//Set traffic-limits before starting
torrent->setMonitor(this);
torrent->start();
@@ -304,7 +304,7 @@ void BTTransfer::stopTorrent()
void BTTransfer::updateTorrent()
{
- //kDebug(5001) << "Update torrent";
+ //qCDebug(KGET_DEBUG) << "Update torrent";
bt::UpdateCurrentTime();
bt::AuthenticationMonitor::instance().update();
torrent->update();
@@ -402,7 +402,7 @@ void BTTransfer::updateFilesStatus()
void BTTransfer::btTransferInit(const KUrl &src, const QByteArray &data)
{
Q_UNUSED(data)
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (src != m_source && !src.isEmpty())
m_source = src;
@@ -491,7 +491,7 @@ void BTTransfer::slotStoppedByError(const bt::TorrentInterface* &error, const QS
void BTTransfer::slotDownloadFinished(bt::TorrentInterface* ti)
{
- kDebug(5001) << "Start seeding *********************************************************************";
+ qCDebug(KGET_DEBUG) << "Start seeding *********************************************************************";
Q_UNUSED(ti)
m_downloadFinished = true;
//timer.stop();
diff --git a/transfer-plugins/bittorrent/bttransferfactory.cpp b/transfer-plugins/bittorrent/bttransferfactory.cpp
index 52b27ab..6b53a7e 100644
--- a/transfer-plugins/bittorrent/bttransferfactory.cpp
+++ b/transfer-plugins/bittorrent/bttransferfactory.cpp
@@ -30,7 +30,7 @@ BTTransferFactory::BTTransferFactory(QObject *parent, const QVariantList &args)
#if LIBKTORRENT_VERSION >= 0x010100
if (!bt::InitLibKTorrent())
{
- kError(5001) << "Failed to initialize libktorrent";
+ qCCritical(KGET_DEBUG) << "Failed to initialize libktorrent";
KGet::showNotification(0, "error", i18n("Cannot initialize libktorrent. Torrent support might not work."));
}
#endif
@@ -45,7 +45,7 @@ Transfer * BTTransferFactory::createTransfer(const KUrl &srcUrl, const KUrl &des
Scheduler * scheduler,
const QDomElement * e )
{
- kDebug(5001) << "BTTransferFactory::createTransfer";
+ qCDebug(KGET_DEBUG) << "BTTransferFactory::createTransfer";
if (isSupported(srcUrl))
{
@@ -60,7 +60,7 @@ TransferHandler * BTTransferFactory::createTransferHandler(Transfer * transfer,
if (!bttransfer)
{
- kError(5001) << "WARNING! passing a non-BTTransfer pointer!!";
+ qCCritical(KGET_DEBUG) << "WARNING! passing a non-BTTransfer pointer!!";
return 0;
}
diff --git a/transfer-plugins/bittorrent/bttransferhandler.cpp b/transfer-plugins/bittorrent/bttransferhandler.cpp
index 7e1ce8c..3329d1f 100644
--- a/transfer-plugins/bittorrent/bttransferhandler.cpp
+++ b/transfer-plugins/bittorrent/bttransferhandler.cpp
@@ -37,11 +37,11 @@ void BTTransferHandler::createAdvancedDetails()
{
if (!torrentControl())
return;
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (!advancedDetails)
{
- kDebug(5001) << "Going to create AdvancedDetails";
+ qCDebug(KGET_DEBUG) << "Going to create AdvancedDetails";
advancedDetails = new BTAdvancedDetailsWidget(this);
advancedDetails->show();
connect(advancedDetails, SIGNAL(aboutToClose()), SLOT(removeAdvancedDetails()));
@@ -95,7 +95,7 @@ void BTTransferHandler::createScanDlg()
#if LIBKTORRENT_VERSION < 0x010100
void BTTransferHandler::removeScanDlg()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
scanDlg = 0;
}
#endif
diff --git a/transfer-plugins/checksumsearch/checksumsearch.cpp b/transfer-plugins/checksumsearch/checksumsearch.cpp
index de531e6..35fd42b 100644
--- a/transfer-plugins/checksumsearch/checksumsearch.cpp
+++ b/transfer-plugins/checksumsearch/checksumsearch.cpp
@@ -76,7 +76,7 @@ void ChecksumSearch::slotData(KIO::Job *job, const QByteArray &data)
void ChecksumSearch::slotResult(KJob *job)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
m_data.clear();
@@ -84,13 +84,13 @@ void ChecksumSearch::slotResult(KJob *job)
{
case 0://The download has finished
{
- kDebug(5001) << "Correctly downloaded" << m_src.pathOrUrl();
+ qCDebug(KGET_DEBUG) << "Correctly downloaded" << m_src.pathOrUrl();
m_data = QString(m_dataBA);
break;
}
default:
- kDebug(5001) << "There was error" << job->error() << "while downloading" << m_src.pathOrUrl();
+ qCDebug(KGET_DEBUG) << "There was error" << job->error() << "while downloading" << m_src.pathOrUrl();
break;
}
@@ -103,7 +103,7 @@ void ChecksumSearch::slotResult(KJob *job)
void ChecksumSearch::parseDownload()
{
if (!m_data.isEmpty()) {
- kDebug(5001) << "*******Parse*******\n" << m_data << "*******************";
+ qCDebug(KGET_DEBUG) << "*******Parse*******\n" << m_data << "*******************";
}
//no type has been specified
@@ -125,7 +125,7 @@ void ChecksumSearch::parseDownload()
if (rxChecksum.indexIn(line) > -1) {
hash = rxChecksum.cap(0).toLower();
if (!m_fileName.contains(hash, Qt::CaseInsensitive)) {
- kDebug(5001) << "Found hash: " << hash;
+ qCDebug(KGET_DEBUG) << "Found hash: " << hash;
emit data(m_type, hash);
}
}
@@ -136,7 +136,7 @@ void ChecksumSearch::parseDownload()
if (hash.isEmpty() && (rxChecksum.indexIn(m_data) > -1)) {
QString hash = rxChecksum.cap(0);
if (!m_fileName.contains(hash, Qt::CaseInsensitive)) {
- kDebug(5001) << "Found hash:" << hash;
+ qCDebug(KGET_DEBUG) << "Found hash:" << hash;
emit data(m_type, hash);
}
}
diff --git a/transfer-plugins/checksumsearch/checksumsearchfactory.cpp b/transfer-plugins/checksumsearch/checksumsearchfactory.cpp
index 58bfba7..a931297 100644
--- a/transfer-plugins/checksumsearch/checksumsearchfactory.cpp
+++ b/transfer-plugins/checksumsearch/checksumsearchfactory.cpp
@@ -31,7 +31,7 @@ ChecksumSearchFactory::~ChecksumSearchFactory()
TransferDataSource *ChecksumSearchFactory::createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (type.attribute("type") == "checksumsearch") {
return new ChecksumSearchTransferDataSource(srcUrl, parent);
diff --git a/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.cpp b/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.cpp
index 615df0a..6edf1ce 100644
--- a/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.cpp
+++ b/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.cpp
@@ -42,7 +42,7 @@ ChecksumSearchController::~ChecksumSearchController()
void ChecksumSearchController::registerSearch(ChecksumSearchTransferDataSource *search, const KUrl &baseUrl)
{
if (m_finished.contains(baseUrl)) {
- kDebug(5001) << "Already downloaded" << baseUrl;
+ qCDebug(KGET_DEBUG) << "Already downloaded" << baseUrl;
const KUrl urlToFile = m_finished[baseUrl];
if (!urlToFile.isEmpty()) {
search->gotBaseUrl(m_finished[baseUrl]);
@@ -53,10 +53,10 @@ void ChecksumSearchController::registerSearch(ChecksumSearchTransferDataSource *
m_searches.insert(baseUrl, search);
if (alreadySearchedFor) {
- kDebug(5001) << "Search already started for" << baseUrl;
+ qCDebug(KGET_DEBUG) << "Search already started for" << baseUrl;
return;
}
- kDebug(5001) << "Creating download for" << baseUrl;
+ qCDebug(KGET_DEBUG) << "Creating download for" << baseUrl;
static int files = 0;
const KUrl dest = KUrl(KStandardDirs::locateLocal("appdata", "checksumsearch/") + QString::number(files++));
@@ -66,13 +66,13 @@ void ChecksumSearchController::registerSearch(ChecksumSearchTransferDataSource *
}
if (baseUrl.protocol() != "ftp" && baseUrl.protocol() != "sftp") {
- kDebug(5001) << "Downloading" << baseUrl;
+ qCDebug(KGET_DEBUG) << "Downloading" << baseUrl;
KIO::FileCopyJob *job = KIO::file_copy(baseUrl, dest, -1, KIO::HideProgressInfo);
job->addMetaData("errorPage", "false");
connect(job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)));
m_jobs[job] = qMakePair(baseUrl, dest);
} else {
- kDebug(5001) << "ftp, doing a listjob";
+ qCDebug(KGET_DEBUG) << "ftp, doing a listjob";
KIO::ListJob *job = KIO::listDir(baseUrl, KIO::HideProgressInfo);
connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), this, SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList)));
connect(job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)));
@@ -96,7 +96,7 @@ void ChecksumSearchController::unregisterSearch(ChecksumSearchTransferDataSource
void ChecksumSearchController::slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (!m_jobs.contains(job)) {
return;
@@ -106,7 +106,7 @@ void ChecksumSearchController::slotEntries(KIO::Job *job, const KIO::UDSEntryLis
const KUrl urlToFile = m_jobs[job].second;
QFile file(urlToFile.toLocalFile());
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- kDebug(5001) << "Could not open file" << urlToFile;
+ qCDebug(KGET_DEBUG) << "Could not open file" << urlToFile;
}
QTextStream out(&file);
@@ -120,7 +120,7 @@ void ChecksumSearchController::slotEntries(KIO::Job *job, const KIO::UDSEntryLis
void ChecksumSearchController::slotResult(KJob *job)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (!m_jobs.contains(job)) {
return;
@@ -130,7 +130,7 @@ void ChecksumSearchController::slotResult(KJob *job)
const KUrl urlToFile = m_jobs[job].second;
m_jobs.remove(job);
if (job->error()) {
- kDebug(5001) << "Error while getting baseurl:" << baseUrl << job->error() << job->errorString();
+ qCDebug(KGET_DEBUG) << "Error while getting baseurl:" << baseUrl << job->error() << job->errorString();
m_finished[baseUrl] = KUrl();
return;
}
@@ -156,7 +156,7 @@ ChecksumSearchTransferDataSource::~ChecksumSearchTransferDataSource()
void ChecksumSearchTransferDataSource::start()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
const KUrl baseUrl = m_sourceUrl.upUrl();
s_controller.registerSearch(this, baseUrl);
@@ -166,7 +166,7 @@ void ChecksumSearchTransferDataSource::gotBaseUrl(const KUrl &urlToFile)
{
QFile file(urlToFile.toLocalFile());
if (!file.open(QIODevice::ReadOnly)) {
- kDebug(5001) << "Could not open file" << urlToFile;
+ qCDebug(KGET_DEBUG) << "Could not open file" << urlToFile;
return;
}
@@ -190,7 +190,7 @@ void ChecksumSearchTransferDataSource::gotBaseUrl(const KUrl &urlToFile)
}
}
- kDebug(5001) << "Creating Checksumsearch for" << urls.count() << "urls.";
+ qCDebug(KGET_DEBUG) << "Creating Checksumsearch for" << urls.count() << "urls.";
if (urls.count() && types.count()) {
ChecksumSearch *search = new ChecksumSearch(urls, m_sourceUrl.fileName(), types);
@@ -201,14 +201,14 @@ void ChecksumSearchTransferDataSource::gotBaseUrl(const KUrl &urlToFile)
void ChecksumSearchTransferDataSource::stop()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
}
void ChecksumSearchTransferDataSource::addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
{
Q_UNUSED(segmentSize)
Q_UNUSED(segmentRange)
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
}
diff --git a/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp b/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp
index d67a230..07ceb0e 100644
--- a/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp
+++ b/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp
@@ -266,7 +266,7 @@ void DlgChecksumSettingsWidget::load()
void DlgChecksumSettingsWidget::save()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
QStringList changes;
QList<int> modes;
QStringList types;
diff --git a/transfer-plugins/contentfetch/contentfetch.cpp b/transfer-plugins/contentfetch/contentfetch.cpp
index 7849c07..e51dd40 100644
--- a/transfer-plugins/contentfetch/contentfetch.cpp
+++ b/transfer-plugins/contentfetch/contentfetch.cpp
@@ -48,12 +48,12 @@ void ContentFetch::deinit()
void ContentFetch::start()
{
- kDebug(5001) << "ContentFetch::start";
+ qCDebug(KGET_DEBUG) << "ContentFetch::start";
setStatus(Job::Running, i18nc("Transfer state: processing script", "Processing script...."), SmallIcon("media-playback-start"));
setTransferChange(Tc_Status, true);
m_p_script->setFile(m_scriptFile);
m_p_script->start();
- kDebug(5001) << "ContentFetch::start() finished!";
+ qCDebug(KGET_DEBUG) << "ContentFetch::start() finished!";
}
void ContentFetch::stop()
@@ -62,7 +62,7 @@ void ContentFetch::stop()
{
return;
}
- kDebug(5001) << "ContentFetch::stop";
+ qCDebug(KGET_DEBUG) << "ContentFetch::stop";
// kill -9 the script
m_p_script->terminate();
// delete m_p_script to avoid crash?
diff --git a/transfer-plugins/contentfetch/contentfetchfactory.cpp b/transfer-plugins/contentfetch/contentfetchfactory.cpp
index 60050e9..e544614 100644
--- a/transfer-plugins/contentfetch/contentfetchfactory.cpp
+++ b/transfer-plugins/contentfetch/contentfetchfactory.cpp
@@ -68,7 +68,7 @@ Transfer * ContentFetchFactory::createTransfer( const KUrl &srcUrl,
{
if (iter->indexIn(url) != -1)
{
- kDebug(5001) << url << " match " << iter->pattern();
+ qCDebug(KGET_DEBUG) << url << " match " << iter->pattern();
return new ContentFetch(parent, this, scheduler, srcUrl, destUrl,
*fileIter, e);
}
diff --git a/transfer-plugins/kio/CMakeLists.txt b/transfer-plugins/kio/CMakeLists.txt
index 0de9155..fac9bc3 100644
--- a/transfer-plugins/kio/CMakeLists.txt
+++ b/transfer-plugins/kio/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories(
set(kget_kiofactory_PART_SRCS
transferKio.cpp
transferKioFactory.cpp
+ ../../kget_debug.cpp
)
add_library(kget_kiofactory MODULE ${kget_kiofactory_PART_SRCS})
diff --git a/transfer-plugins/kio/transferKio.cpp b/transfer-plugins/kio/transferKio.cpp
index 7c1e3ab..47db8a9 100644
--- a/transfer-plugins/kio/transferKio.cpp
+++ b/transfer-plugins/kio/transferKio.cpp
@@ -16,6 +16,9 @@
#include <utime.h>
+#include "kget_debug.h"
+#include <qdebug.h>
+
#include <kiconloader.h>
#include <kio/scheduler.h>
#include <KIO/DeleteJob>
@@ -23,7 +26,6 @@
#include <KIO/NetAccess>
#include <KLocale>
#include <KMessageBox>
-#include <KDebug>
#include <QFile>
#include <QDomElement>
@@ -92,7 +94,7 @@ void TransferKio::start()
if(!m_copyjob)
createJob();
- kDebug(5001) << "TransferKio::start";
+ qCDebug(KGET_DEBUG) << "TransferKio::start";
setStatus(Job::Running, i18nc("transfer state: connecting", "Connecting...."), SmallIcon("network-connect")); // should be "network-connecting", but that doesn't exist for KDE 4.0 yet
setTransferChange(Tc_Status, true);
}
@@ -112,7 +114,7 @@ void TransferKio::stop()
m_copyjob=0;
}
- kDebug(5001) << "Stop";
+ qCDebug(KGET_DEBUG) << "Stop";
setStatus(Job::Stopped);
m_downloadSpeed = 0;
setTransferChange(Tc_Status | Tc_DownloadSpeed, true);
@@ -153,7 +155,7 @@ void TransferKio::createJob()
void TransferKio::slotResult( KJob * kioJob )
{
- kDebug(5001) << "slotResult (" << kioJob->error() << ")";
+ qCDebug(KGET_DEBUG) << "slotResult (" << kioJob->error() << ")";
switch (kioJob->error()) {
case 0: //The download has finished
case KIO::ERR_FILE_ALREADY_EXIST: //The file has already been downloaded.
@@ -166,7 +168,7 @@ void TransferKio::slotResult( KJob * kioJob )
break;
default:
//There has been an error
- kDebug(5001) << "-- E R R O R (" << kioJob->error() << ")--";
+ qCDebug(KGET_DEBUG) << "-- E R R O R (" << kioJob->error() << ")--";
if (!m_stopped)
setStatus(Job::Aborted);
break;
@@ -215,7 +217,7 @@ void TransferKio::slotInfoMessage( KJob * kioJob, const QString & msg )
void TransferKio::slotPercent( KJob * kioJob, unsigned long percent )
{
- kDebug(5001) << "slotPercent";
+ qCDebug(KGET_DEBUG) << "slotPercent";
Q_UNUSED(kioJob)
m_percent = percent;
setTransferChange(Tc_Percent, true);
@@ -225,7 +227,7 @@ void TransferKio::slotTotalSize( KJob * kioJob, qulonglong size )
{
Q_UNUSED(kioJob)
- kDebug(5001) << "slotTotalSize";
+ qCDebug(KGET_DEBUG) << "slotTotalSize";
setStatus(Job::Running);
@@ -237,7 +239,7 @@ void TransferKio::slotProcessedSize( KJob * kioJob, qulonglong size )
{
Q_UNUSED(kioJob)
-// kDebug(5001) << "slotProcessedSize";
+// qCDebug(KGET_DEBUG) << "slotProcessedSize";
if(status() != Job::Running)
{
@@ -252,7 +254,7 @@ void TransferKio::slotSpeed( KJob * kioJob, unsigned long bytes_per_second )
{
Q_UNUSED(kioJob)
-// kDebug(5001) << "slotSpeed";
+// qCDebug(KGET_DEBUG) << "slotSpeed";
if(status() != Job::Running)
{
diff --git a/transfer-plugins/kio/transferKioFactory.cpp b/transfer-plugins/kio/transferKioFactory.cpp
index e519349..991c076 100644
--- a/transfer-plugins/kio/transferKioFactory.cpp
+++ b/transfer-plugins/kio/transferKioFactory.cpp
@@ -14,7 +14,8 @@
#include "core/transfergroup.h"
#include "transferKio.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <kpluginfactory.h>
K_PLUGIN_FACTORY(KGetFactory,
@@ -31,12 +32,13 @@ TransferKioFactory::~TransferKioFactory()
{
}
-Transfer * TransferKioFactory::createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
+Transfer * TransferKioFactory::createTransfer( const QUrl &srcUrl, const QUrl &destUrl,
TransferGroup * parent,
Scheduler * scheduler,
const QDomElement * e )
{
- qDebug() << "TransferKioFactory::createTransfer";
+ qCDebug(KGET_DEBUG) << "TransferKioFactory::createTransfer";
+ qWarning(KGET_DEBUG) << "KIOFACTORY createTRANSFER";
if (isSupported(srcUrl))
{
@@ -45,7 +47,7 @@ Transfer * TransferKioFactory::createTransfer( const KUrl &srcUrl, const KUrl &d
return 0;
}
-bool TransferKioFactory::isSupported(const KUrl &url) const
+bool TransferKioFactory::isSupported(const QUrl &url) const
{
QString prot = url.scheme();
qDebug() << "Protocol = " << prot;
diff --git a/transfer-plugins/kio/transferKioFactory.h b/transfer-plugins/kio/transferKioFactory.h
index 975481e..1b48937 100644
--- a/transfer-plugins/kio/transferKioFactory.h
+++ b/transfer-plugins/kio/transferKioFactory.h
@@ -25,13 +25,13 @@ class TransferKioFactory : public TransferFactory
~TransferKioFactory();
public slots:
- virtual Transfer * createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
+ virtual Transfer * createTransfer( const QUrl &srcUrl, const QUrl &destUrl,
TransferGroup * parent, Scheduler * scheduler,
const QDomElement * e = 0 );
virtual QString displayName() const {return "HTTP(s) / FTP(s)";}
- virtual bool isSupported(const KUrl &url) const;
+ virtual bool isSupported(const QUrl &url) const;
QStringList addsProtocols() const;
};
diff --git a/transfer-plugins/metalink/CMakeLists.txt b/transfer-plugins/metalink/CMakeLists.txt
index a39087a..a7d76de 100644
--- a/transfer-plugins/metalink/CMakeLists.txt
+++ b/transfer-plugins/metalink/CMakeLists.txt
@@ -12,6 +12,7 @@ set(kget_metalinkfactory_PART_SRCS
metalinkhttp.cpp
fileselectiondlg.cpp
../../ui/metalinkcreator/metalinker.cpp
+ ../../kget_debug.cpp
)
ki18n_wrap_ui(kget_metalinkfactory_PART_SRCS
@@ -33,7 +34,8 @@ install(FILES kget_metalinkfactory.desktop DESTINATION ${SERVICES_INSTALL_DIR})
###Build KCM-Module
set(kcm_kget_metalinkfactory_PART_SRCS
-dlgmetalink.cpp
+ dlgmetalink.cpp
+ ../../kget_debug.cpp
)
ki18n_wrap_ui(kcm_kget_metalinkfactory_PART_SRCS
diff --git a/transfer-plugins/metalink/abstractmetalink.cpp b/transfer-plugins/metalink/abstractmetalink.cpp
index 862b9e7..dda6a76 100644
--- a/transfer-plugins/metalink/abstractmetalink.cpp
+++ b/transfer-plugins/metalink/abstractmetalink.cpp
@@ -22,6 +22,8 @@
#include "core/verifier.h"
#include "core/signature.h"
+#include "kget_debug.h"
+#include <qdebug.h>
#include <KIconLoader>
#include <KIO/DeleteJob>
#include <KIO/NetAccess>
@@ -537,7 +539,7 @@ void AbstractMetalink::filesSelected()
void AbstractMetalink::stop()
{
- kDebug(5001) << "metalink::Stop";
+ qCDebug(KGET_DEBUG) << "metalink::Stop";
if (m_ready && ((status() != Stopped) || (status() != Finished)))
{
m_currentFiles = 0;
diff --git a/transfer-plugins/metalink/metalink.cpp b/transfer-plugins/metalink/metalink.cpp
index 863a0b4..8509730 100644
--- a/transfer-plugins/metalink/metalink.cpp
+++ b/transfer-plugins/metalink/metalink.cpp
@@ -60,7 +60,7 @@ Metalink::~Metalink()
void Metalink::start()
{
- kDebug(5001) << "metalink::start";
+ qCDebug(KGET_DEBUG) << "metalink::start";
if (!m_ready)
{
@@ -88,7 +88,7 @@ void Metalink::downloadMetalink()
bool Metalink::metalinkInit(const KUrl &src, const QByteArray &data)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (!src.isEmpty()) {
m_localMetalinkLocation = src;
@@ -105,7 +105,7 @@ bool Metalink::metalinkInit(const KUrl &src, const QByteArray &data)
}
if (!m_metalink.isValid()) {
- kError(5001) << "Unknown error when trying to load the .metalink-file. Metalink is not valid.";
+ qCCritical(KGET_DEBUG) << "Unknown error when trying to load the .metalink-file. Metalink is not valid.";
setStatus(Job::Aborted);
setTransferChange(Tc_Status, true);
return false;
@@ -198,7 +198,7 @@ bool Metalink::metalinkInit(const KUrl &src, const QByteArray &data)
if (!m_dataSourceFactory.size()) {
//TODO make this via log in the future + do not display the KMessageBox
- kWarning(5001) << "Download of" << m_source << "failed, no working URLs were found.";
+ qCWarning(KGET_DEBUG) << "Download of" << m_source << "failed, no working URLs were found.";
KMessageBox::error(0, i18n("Download failed, no working URLs were found."), i18n("Error"));
setStatus(Job::Aborted);
setTransferChange(Tc_Status, true);
@@ -302,7 +302,7 @@ void Metalink::deinit(Transfer::DeleteOptions options)
void Metalink::stop()
{
- kDebug(5001) << "metalink::Stop";
+ qCDebug(KGET_DEBUG) << "metalink::Stop";
if (m_ready && status() != Stopped)
{
m_currentFiles = 0;
diff --git a/transfer-plugins/metalink/metalinkfactory.cpp b/transfer-plugins/metalink/metalinkfactory.cpp
index d32bb94..3612581 100644
--- a/transfer-plugins/metalink/metalinkfactory.cpp
+++ b/transfer-plugins/metalink/metalinkfactory.cpp
@@ -17,7 +17,8 @@
#include "metalinkhttp.h"
#include "metalinkxml.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
//PORT QT5 KGET_EXPORT_PLUGIN( MetalinkFactory )
@@ -35,7 +36,7 @@ Transfer * MetalinkFactory::createTransfer( const KUrl &srcUrl, const KUrl &dest
Scheduler * scheduler,
const QDomElement * e )
{
- kDebug(5001) << "metalinkFactory::createTransfer";
+ qCDebug(KGET_DEBUG) << "metalinkFactory::createTransfer";
KGetMetalink::MetalinkHttpParser *metalinkHttpChecker = new KGetMetalink::MetalinkHttpParser(srcUrl);
if (metalinkHttpChecker->isMetalinkHttp()) {
diff --git a/transfer-plugins/metalink/metalinkhttp.cpp b/transfer-plugins/metalink/metalinkhttp.cpp
index d71b0e0..942e187 100644
--- a/transfer-plugins/metalink/metalinkhttp.cpp
+++ b/transfer-plugins/metalink/metalinkhttp.cpp
@@ -24,6 +24,9 @@
#include "core/verifier.h"
#include "core/signature.h"
+#include "kget_debug.h"
+#include <qdebug.h>
+
#ifdef HAVE_NEPOMUK
#include "core/nepomukhandler.h"
#include <Nepomuk2/Variant>
@@ -70,7 +73,7 @@ MetalinkHttp::~MetalinkHttp()
void MetalinkHttp::load(const QDomElement *element)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
Transfer::load(element);
DataSourceFactory * fac = new DataSourceFactory(this, m_dest);
m_dataSourceFactory.insert(m_dest, fac);
@@ -92,7 +95,7 @@ void MetalinkHttp::load(const QDomElement *element)
void MetalinkHttp::save(const QDomElement &element)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
Transfer::save(element);
m_dataSourceFactory.begin().value()->save(element);
}
@@ -236,7 +239,7 @@ bool MetalinkHttp::metalinkHttpInit()
if (!m_dataSourceFactory.size()) {
//TODO make this via log in the future + do not display the KMessageBox
- kWarning(5001) << "Download of" << m_source << "failed, no working URLs were found.";
+ qCWarning(KGET_DEBUG) << "Download of" << m_source << "failed, no working URLs were found.";
KMessageBox::error(0, i18n("Download failed, no working URLs were found."), i18n("Error"));
setStatus(Job::Aborted);
setTransferChange(Tc_Status, true);
diff --git a/transfer-plugins/metalink/metalinkxml.cpp b/transfer-plugins/metalink/metalinkxml.cpp
index fd4adde..29c2916 100644
--- a/transfer-plugins/metalink/metalinkxml.cpp
+++ b/transfer-plugins/metalink/metalinkxml.cpp
@@ -24,6 +24,9 @@
#include "core/verifier.h"
#include "core/signature.h"
+#include "kget_debug.h"
+#include <qdebug.h>
+
#ifdef HAVE_NEPOMUK
#include "core/nepomukhandler.h"
#include <Nepomuk2/Variant>
@@ -56,7 +59,7 @@ MetalinkXml::~MetalinkXml()
void MetalinkXml::start()
{
- kDebug(5001) << "metalinkxml::start";
+ qCDebug(KGET_DEBUG) << "metalinkxml::start";
if (!m_ready)
{
@@ -84,7 +87,7 @@ void MetalinkXml::downloadMetalink()
bool MetalinkXml::metalinkInit(const QUrl &src, const QByteArray &data)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (!src.isEmpty()) {
m_localMetalinkLocation = src;
@@ -101,7 +104,7 @@ bool MetalinkXml::metalinkInit(const QUrl &src, const QByteArray &data)
}
if (!m_metalink.isValid()) {
- kError(5001) << "Unknown error when trying to load the .metalink-file. Metalink is not valid.";
+ qCCritical(KGET_DEBUG) << "Unknown error when trying to load the .metalink-file. Metalink is not valid.";
setStatus(Job::Aborted);
setTransferChange(Tc_Status, true);
return false;
@@ -195,7 +198,7 @@ bool MetalinkXml::metalinkInit(const QUrl &src, const QByteArray &data)
if (!m_dataSourceFactory.size()) {
//TODO make this via log in the future + do not display the KMessageBox
- kWarning(5001) << "Download of" << m_source << "failed, no working URLs were found.";
+ qCWarning(KGET_DEBUG) << "Download of" << m_source << "failed, no working URLs were found.";
KMessageBox::error(0, i18n("Download failed, no working URLs were found."), i18n("Error"));
setStatus(Job::Aborted);
setTransferChange(Tc_Status, true);
diff --git a/transfer-plugins/mirrorsearch/CMakeLists.txt b/transfer-plugins/mirrorsearch/CMakeLists.txt
index c96d7d6..4aa64f4 100644
--- a/transfer-plugins/mirrorsearch/CMakeLists.txt
+++ b/transfer-plugins/mirrorsearch/CMakeLists.txt
@@ -6,6 +6,7 @@ set(kget_mirrorsearchfactory_PART_SRCS
mirrors.cpp
mirrorsearchtransferdatasource.cpp
mirrorsearchfactory.cpp
+ ../../kget_debug.cpp
)
kconfig_add_kcfg_files(kget_mirrorsearchfactory_PART_SRCS mirrorsearchsettings.kcfgc)
@@ -21,6 +22,7 @@ install(FILES kget_mirrorsearchfactory.kcfg DESTINATION ${KCFG_INSTALL_DIR})
###Build KCM-Module
set(kcm_kget_mirrorsearchfactory_PART_SRCS
dlgmirrorsearch.cpp
+ ../../kget_debug.cpp
)
ki18n_wrap_ui(kcm_kget_mirrorsearchfactory_PART_SRCS
diff --git a/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp b/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp
index 5f7fe99..517eaa9 100644
--- a/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp
+++ b/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp
@@ -13,7 +13,8 @@
#include "kget_export.h"
#include "mirrorsearchsettings.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <KLocale>
DlgEngineEditing::DlgEngineEditing(QWidget *parent)
@@ -133,7 +134,7 @@ void DlgSettingsWidget::saveSearchEnginesSettings()
void DlgSettingsWidget::save()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
saveSearchEnginesSettings();
MirrorSearchSettings::self()->save();
diff --git a/transfer-plugins/mirrorsearch/mirrors.cpp b/transfer-plugins/mirrorsearch/mirrors.cpp
index b2f93fb..7067ab6 100644
--- a/transfer-plugins/mirrorsearch/mirrors.cpp
+++ b/transfer-plugins/mirrorsearch/mirrors.cpp
@@ -11,7 +11,8 @@
#include "mirrors.h"
#include "mirrorsearchsettings.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
mirror::mirror()
{
@@ -21,7 +22,7 @@ mirror::mirror()
void mirror::search(const QUrl &url, QObject *receiver, const char *member)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
m_url = url;
if (m_url.path() != m_url.fileName())
@@ -34,7 +35,7 @@ void mirror::search(const QUrl &url, QObject *receiver, const char *member)
void mirror::search(const QString &fileName, QObject *receiver, const char *member)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
QUrl search(m_search_engine.replace("${filename}",fileName));
m_job = KIO::get(search, KIO::NoReload, KIO::HideProgressInfo);
@@ -47,7 +48,7 @@ void mirror::search(const QString &fileName, QObject *receiver, const char *memb
void mirror::slotData(KIO::Job *, const QByteArray& data)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (data.size() == 0)
return;
m_data.append(data);
@@ -55,7 +56,7 @@ void mirror::slotData(KIO::Job *, const QByteArray& data)
void mirror::slotResult( KJob *job )
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
m_job = 0;
int minUrlsNeeded = static_cast<int>(!m_Urls.isEmpty());
@@ -78,7 +79,7 @@ void mirror::slotResult( KJob *job )
if ( u.endsWith( '/' + m_url.fileName() ) )
{
m_Urls << QUrl(u);
- kDebug(5001) << "url: " << u;
+ qCDebug(KGET_DEBUG) << "url: " << u;
}
}
diff --git a/transfer-plugins/mirrorsearch/mirrorsearchfactory.cpp b/transfer-plugins/mirrorsearch/mirrorsearchfactory.cpp
index 2f4eec1..bb79b83 100644
--- a/transfer-plugins/mirrorsearch/mirrorsearchfactory.cpp
+++ b/transfer-plugins/mirrorsearch/mirrorsearchfactory.cpp
@@ -14,9 +14,10 @@
#include "core/scheduler.h"
#include "core/transfergroup.h"
-#include <QDomElement>
+#include "kget_debug.h"
+#include <qdebug.h>
-#include <kdebug.h>
+#include <QDomElement>
//PORT QT5 KGET_EXPORT_PLUGIN( MirrorSearchFactory )
@@ -31,7 +32,7 @@ MirrorSearchFactory::~MirrorSearchFactory()
TransferDataSource *MirrorSearchFactory::createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (type.attribute("type") == "search") {
return new MirrorSearchTransferDataSource(srcUrl, parent);
diff --git a/transfer-plugins/mirrorsearch/mirrorsearchtransferdatasource.cpp b/transfer-plugins/mirrorsearch/mirrorsearchtransferdatasource.cpp
index 43e5724..b1d0ddc 100644
--- a/transfer-plugins/mirrorsearch/mirrorsearchtransferdatasource.cpp
+++ b/transfer-plugins/mirrorsearch/mirrorsearchtransferdatasource.cpp
@@ -10,32 +10,34 @@
#include "mirrorsearchtransferdatasource.h"
#include "mirrors.h"
-#include <kdebug.h>
+
+#include "kget_debug.h"
+#include <qdebug.h>
MirrorSearchTransferDataSource::MirrorSearchTransferDataSource(const QUrl &srcUrl, QObject *parent)
: TransferDataSource(srcUrl, parent)
{
m_filename = m_sourceUrl.fileName();
- kDebug(5001) << m_filename;
+ qCDebug(KGET_DEBUG) << m_filename;
}
void MirrorSearchTransferDataSource::start()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if(!m_filename.isEmpty())
MirrorSearch (m_filename, this, SLOT(slotSearchUrls(QList<QUrl>&)));
}
void MirrorSearchTransferDataSource::stop()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
}
void MirrorSearchTransferDataSource::addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
{
Q_UNUSED(segmentSize)
Q_UNUSED(segmentRange)
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
}
void MirrorSearchTransferDataSource::slotSearchUrls(QList<QUrl>& Urls)
diff --git a/transfer-plugins/mmsthreads/CMakeLists.txt b/transfer-plugins/mmsthreads/CMakeLists.txt
index ea57e4d..ff3748f 100755
--- a/transfer-plugins/mmsthreads/CMakeLists.txt
+++ b/transfer-plugins/mmsthreads/CMakeLists.txt
@@ -8,6 +8,7 @@ set(kget_mmsfactory_PART_SRCS
mmstransfer.cpp
mmstransferfactory.cpp
mmsthread.cpp
+ ../../kget_debug.cpp
)
kconfig_add_kcfg_files(kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
@@ -22,6 +23,7 @@ install(FILES kget_mmsfactory.kcfg DESTINATION ${KCFG_INSTALL_DIR})
###Build KCM-Module
set(kcm_kget_mmsfactory_PART_SRCS
dlgmms.cpp
+ ../../kget_debug.cpp
)
ki18n_wrap_ui(kcm_kget_mmsfactory_PART_SRCS
diff --git a/transfer-plugins/mmsthreads/mmstransfer.cpp b/transfer-plugins/mmsthreads/mmstransfer.cpp
index 1d46935..d8c236c 100755
--- a/transfer-plugins/mmsthreads/mmstransfer.cpp
+++ b/transfer-plugins/mmsthreads/mmstransfer.cpp
@@ -19,6 +19,10 @@
#include "mmstransfer.h"
+
+#include "kget_debug.h"
+#include <qdebug.h>
+
MmsTransfer::MmsTransfer(TransferGroup * parent, TransferFactory * factory,
Scheduler * scheduler, const KUrl & source, const
KUrl &dest, const QDomElement * e)
@@ -28,7 +32,7 @@ MmsTransfer::MmsTransfer(TransferGroup * parent, TransferFactory * factory,
m_retryDownload(false)
{
m_fileTemp = KStandardDirs::locateLocal("appdata", m_dest.fileName());
- kDebug(5001) << "Mms transfer initialized: " + m_source.toString();
+ qCDebug(KGET_DEBUG) << "Mms transfer initialized: " + m_source.toString();
}
MmsTransfer::~MmsTransfer()
diff --git a/transfer-plugins/mmsthreads/mmstransferfactory.cpp b/transfer-plugins/mmsthreads/mmstransferfactory.cpp
index a8af876..002a788 100755
--- a/transfer-plugins/mmsthreads/mmstransferfactory.cpp
+++ b/transfer-plugins/mmsthreads/mmstransferfactory.cpp
@@ -21,7 +21,8 @@
#include "mmssettings.h"
#include "mmstransfer.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
//KGET_EXPORT_PLUGIN( MmsTransferFactory )
@@ -37,10 +38,10 @@ Transfer * MmsTransferFactory::createTransfer( const KUrl &srcUrl, const KUrl &d
Scheduler * scheduler,
const QDomElement * e )
{
- kDebug(5001) << "MmsTransferFactory::createTransfer";
+ qCDebug(KGET_DEBUG) << "MmsTransferFactory::createTransfer";
QString prot = srcUrl.protocol();
- kDebug(5001) << "Protocol = " << prot;
+ qCDebug(KGET_DEBUG) << "Protocol = " << prot;
if (prot == "mms" || prot == "mmsh") {
return new MmsTransfer(parent, this, scheduler, srcUrl, destUrl, e);
}
@@ -62,7 +63,7 @@ const QList<QAction *> MmsTransferFactory::actions(TransferHandler *handler)
bool MmsTransferFactory::isSupported(const KUrl &url) const
{
QString prot = url.protocol();
- kDebug(5001) << "Protocol = " << prot;
+ qCDebug(KGET_DEBUG) << "Protocol = " << prot;
return (prot == "mms" || prot == "mmsh");
}
diff --git a/transfer-plugins/multisegmentkio/CMakeLists.txt b/transfer-plugins/multisegmentkio/CMakeLists.txt
index 5517f2b..d5e7286 100644
--- a/transfer-plugins/multisegmentkio/CMakeLists.txt
+++ b/transfer-plugins/multisegmentkio/CMakeLists.txt
@@ -7,6 +7,7 @@ set(kget_multisegkiofactory_PART_SRCS
multisegkiodatasource.cpp
transfermultisegkio.cpp
transfermultisegkiofactory.cpp
+ ../../kget_debug.cpp
)
kconfig_add_kcfg_files(kget_multisegkiofactory_PART_SRCS multisegkiosettings.kcfgc)
@@ -22,6 +23,7 @@ install(FILES kget_multisegkiofactory.kcfg DESTINATION ${KCFG_INSTALL_DIR})
###Build KCM-Module
set(kcm_kget_multisegkiofactory_PART_SRCS
dlgmultisegkio.cpp
+ ../../kget_debug.cpp
)
ki18n_wrap_ui(kcm_kget_multisegkiofactory_PART_SRCS
diff --git a/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp b/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp
index 2201a82..7db2ebe 100644
--- a/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp
+++ b/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp
@@ -13,7 +13,8 @@
#include "segment.h"
#include "core/transfer.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
MultiSegKioDataSource::MultiSegKioDataSource(const QUrl &srcUrl, QObject *parent)
: TransferDataSource(srcUrl, parent),
@@ -21,18 +22,18 @@ MultiSegKioDataSource::MultiSegKioDataSource(const QUrl &srcUrl, QObject *parent
m_canResume(false),
m_started(false)
{
- kDebug(5001) << "Create MultiSegKioDataSource for" << m_sourceUrl << this;
+ qCDebug(KGET_DEBUG) << "Create MultiSegKioDataSource for" << m_sourceUrl << this;
setCapabilities(capabilities() | Transfer::Cap_FindFilesize);
}
MultiSegKioDataSource::~MultiSegKioDataSource()
{
- kDebug(5001) << this;
+ qCDebug(KGET_DEBUG) << this;
}
void MultiSegKioDataSource::start()
{
- kDebug(5001) << this;
+ qCDebug(KGET_DEBUG) << this;
m_started = true;
foreach (Segment *segment, m_segments)
@@ -43,13 +44,13 @@ void MultiSegKioDataSource::start()
void MultiSegKioDataSource::stop()
{
- kDebug(5001) << this << m_segments.count() << "segments stopped.";
+ qCDebug(KGET_DEBUG) << this << m_segments.count() << "segments stopped.";
m_started = false;
foreach (Segment *segment, m_segments)
{
if (segment->findingFileSize()) {
- kDebug(5001) << "Removing findingFileSize segment" << this;
+ qCDebug(KGET_DEBUG) << "Removing findingFileSize segment" << this;
m_segments.removeAll(segment);
segment->deleteLater();
} else {
@@ -127,7 +128,7 @@ void MultiSegKioDataSource::setSupposedSize(KIO::filesize_t supposedSize)
void MultiSegKioDataSource::slotTotalSize(KIO::filesize_t size, const QPair<int, int> &range)
{
- kDebug(5001) << "Size found for" << m_sourceUrl << size << "bytes";
+ qCDebug(KGET_DEBUG) << "Size found for" << m_sourceUrl << size << "bytes";
m_size = size;
@@ -139,14 +140,14 @@ void MultiSegKioDataSource::slotTotalSize(KIO::filesize_t size, const QPair<int,
//the filesize is not what it should be, maybe using a wrong mirror
if (m_size && m_supposedSize && (m_size != m_supposedSize))
{
- kDebug(5001) << "Size does not match for" << m_sourceUrl << this;
+ qCDebug(KGET_DEBUG) << "Size does not match for" << m_sourceUrl << this;
emit broken(this, WrongDownloadSize);
}
}
void MultiSegKioDataSource::slotCanResume()
{
- kDebug(5001) << this;
+ qCDebug(KGET_DEBUG) << this;
if (!m_canResume) {
m_canResume = true;
@@ -225,7 +226,7 @@ bool MultiSegKioDataSource::tryMerge(const QPair<KIO::fileoffset_t, KIO::fileoff
void MultiSegKioDataSource::slotError(Segment *segment, const QString &errorText, Transfer::LogLevel logLevel)
{
- kDebug(5001) << "Error" << errorText << "segment" << segment;
+ qCDebug(KGET_DEBUG) << "Error" << errorText << "segment" << segment;
const QPair<KIO::fileoffset_t, KIO::fileoffset_t> size = segment->segmentSize();
const QPair<int, int> range = segment->assignedSegments();
@@ -234,14 +235,14 @@ void MultiSegKioDataSource::slotError(Segment *segment, const QString &errorText
emit log(errorText, logLevel);
if (m_segments.isEmpty()) {
- kDebug(5001) << this << "has broken segments.";
+ qCDebug(KGET_DEBUG) << this << "has broken segments.";
emit brokenSegments(this, range);
} else {
//decrease the number of maximum paralell downloads, maybe the server does not support so many connections
if (m_paralellSegments > 1) {
--m_paralellSegments;
}
- kDebug(5001) << this << "reducing connections to" << m_paralellSegments << "and freeing range of semgents" << range;
+ qCDebug(KGET_DEBUG) << this << "reducing connections to" << m_paralellSegments << "and freeing range of semgents" << range;
if (!tryMerge(size, range)) {
emit freeSegments(this, range);
}
@@ -256,7 +257,7 @@ void MultiSegKioDataSource::slotFinishedDownload(KIO::filesize_t size)
void MultiSegKioDataSource::slotRestartBrokenSegment()
{
- kDebug(5001) << this;
+ qCDebug(KGET_DEBUG) << this;
start();
}
diff --git a/transfer-plugins/multisegmentkio/segment.cpp b/transfer-plugins/multisegmentkio/segment.cpp
index 465e9c9..3fc0d78 100644
--- a/transfer-plugins/multisegmentkio/segment.cpp
+++ b/transfer-plugins/multisegmentkio/segment.cpp
@@ -14,7 +14,8 @@
#include <cmath>
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <KLocale>
#include <QTimer>
@@ -54,7 +55,7 @@ Segment::~Segment()
{
if (m_getJob)
{
- kDebug(5001) << "Closing transfer ...";
+ qCDebug(KGET_DEBUG) << "Closing transfer ...";
m_getJob->kill(KJob::Quietly);
}
}
@@ -66,7 +67,7 @@ bool Segment::findingFileSize() const
bool Segment::createTransfer()
{
- kDebug(5001) << " -- " << m_url;
+ qCDebug(KGET_DEBUG) << " -- " << m_url;
if ( m_getJob )
return false;
@@ -105,7 +106,7 @@ void Segment::slotCanResume( KIO::Job* job, KIO::filesize_t offset )
{
Q_UNUSED(job)
Q_UNUSED(offset)
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
m_canResume = true;
emit canResume();
}
@@ -113,7 +114,7 @@ void Segment::slotCanResume( KIO::Job* job, KIO::filesize_t offset )
void Segment::slotTotalSize(KJob *job, qulonglong size)
{
Q_UNUSED(job)
- kDebug(5001) << "Size found for" << m_url;
+ qCDebug(KGET_DEBUG) << "Size found for" << m_url;
if (m_findFilesize) {
int numSegments = size / m_segSize.first;
@@ -138,7 +139,7 @@ void Segment::slotTotalSize(KJob *job, qulonglong size)
bool Segment::startTransfer ()
{
- kDebug(5001) << m_url;
+ qCDebug(KGET_DEBUG) << m_url;
if (!m_getJob) {
createTransfer();
}
@@ -152,7 +153,7 @@ bool Segment::startTransfer ()
bool Segment::stopTransfer()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
setStatus(Stopped, false);
if (m_getJob) {
@@ -166,7 +167,7 @@ bool Segment::stopTransfer()
void Segment::slotResult( KJob *job )
{
- kDebug(5001) << "Job:" << job << m_url << "error:" << job->error();
+ qCDebug(KGET_DEBUG) << "Job:" << job << m_url << "error:" << job->error();
m_getJob = 0;
@@ -178,7 +179,7 @@ void Segment::slotResult( KJob *job )
if ( !m_buffer.isEmpty() )
{
if (m_findFilesize && !job->error()) {
- kDebug(5001) << "Looping until write the buffer ..." << m_url;
+ qCDebug(KGET_DEBUG) << "Looping until write the buffer ..." << m_url;
slotWriteRest();
return;
}
@@ -202,7 +203,7 @@ void Segment::slotData(KIO::Job *, const QByteArray& _data)
// Check if the transfer allows resuming...
if (m_offset && !m_canResume)
{
- kDebug(5001) << m_url << "does not allow resuming.";
+ qCDebug(KGET_DEBUG) << m_url << "does not allow resuming.";
stopTransfer();
setStatus(Killed, false );
const QString errorText = KIO::buildErrorString(KIO::ERR_CANNOT_RESUME, m_url.toString());
@@ -213,7 +214,7 @@ void Segment::slotData(KIO::Job *, const QByteArray& _data)
m_buffer.append(_data);
if (!m_findFilesize && m_totalBytesLeft && static_cast<uint>(m_buffer.size()) >= m_totalBytesLeft)
{
- kDebug(5001) << "Segment::slotData() buffer full. stoping transfer...";//TODO really stop it? is this even needed?
+ qCDebug(KGET_DEBUG) << "Segment::slotData() buffer full. stoping transfer...";//TODO really stop it? is this even needed?
if (m_getJob) {
m_getJob->kill(KJob::Quietly);
m_getJob = 0;
@@ -235,7 +236,7 @@ void Segment::slotData(KIO::Job *, const QByteArray& _data)
bool Segment::writeBuffer()
{
- kDebug(5001) << "Segment::writeBuffer() sending:" << m_buffer.size() << "from job:" << m_getJob;
+ qCDebug(KGET_DEBUG) << "Segment::writeBuffer() sending:" << m_buffer.size() << "from job:" << m_getJob;
if (m_buffer.isEmpty()) {
return false;
}
@@ -251,7 +252,7 @@ bool Segment::writeBuffer()
m_offset += m_buffer.size();
m_bytesWritten += m_buffer.size();
m_buffer.clear();
- kDebug(5001) << "Segment::writeBuffer() updating segment record of job:" << m_getJob << "--" << m_totalBytesLeft << "bytes left";
+ qCDebug(KGET_DEBUG) << "Segment::writeBuffer() updating segment record of job:" << m_getJob << "--" << m_totalBytesLeft << "bytes left";
}
//finding filesize, so no segments defined yet
@@ -280,7 +281,7 @@ void Segment::slotWriteRest()
if (m_buffer.isEmpty()) {
return;
}
- kDebug() << this;
+ qCDebug(KGET_DEBUG) << this;
if (writeBuffer()) {
m_errorCount = 0;
@@ -291,10 +292,10 @@ void Segment::slotWriteRest()
}
if (++m_errorCount >= 100) {
- kWarning() << "Failed to write to the file:" << m_url << this;
+ qWarning() << "Failed to write to the file:" << m_url << this;
emit error(this, i18n("Failed to write to the file."), Transfer::Log_Error);
} else {
- kDebug() << "Wait 50 msec:" << this;
+ qCDebug(KGET_DEBUG) << "Wait 50 msec:" << this;
QTimer::singleShot(50, this, SLOT(slotWriteRest()));
}
}
@@ -333,7 +334,7 @@ QPair<int, int> Segment::split()
if (!free)
{
- kDebug(5001) << "None freed, start:" << m_currentSegment << "end:" << m_endSegment;
+ qCDebug(KGET_DEBUG) << "None freed, start:" << m_currentSegment << "end:" << m_endSegment;
if (m_getJob)
{
@@ -344,7 +345,7 @@ QPair<int, int> Segment::split()
const int newEnd = m_endSegment - free;
freed = QPair<int, int>(newEnd + 1, m_endSegment);
- kDebug(5001) << "Start:" << m_currentSegment << "old end:" << m_endSegment << "new end:" << newEnd << "freed:" << freed;
+ qCDebug(KGET_DEBUG) << "Start:" << m_currentSegment << "old end:" << m_endSegment << "new end:" << newEnd << "freed:" << freed;
m_endSegment = newEnd;
m_totalBytesLeft -= m_segSize.first * (free - 1) + m_segSize.second;
diff --git a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
index 67492e9..c488d5a 100644
--- a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
+++ b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
@@ -21,12 +21,13 @@
#include <utime.h>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <kiconloader.h>
#include <KIO/CopyJob>
#include <KIO/NetAccess>
#include <klocale.h>
#include <KMessageBox>
-#include <kdebug.h>
#include <QDomElement>
#include <QFile>
@@ -70,7 +71,7 @@ void TransferMultiSegKio::deinit(Transfer::DeleteOptions options)
void TransferMultiSegKio::start()
{
- kDebug(5001) << "Start TransferMultiSegKio";
+ qCDebug(KGET_DEBUG) << "Start TransferMultiSegKio";
if (status() == Running) {
return;
}
@@ -94,7 +95,7 @@ void TransferMultiSegKio::start()
void TransferMultiSegKio::stop()
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if ((status() == Stopped) || (status() == Finished)) {
return;
@@ -129,7 +130,7 @@ bool TransferMultiSegKio::setDirectory(const QUrl& newDirectory)
bool TransferMultiSegKio::setNewDestination(const QUrl &newDestination)
{
- kDebug(5001) << "New destination: " << newDestination;
+ qCDebug(KGET_DEBUG) << "New destination: " << newDestination;
if (newDestination.isValid() && (newDestination != dest()) && m_dataSourceFactory)
{
m_movingFile = true;
@@ -151,7 +152,7 @@ bool TransferMultiSegKio::setNewDestination(const QUrl &newDestination)
void TransferMultiSegKio::load(const QDomElement *element)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
Transfer::load(element);
m_dataSourceFactory->load(element);
@@ -159,7 +160,7 @@ void TransferMultiSegKio::load(const QDomElement *element)
void TransferMultiSegKio::save(const QDomElement &element)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
Transfer::save(element);
m_dataSourceFactory->save(element);
}
@@ -234,7 +235,7 @@ void TransferMultiSegKio::slotDataSourceFactoryChange(Transfer::ChangesFlags cha
m_percent = m_dataSourceFactory->percent();
}
if (change & Tc_DownloadSpeed) {
- kDebug(5001) << "speed:" << m_downloadSpeed;
+ qCDebug(KGET_DEBUG) << "speed:" << m_downloadSpeed;
m_downloadSpeed = m_dataSourceFactory->currentSpeed();
}
@@ -281,7 +282,7 @@ void TransferMultiSegKio::slotStatResult(KJob* kioJob)
void TransferMultiSegKio::slotSearchUrls(const QList<QUrl> &urls)
{
- kDebug(5001) << "Found " << urls.size() << " urls.";
+ qCDebug(KGET_DEBUG) << "Found " << urls.size() << " urls.";
foreach (const QUrl &url, urls)
{
diff --git a/transfer-plugins/multisegmentkio/transfermultisegkiofactory.cpp b/transfer-plugins/multisegmentkio/transfermultisegkiofactory.cpp
index f8c8659..b89570b 100644
--- a/transfer-plugins/multisegmentkio/transfermultisegkiofactory.cpp
+++ b/transfer-plugins/multisegmentkio/transfermultisegkiofactory.cpp
@@ -19,7 +19,8 @@
#include <QDomElement>
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
#include "kget_macro.h"
//PORT QT5 KGET_EXPORT_PLUGIN( TransferMultiSegKioFactory )
@@ -38,7 +39,7 @@ Transfer * TransferMultiSegKioFactory::createTransfer( const KUrl &srcUrl, const
Scheduler * scheduler,
const QDomElement * e )
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
if (isSupported(srcUrl) && (!e || !e->firstChildElement("factories").isNull()))
{
@@ -66,7 +67,7 @@ const QList<QAction *> TransferMultiSegKioFactory::actions(TransferHandler *hand
TransferDataSource * TransferMultiSegKioFactory::createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent)
{
- kDebug(5001);
+ qCDebug(KGET_DEBUG);
//only use this TransferDataSource if no type is specified and the protocolls match
if (!type.attribute("type").isEmpty())
@@ -84,7 +85,7 @@ const QList<QAction *> TransferMultiSegKioFactory::actions(TransferHandler *hand
bool TransferMultiSegKioFactory::isSupported(const KUrl &url) const
{
QString prot = url.protocol();
- kDebug(5001) << "Protocol = " << prot;
+ qCDebug(KGET_DEBUG) << "Protocol = " << prot;
return addsProtocols().contains(prot);
}
diff --git a/ui/history/transferhistory.cpp b/ui/history/transferhistory.cpp
index bb75b4e..85dcaf7 100644
--- a/ui/history/transferhistory.cpp
+++ b/ui/history/transferhistory.cpp
@@ -17,6 +17,8 @@
#include "core/transferhistorystore.h"
#include "core/job.h"
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QDateTime>
#include <QFile>
#include <QFileSystemWatcher>
@@ -85,7 +87,7 @@ TransferHistory::TransferHistory(QWidget *parent)
watcher = new QFileSystemWatcher();
watcher->addPath(KStandardDirs::locateLocal("appdata", QString()));
- kDebug(5001) << watcher->directories();
+ qCDebug(KGET_DEBUG) << watcher->directories();
m_store = TransferHistoryStore::getStore();
diff --git a/ui/linkview/kget_linkview.cpp b/ui/linkview/kget_linkview.cpp
index 1dee1c8..ac203fd 100644
--- a/ui/linkview/kget_linkview.cpp
+++ b/ui/linkview/kget_linkview.cpp
@@ -17,6 +17,8 @@
#include "core/linkimporter.h"
#include "ui/newtransferdialog.h"
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QApplication>
#include <QClipboard>
#include <QMenu>
@@ -181,7 +183,7 @@ void KGetLinkView::showLinks(const QStringList &links, bool urlRequestVisible)
mt = KMimeType::findByUrl(linkitem, 0, true, true);
}
- kDebug(5001) << "Adding:" << linkitem;
+ qCDebug(KGET_DEBUG) << "Adding:" << linkitem;
QString file = url.fileName();
if (file.isEmpty())
diff --git a/ui/metalinkcreator/metalinker.cpp b/ui/metalinkcreator/metalinker.cpp
index c54e09f..06cfe95 100644
--- a/ui/metalinkcreator/metalinker.cpp
+++ b/ui/metalinkcreator/metalinker.cpp
@@ -24,6 +24,9 @@
#include <QTextStream>
#include <QDomElement>
+#include "kget_debug.h"
+#include <qdebug.h>
+
#include <kdeversion.h>
#include <KDebug>
#include <KLocale>
@@ -605,18 +608,18 @@ void KGetMetalink::File::clear()
bool KGetMetalink::File::isValidNameAttribute() const
{
if (name.isEmpty()) {
- kError(5001) << "Name attribute of Metalink::File is empty.";
+ qCCritical(KGET_DEBUG) << "Name attribute of Metalink::File is empty.";
return false;
}
if (name.endsWith('/')) {
- kError(5001) << "Name attribute of Metalink::File does not contain a file name:" << name;
+ qCCritical(KGET_DEBUG) << "Name attribute of Metalink::File does not contain a file name:" << name;
return false;
}
const QStringList components = name.split('/');
if (name.startsWith('/') || components.contains("..") || components.contains(".")) {
- kError(5001) << "Name attribute of Metalink::File contains directory traversal directives:" << name;
+ qCCritical(KGET_DEBUG) << "Name attribute of Metalink::File contains directory traversal directives:" << name;
return false;
}
@@ -648,7 +651,7 @@ bool KGetMetalink::Files::isValid() const
while (!fileNames.isEmpty()) {
const QString fileName = fileNames.takeFirst();
if (fileNames.contains(fileName)) {
- kError(5001) << "Metalink::File name" << fileName << "exists multiple times.";
+ qCCritical(KGET_DEBUG) << "Metalink::File name" << fileName << "exists multiple times.";
return false;
}
}
@@ -955,7 +958,7 @@ KGetMetalink::DateConstruct KGetMetalink::Metalink_v3::parseDateConstruct(const
return dateConstruct;
}
- kDebug(5001) << "Parsing" << data;
+ qCDebug(KGET_DEBUG) << "Parsing" << data;
QString temp = data;
QDateTime dateTime;
diff --git a/ui/newtransferdialog.cpp b/ui/newtransferdialog.cpp
index e985a8c..e3350cd 100644
--- a/ui/newtransferdialog.cpp
+++ b/ui/newtransferdialog.cpp
@@ -23,6 +23,9 @@
#include "core/urlchecker.h"
#include "settings.h"
+#include "kget_debug.h"
+#include <qdebug.h>
+
#include <QApplication>
#include <QClipboard>
#include <QDir>
@@ -32,7 +35,6 @@
#include <KLocale>
#include <QListWidgetItem>
#include <KColorScheme>
-#include <KDebug>
#include <KWindowSystem>
#include <QStandardPaths>
@@ -164,7 +166,7 @@ void NewTransferDialog::setSource(const QList<QUrl> &sources)
} else {
foreach (const QUrl &sourceUrl, sources) {
if (sourceUrl.url() != QUrl(sourceUrl.url()).fileName()) {//TODO simplify, whatfor is this check anyway, shouldn't the sources be checked already and if not add this to UrlChecker
- kDebug(5001) << "Insert" << sourceUrl;
+ qCDebug(KGET_DEBUG) << "Insert" << sourceUrl;
QListWidgetItem *newItem = new QListWidgetItem(sourceUrl.toString(), ui.listWidget);
newItem->setCheckState(Qt::Checked);
}
@@ -217,7 +219,7 @@ void NewTransferDialog::showDialog(QList<QUrl> list, const QString &suggestedFil
m_sources << list;
UrlChecker::removeDuplicates(m_sources);
const int size = m_sources.size();
- kDebug(5001) << "SET SOURCES " << m_sources << " MULTIPLE " << (size > 1);
+ qCDebug(KGET_DEBUG) << "SET SOURCES " << m_sources << " MULTIPLE " << (size > 1);
setMultiple(size > 1);
if (size) {
@@ -254,7 +256,7 @@ void NewTransferDialog::prepareDialog()
KWindowSystem::forceActiveWindow(m_window->winId());
}*/
- kDebug(5001) << "Show the dialog!";
+ qCDebug(KGET_DEBUG) << "Show the dialog!";
show();
}
@@ -380,7 +382,7 @@ void NewTransferDialog::checkInput()
enableButtonOk((folderValid || destinationValid) && sourceValid);
}
- kDebug(5001) << source << source.fileName() << dest << dest.fileName() << "Folder valid:" << folderValid
+ qCDebug(KGET_DEBUG) << source << source.fileName() << dest << dest.fileName() << "Folder valid:" << folderValid
<< "Destination valid:" << destinationValid << "Source valid:" << sourceValid;
}
@@ -394,11 +396,11 @@ void NewTransferDialog::slotFinished(int resultCode)
void NewTransferDialog::dialogAccepted()
{
- kDebug(5001) << "Dialog accepted.";
+ qCDebug(KGET_DEBUG) << "Dialog accepted.";
//an existing transfer has been specified and since ok was clicked, it was chosen to be overwritten
if (m_existingTransfer) {
- kDebug(5001) << "Removing existing transfer:" << m_existingTransfer;
+ qCDebug(KGET_DEBUG) << "Removing existing transfer:" << m_existingTransfer;
KGet::delTransfer(m_existingTransfer);
}
@@ -416,7 +418,7 @@ void NewTransferDialog::dialogAccepted()
QList<KGet::TransferData> data;
if (!m_multiple) {
if (m_overWriteSingle) {
- kDebug(5001) << "Removing existing file:" << m_destination;
+ qCDebug(KGET_DEBUG) << "Removing existing file:" << m_destination;
//removes m_destination if it exists, do that here so that it is removed no matter if a transfer could be created or not
//as the user decided to throw the file away
FileDeleter::deleteFile(m_destination);
@@ -424,7 +426,7 @@ void NewTransferDialog::dialogAccepted()
//sourceUrl is valid, has been checked before
const QUrl sourceUrl = QUrl(ui.urlRequester->text().trimmed());
- kDebug(5001) << "Downloading" << sourceUrl << "to" << m_destination;
+ qCDebug(KGET_DEBUG) << "Downloading" << sourceUrl << "to" << m_destination;
data << KGet::TransferData(sourceUrl, m_destination, group);
} else {
QList<QUrl> list;
@@ -436,11 +438,11 @@ void NewTransferDialog::dialogAccepted()
//both sourceUrl and destUrl are valid, they have been tested in checkInput
const QUrl sourceUrl = QUrl(item->text().trimmed());
const QUrl destUrl = UrlChecker::destUrl(m_destination, sourceUrl);
- kDebug(5001) << "Downloading" << sourceUrl << "to" << destUrl;
+ qCDebug(KGET_DEBUG) << "Downloading" << sourceUrl << "to" << destUrl;
//file exists already, remove it
if (item->background() == m_existingFileBackground) {
- kDebug(5001) << "Removing existing file:" << destUrl;
+ qCDebug(KGET_DEBUG) << "Removing existing file:" << destUrl;
//removes destUrl if it exists, do that here so that it is removed no matter if a transfer could be created or not
//as the user decided to throw the file away
FileDeleter::deleteFile(destUrl);
@@ -579,7 +581,7 @@ void NewTransferDialogHandler::slotMostLocalUrlResult(KJob *j)
const int jobId = job->property("jobId").toInt();
if (job->error()) {
- kWarning(5001) << "An error happened for" << job->url();
+ qCWarning(KGET_DEBUG) << "An error happened for" << job->url();
} else {
m_urls[jobId].urls << job->mostLocalUrl();
}
@@ -594,7 +596,7 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
{
QHash<int, UrlData>::iterator itUrls = m_urls.find(jobId);
if (itUrls == m_urls.end()) {
- kWarning(5001) << "JobId" << jobId << "was not defined, could not handle urls for it.";
+ qCWarning(KGET_DEBUG) << "JobId" << jobId << "was not defined, could not handle urls for it.";
return;
}
@@ -692,9 +694,9 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
}
///Now handle default folders/groups
- kDebug(5001) << "DIRECTORIES AS SUGGESTION" << Settings::directoriesAsSuggestion();
+ qCDebug(KGET_DEBUG) << "DIRECTORIES AS SUGGESTION" << Settings::directoriesAsSuggestion();
if (!Settings::directoriesAsSuggestion() && !urls.isEmpty()) {
- kDebug(5001) << "No, Directories not as suggestion";
+ qCDebug(KGET_DEBUG) << "No, Directories not as suggestion";
//find the associated groups first, we just need the first matching group though
const QList<TransferGroupHandler*> groups = KGet::allTransferGroups();
diff --git a/ui/signaturedlg.cpp b/ui/signaturedlg.cpp
index ae02024..868b142 100644
--- a/ui/signaturedlg.cpp
+++ b/ui/signaturedlg.cpp
@@ -24,6 +24,10 @@
#include "core/transferhandler.h"
#include "core/signature.h"
+
+#include "kget_debug.h"
+#include <qdebug.h>
+
#ifdef HAVE_QGPGME
#include <gpgme++/context.h>
#include <gpgme++/key.h>
@@ -104,11 +108,11 @@ void SignatureDlg::loadSignatureClicked()
QFile file(url.path());
if (!file.open(QIODevice::ReadOnly)) {
- kWarning(5001) << "Could not open file" << url;
+ qCWarning(KGET_DEBUG) << "Could not open file" << url;
return;
}
if (file.size() > 1 * 1024) {
- kWarning(5001) << "File is larger than 1 KiB, which is not supported.";
+ qCWarning(KGET_DEBUG) << "File is larger than 1 KiB, which is not supported.";
return;
}
@@ -173,14 +177,14 @@ void SignatureDlg::updateData()
GpgME::Error err = GpgME::checkEngine(GpgME::OpenPGP);
QScopedPointer<GpgME::Context> context(GpgME::Context::createForProtocol(GpgME::OpenPGP));
if (err) {
- kDebug(5001) << "OpenPGP not supported!";
+ qCDebug(KGET_DEBUG) << "OpenPGP not supported!";
} else if (!context.data()) {
- kDebug(5001) << "Could not create context.";
+ qCDebug(KGET_DEBUG) << "Could not create context.";
} else {
QByteArray fingerprint = fingerprintString.toAscii();
const GpgME::Key key = context->key(fingerprint.constData(), err);
if (err || key.isNull() || !key.numUserIDs() || !key.numSubkeys()) {
- kDebug(5001) << "There was an error while loading the key:" << err;
+ qCDebug(KGET_DEBUG) << "There was an error while loading the key:" << err;
} else {
if (key.isRevoked()) {
information << i18n("The key has been revoked.");
diff --git a/ui/transferdetails.cpp b/ui/transferdetails.cpp
index d706088..9063ce7 100644
--- a/ui/transferdetails.cpp
+++ b/ui/transferdetails.cpp
@@ -14,7 +14,9 @@
#include <klocale.h>
#include <kio/global.h>
-#include <kdebug.h>
+
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QVBoxLayout>
@@ -57,7 +59,7 @@ QWidget *TransferDetails::detailsWidget(TransferHandler *handler)
void TransferDetails::slotTransferChanged(TransferHandler * transfer, TransferHandler::ChangesFlags flags)
{
- kDebug(5001) << "TransferDetails::slotTransferChanged";
+ qCDebug(KGET_DEBUG) << "TransferDetails::slotTransferChanged";
Q_UNUSED(transfer)
diff --git a/ui/transfersview.cpp b/ui/transfersview.cpp
index 5a5160e..6940df9 100644
--- a/ui/transfersview.cpp
+++ b/ui/transfersview.cpp
@@ -16,7 +16,8 @@
#include "core/transfertreemodel.h"
#include "core/kget.h"
-#include <KDebug>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <QAction>
#include <KLocale>
#include <QMenu>
@@ -72,7 +73,7 @@ void TransfersView::setModel(QAbstractItemModel * model)
for(int i = 0; i < nGroups; i++)
{
- kDebug(5001) << "openEditor for row " << i;
+ qCDebug(KGET_DEBUG) << "openEditor for row " << i;
openPersistentEditor(model->index(i, TransferTreeModel::Status, QModelIndex()));
}
@@ -101,15 +102,15 @@ void TransfersView::dropEvent(QDropEvent * event)
void TransfersView::rowsInserted(const QModelIndex & parent, int start, int end)
{
- kDebug(5001) << "TransfersView::rowsInserted";
+ qCDebug(KGET_DEBUG) << "TransfersView::rowsInserted";
if(!parent.isValid())
{
- kDebug(5001) << "parent is not valid " << start << " " << end;
+ qCDebug(KGET_DEBUG) << "parent is not valid " << start << " " << end;
for(int i = start; i <= end; i++)
{
- kDebug(5001) << "openEditor for row " << i;
+ qCDebug(KGET_DEBUG) << "openEditor for row " << i;
openPersistentEditor(model()->index(i, TransferTreeModel::Status, parent));
}
}
@@ -239,7 +240,7 @@ void TransfersView::slotItemCollapsed(const QModelIndex & index)
QList<TransferHandler *> transfers = groupHandler->transfers();
foreach(TransferHandler * transfer, transfers) {
- kDebug(5001) << "Transfer = " << transfer->source().toString();
+ qCDebug(KGET_DEBUG) << "Transfer = " << transfer->source().toString();
view_delegate->contractItem(KGet::model()->itemFromTransferHandler(transfer)->index());
}
}
diff --git a/ui/transfersviewdelegate.cpp b/ui/transfersviewdelegate.cpp
index c24793b..bc290c8 100644
--- a/ui/transfersviewdelegate.cpp
+++ b/ui/transfersviewdelegate.cpp
@@ -22,7 +22,8 @@
#include "core/transfertreeselectionmodel.h"
#include "settings.h"
-#include <kdebug.h>
+#include "kget_debug.h"
+#include <qdebug.h>
#include <klocale.h>
#include <QMenu>
#include <QIcon>
@@ -48,7 +49,7 @@ GroupStatusButton::GroupStatusButton(const QModelIndex & index, QWidget * parent
void GroupStatusButton::checkStateSet()
{
-// kDebug(5001) << "GroupStatusButton::checkStateSet";
+// qCDebug(KGET_DEBUG) << "GroupStatusButton::checkStateSet";
QToolButton::checkStateSet();
@@ -405,7 +406,7 @@ void TransfersViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem
/// These lines are just for testing purposes. Uncomment them to show on the view the repaint events.
// static int i=0;
-// kDebug(5001) << "paint!!! " << i++ << " " << index.internalPointer() << " " << index.column();
+// qCDebug(KGET_DEBUG) << "paint!!! " << i++ << " " << index.internalPointer() << " " << index.column();
//
// painter->drawRect(option.rect);
// painter->drawText(option.rect.topLeft(), QString::number(i));
@@ -427,7 +428,7 @@ QSize TransfersViewDelegate::sizeHint(const QStyleOptionViewItem & option, const
ModelItem *item = transferTreeModel->itemFromIndex(index);
if (!item) {
- kWarning(5001) << "Sizehint for non-existing item.";
+ qCWarning(KGET_DEBUG) << "Sizehint for non-existing item.";
return QSize();
}
@@ -452,7 +453,7 @@ bool TransfersViewDelegate::editorEvent(QEvent * event, QAbstractItemModel * mod
QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::RightButton)
{
-// kDebug(5001) << "TransfersViewDelegate::editorEvent() -> rightClick";
+// qCDebug(KGET_DEBUG) << "TransfersViewDelegate::editorEvent() -> rightClick";
QMenu *popup = 0;
@@ -461,14 +462,14 @@ bool TransfersViewDelegate::editorEvent(QEvent * event, QAbstractItemModel * mod
ModelItem * item = transferTreeModel->itemFromIndex(index);
if (item->isGroup())
{
-// kDebug(5001) << "isTransferGroup = true";
+// qCDebug(KGET_DEBUG) << "isTransferGroup = true";
TransferGroupHandler * transferGroupHandler = item->asGroup()->groupHandler();
popup = ContextMenu::createTransferGroupContextMenu(transferGroupHandler, qobject_cast<QWidget*>(this));
}
else
{
-// kDebug(5001) << "isTransferGroup = false";
+// qCDebug(KGET_DEBUG) << "isTransferGroup = false";
TransferHandler * transferHandler = item->asTransfer()->transferHandler();
diff --git a/ui/tray.cpp b/ui/tray.cpp
index 9e7920a..b13e592 100644
--- a/ui/tray.cpp
+++ b/ui/tray.cpp
@@ -10,11 +10,14 @@
#include "ui/tray.h"
#include "mainwindow.h"
#include "ui/newtransferdialog.h"
+
+#include "kget_debug.h"
+#include <qdebug.h>
+
#include <kaboutdata.h>
#include <kactioncollection.h>
#include <kapplication.h>
#include <QMenu>
-#include <kdebug.h>
#include <klocale.h>
#include <QClipboard>
@@ -67,7 +70,7 @@ void Tray::slotActivated()
// switch between Active or Passive state
void Tray::setDownloading( bool downloading )
{
- kDebug(5001) << "Tray::setDownloading";
+ qCDebug(KGET_DEBUG) << "Tray::setDownloading";
if (downloading)
{