diff --git a/kded/kded.cpp b/kded/kded.cpp index 8e3e06cb4..ee087c7a8 100644 --- a/kded/kded.cpp +++ b/kded/kded.cpp @@ -21,28 +21,30 @@ #include "kded.h" #include +#include #include #include -#include "core/kdebugnamespace.h" #include "config-kded.h" K_PLUGIN_FACTORY(KdeConnectFactory, registerPlugin();) K_EXPORT_PLUGIN(KdeConnectFactory("kdeconnect", "kdeconnect-kded")) +Q_LOGGING_CATEGORY(KDECONNECT_KDED, "kdeconnect.kded") + Kded::Kded(QObject *parent, const QList&) : KDEDModule(parent) , m_daemon(0) { QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection); - kDebug(debugArea()) << "kded_kdeconnect started"; + qDebug(KDECONNECT_KDED) << "kded_kdeconnect started"; } Kded::~Kded() { stop(); - kDebug(debugArea()) << "kded_kdeconnect stopped"; + qDebug(KDECONNECT_KDED) << "kded_kdeconnect stopped"; } void Kded::start() @@ -52,7 +54,7 @@ void Kded::start() } const QString daemon = QStringLiteral(KDECONNECTD_BIN); - kDebug(debugArea()) << "Starting daemon " << daemon; + qDebug(KDECONNECT_KDED) << "Starting daemon " << daemon; m_daemon = new KProcess(this); connect(m_daemon, SIGNAL(started()), SLOT(daemonStarted())); connect(m_daemon, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError))); @@ -84,24 +86,24 @@ void Kded::restart() void Kded::onError(QProcess::ProcessError errorCode) { - kError(debugArea()) << "Process error code=" << errorCode; + qCWarning(KDECONNECT_KDED) << "Process error code=" << errorCode; } void Kded::daemonStarted() { - kDebug(debugArea()) << "Daemon successfuly started"; + qDebug(KDECONNECT_KDED) << "Daemon successfuly started"; Q_EMIT started(); } void Kded::onFinished(int exitCode, QProcess::ExitStatus status) { if (status == QProcess::CrashExit) { - kError(debugArea()) << "Process crashed with code=" << exitCode; - kError(debugArea()) << m_daemon->readAllStandardError(); - kWarning(debugArea()) << "Restarting in 5 sec..."; + qCWarning(KDECONNECT_KDED) << "Process crashed with code=" << exitCode; + qCWarning(KDECONNECT_KDED) << m_daemon->readAllStandardError(); + qCWarning(KDECONNECT_KDED) << "Restarting in 5 sec..."; QTimer::singleShot(5000, this, SLOT(start())); } else { - kWarning(debugArea()) << "Process finished with code=" << exitCode; + qCWarning(KDECONNECT_KDED) << "Process finished with code=" << exitCode; } Q_EMIT stopped(); @@ -115,7 +117,7 @@ void Kded::checkIfDaemonTerminated() } m_daemon->kill(); - kWarning(debugArea()) << "Daemon killed"; + qCWarning(KDECONNECT_KDED) << "Daemon killed"; } #include "kded.moc" diff --git a/kded/kded.h b/kded/kded.h index 9ae70310d..5a881d4c2 100644 --- a/kded/kded.h +++ b/kded/kded.h @@ -24,6 +24,8 @@ #include #include +#include + class Kded : public KDEDModule { @@ -54,4 +56,5 @@ private: KProcess* m_daemon; }; +Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_KDED) #endif