Port the kio from kDebug to qCDebug

Use custom area for the kio "kdeconnect.kio"
This commit is contained in:
Àlex Fiestas 2014-09-22 00:20:14 +02:00
parent 93054601b9
commit 3f24ccd39a
2 changed files with 12 additions and 7 deletions

View file

@ -24,7 +24,7 @@
#include <QtCore/QThread> #include <QtCore/QThread>
#include <QDBusMetaType> #include <QDBusMetaType>
#include <KDebug> #include <QDebug>
#include <KComponentData> #include <KComponentData>
#include <KCmdLineArgs> #include <KCmdLineArgs>
#include <KProcess> #include <KProcess>
@ -35,6 +35,8 @@
#include <core/kdebugnamespace.h> #include <core/kdebugnamespace.h>
Q_LOGGING_CATEGORY(KDECONNECT_KIO, "kdeconnect.kio")
extern "C" int KDE_EXPORT kdemain(int argc, char **argv) extern "C" int KDE_EXPORT kdemain(int argc, char **argv)
{ {
K4AboutData about("kiokdeconnect", "kdeconnect-kio", ki18n("kiokdeconnect"), "1.0"); K4AboutData about("kiokdeconnect", "kdeconnect-kio", ki18n("kiokdeconnect"), "1.0");
@ -75,7 +77,7 @@ bool handleDBusError(QDBusReply<T>& reply, KIO::SlaveBase* slave)
{ {
if (!reply.isValid()) if (!reply.isValid())
{ {
kDebug(debugArea()) << "Error in DBus request:" << reply.error(); qCDebug(KDECONNECT_KIO) << "Error in DBus request:" << reply.error();
slave->error(toKioError(reply.error().type()),reply.error().message()); slave->error(toKioError(reply.error().type()),reply.error().message());
return true; return true;
} }
@ -130,7 +132,7 @@ void KioKdeconnect::listDevice()
{ {
infoMessage(i18n("Accessing device...")); infoMessage(i18n("Accessing device..."));
kDebug(debugArea()) << "ListDevice" << m_currentDevice; qCDebug(KDECONNECT_KIO) << "ListDevice" << m_currentDevice;
SftpDbusInterface interface(m_currentDevice); SftpDbusInterface interface(m_currentDevice);
@ -185,7 +187,7 @@ void KioKdeconnect::listDevice()
void KioKdeconnect::listDir(const QUrl &url) void KioKdeconnect::listDir(const QUrl &url)
{ {
kDebug(debugArea()) << "Listing..." << url; qCDebug(KDECONNECT_KIO) << "Listing..." << url;
/// Url is not used here becuase all we could care about the url is the host, and that's already /// Url is not used here becuase all we could care about the url is the host, and that's already
/// handled in @p setHost /// handled in @p setHost
@ -207,7 +209,7 @@ void KioKdeconnect::listDir(const QUrl &url)
void KioKdeconnect::stat(const QUrl &url) void KioKdeconnect::stat(const QUrl &url)
{ {
kDebug(debugArea()) << "Stat: " << url; qCDebug(KDECONNECT_KIO) << "Stat: " << url;
KIO::UDSEntry entry; KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
@ -218,7 +220,7 @@ void KioKdeconnect::stat(const QUrl &url)
void KioKdeconnect::get(const QUrl &url) void KioKdeconnect::get(const QUrl &url)
{ {
kDebug(debugArea()) << "Get: " << url; qCDebug(KDECONNECT_KIO) << "Get: " << url;
mimeType(""); mimeType("");
finished(); finished();
} }
@ -228,7 +230,7 @@ void KioKdeconnect::setHost(const QString &hostName, quint16 port, const QString
//This is called before everything else to set the file we want to show //This is called before everything else to set the file we want to show
kDebug(debugArea()) << "Setting host: " << hostName; qCDebug(KDECONNECT_KIO) << "Setting host: " << hostName;
// In this kio only the hostname is used // In this kio only the hostname is used
Q_UNUSED(port) Q_UNUSED(port)

View file

@ -22,11 +22,14 @@
#define KIOKDECONNECT_H #define KIOKDECONNECT_H
#include <QObject> #include <QObject>
#include <QLoggingCategory>
#include <kio/slavebase.h> #include <kio/slavebase.h>
#include "interfaces/dbusinterfaces.h" #include "interfaces/dbusinterfaces.h"
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_KIO)
class KioKdeconnect : public QObject, public KIO::SlaveBase class KioKdeconnect : public QObject, public KIO::SlaveBase
{ {
Q_OBJECT Q_OBJECT