[education/rkward] rkward/agents: Fix the (currently) last deprecation warning
Thomas Friedrichsmeier
null at kde.org
Fri Jul 8 22:39:42 BST 2022
Git commit b73d0f8695b6b402fe6f208f97205f664fbb0aeb by Thomas Friedrichsmeier.
Committed on 08/07/2022 at 21:39.
Pushed by tfry into branch 'master'.
Fix the (currently) last deprecation warning
M +5 -1 rkward/agents/rkprintagent.cpp
https://invent.kde.org/education/rkward/commit/b73d0f8695b6b402fe6f208f97205f664fbb0aeb
diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index f233f000..c941686e 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -24,6 +24,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include <KLocalizedString>
#include <KPluginFactory>
#include <KPluginLoader>
+#include <kcoreaddons_version.h>
#include "../rkward.h"
@@ -48,10 +49,14 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
KService::Ptr service = KService::serviceByDesktopPath("okular_part.desktop");
if (!service) service = KService::serviceByDesktopPath("kpdf_part.desktop");
if (service) {
+#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5,86,0)
auto factory = KPluginLoader(service->library()).factory();
if (factory) {
provider = factory->create<KParts::ReadOnlyPart>(nullptr);
}
+#else
+ provider = KPluginFactory::instantiatePlugin<KParts::ReadOnlyPart>(KPluginMetaData(QPluginLoader(service->library())), nullptr).plugin;
+#endif
} else {
RK_DEBUG (APP, DL_WARNING, "No KDE service found for postscript printing");
}
@@ -99,4 +104,3 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
agent->deleteLater ();
}
}
-
More information about the rkward-tracker
mailing list