File 0015-Migrate-to-qCDebug.patch of Package mingw32-kinit

From 0482947ad27a63436c336d5ceb09c4b3324dba53 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Mon, 11 Jul 2022 09:48:04 +0200
Subject: [PATCH 15/18] Migrate to qCDebug

---
 src/kdeinit/kinit_win.cpp | 13 ++++++++-----
 src/kdeinit/kinit_win.h   | 14 ++++++++++++++
 2 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100644 src/kdeinit/kinit_win.h

diff --git a/src/kdeinit/kinit_win.cpp b/src/kdeinit/kinit_win.cpp
index c2a5b90..4aa1765 100644
--- a/src/kdeinit/kinit_win.cpp
+++ b/src/kdeinit/kinit_win.cpp
@@ -26,8 +26,8 @@
 
 #include <QProcess>
 #include <QFileInfo>
-#include <QDebug>
 #include <QLibraryInfo>
+#include <QLoggingCategory>
 
 // Under wince interface is defined, so undef it otherwise it breaks it
 #undef interface
@@ -36,6 +36,9 @@
 #include <QDBusConnectionInterface>
 
 #include <kinit_version.h>
+#include <kinit_win.h>
+
+Q_LOGGING_CATEGORY(KDEINIT, "kf5.kinit.kdeinit", QtWarningMsg)
 
 #if defined (Q_CC_MSVC)
 typedef unsigned int pid_t;
@@ -356,7 +359,7 @@ ProcessListEntry *ProcessList::find(const QString &name)
     QString installPrefix = installRoot();
     for (ProcessListEntry *ple : qAsConst(m_processes)) {
         if (ple->pid < 0) {
-            qDebug() << "negative pid!";
+            qCDebug(KDEINIT) << "negative pid!";
             continue;
         }
 
@@ -366,7 +369,7 @@ ProcessListEntry *ProcessList::find(const QString &name)
 
         if (!ple->path.isEmpty() && !ple->path.startsWith(installPrefix)) {
             // process is outside of installation directory
-            qDebug() << "path of the process" << name << "seems to be outside of the installPath:" << ple->path << installPrefix;
+            qCDebug(KDEINIT) << "path of the process" << name << "seems to be outside of the installPath:" << ple->path << installPrefix;
             continue;
         }
         return ple;
@@ -376,10 +379,10 @@ ProcessListEntry *ProcessList::find(const QString &name)
 
 bool ProcessList::terminateProcess(const QString &name)
 {
-    qDebug() << "going to terminate process" << name;
+    qCDebug(KDEINIT) << "going to terminate process" << name;
     ProcessListEntry *p = find(name);
     if (!p) {
-        qDebug() << "could not find ProcessListEntry for process name" << name;
+        qCDebug(KDEINIT) << "could not find ProcessListEntry for process name" << name;
         return false;
     }
 
diff --git a/src/kdeinit/kinit_win.h b/src/kdeinit/kinit_win.h
new file mode 100644
index 0000000..5eca532
--- /dev/null
+++ b/src/kdeinit/kinit_win.h
@@ -0,0 +1,14 @@
+/*
+    This file is part of the KDE libraries
+    SPDX-FileCopyrightText: 2021 Ralf Habacker <ralf.habacker@freenet.de>
+    SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de>
+
+    SPDX-License-Identifier: LGPL-2.0-only
+*/
+
+#ifndef KINIT_WIN_H
+#define KINIT_WIN_H
+
+Q_DECLARE_LOGGING_CATEGORY(KDEINIT)
+
+#endif // KINIT_WIN_H
-- 
2.26.2

openSUSE Build Service is sponsored by