[education/rkward] rkward: Fix --reuse command line option

Thomas Friedrichsmeier null at kde.org
Sat May 25 23:01:38 BST 2024


Git commit f5a96897a701bc175c970d76940611e6a867f213 by Thomas Friedrichsmeier.
Committed on 25/05/2024 at 22:01.
Pushed by tfry into branch 'master'.

Fix --reuse command line option

M  +6    -0    rkward/main.cpp
M  +2    -8    rkward/misc/rkdbusapi.cpp
M  +1    -1    rkward/misc/rkdbusapi.h

https://invent.kde.org/education/rkward/-/commit/f5a96897a701bc175c970d76940611e6a867f213

diff --git a/rkward/main.cpp b/rkward/main.cpp
index 301acd23d..7c3fcbf68 100644
--- a/rkward/main.cpp
+++ b/rkward/main.cpp
@@ -45,6 +45,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <KLocalizedString>
 #include <KUrlAuthorized>
 #include <KMessageBox>
+#if __has_include(<KStartupInfo>)
+#	include <KStartupInfo>
+#endif
 #ifdef WITH_KCRASH
 #	include <KCrash>
 #endif
@@ -362,6 +365,9 @@ int main (int argc, char *argv[]) {
 					RK_DEBUG (DEBUG_ALL, DL_ERROR, "Error while placing dbus call: %s", qPrintable (reply.error ().message ()));
 					return 1;
 				}
+#if __has_include(<KStartupInfo>)
+				KStartupInfo::appStarted();
+#endif
 				return 0;
 			}
 		}
diff --git a/rkward/misc/rkdbusapi.cpp b/rkward/misc/rkdbusapi.cpp
index a3480b4b1..a3e635d36 100644
--- a/rkward/misc/rkdbusapi.cpp
+++ b/rkward/misc/rkdbusapi.cpp
@@ -32,7 +32,7 @@ RKDBusAPI::RKDBusAPI (QObject* parent): QObject (parent) {
 	QDBusConnection::sessionBus ().registerObject ("/", this, QDBusConnection::ExportScriptableSlots);
 }
 
-void RKDBusAPI::openAnyUrl (const QStringList& urls, const QString &token, bool warn_external) {
+void RKDBusAPI::openAnyUrl (const QStringList& urls, bool warn_external) {
 	RK_TRACE (APP);
 
 	// ok, raising the app window is totally hard to do, reliably. This solution copied from kate.
@@ -41,13 +41,7 @@ void RKDBusAPI::openAnyUrl (const QStringList& urls, const QString &token, bool
 	main->activateWindow();
 	main->raise();
 
-	if (KWindowSystem::isPlatformX11()) {
-#if __has_include(<KStartupInfo>)
-		KStartupInfo::setNewStartupId(main->windowHandle(), token.toUtf8());
-#endif
-	} else if (KWindowSystem::isPlatformWayland()) {
-		KWindowSystem::setCurrentXdgActivationToken(token);
-	}
+	// omitting activation token
 
 	KWindowSystem::activateWindow(main->windowHandle());
 	// end
diff --git a/rkward/misc/rkdbusapi.h b/rkward/misc/rkdbusapi.h
index 23896eca1..7116ae88b 100644
--- a/rkward/misc/rkdbusapi.h
+++ b/rkward/misc/rkdbusapi.h
@@ -19,7 +19,7 @@ public:
 	explicit RKDBusAPI (QObject *parent);
 	~RKDBusAPI () {};
 public Q_SLOTS:
-	Q_SCRIPTABLE void openAnyUrl (const QStringList &urls, const QString &token, bool warn_external=true);
+	Q_SCRIPTABLE void openAnyUrl (const QStringList &urls, bool warn_external=true);
 };
 
 #endif


More information about the rkward-tracker mailing list