Commit 82cf2e1f authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

On activation by KDBusService set proper startupId/activation token

BUG: 430561
FIXED-IN: 1.8.21121
parent 074f80e2
Pipeline #113358 passed with stage
in 1 minute and 32 seconds
......@@ -27,6 +27,11 @@ include(ECMSetupVersion)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Network Widgets)
find_package(Qt5X11Extras ${QT_MIN_VERSION} CONFIG)
set_package_properties(Qt5X11Extras PROPERTIES
PURPOSE "Needed for startup activation handling on X11"
TYPE OPTIONAL
)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
Archive
......@@ -60,6 +65,11 @@ set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Support for encryption"
check_include_file("stropts.h" HAVE_STROPTS_H)
set(HAVE_QCA2 ${Qca-qt5_FOUND})
if(TARGET Qt5::X11Extras)
set(HAVE_X11 TRUE)
else()
set(HAVE_X11 FALSE)
endif()
configure_file(config-konversation.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-konversation.h )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
......
#cmakedefine HAVE_QCA2 1
#cmakedefine HAVE_STROPTS_H 1
#cmakedefine01 HAVE_X11
......@@ -258,6 +258,10 @@ target_link_libraries(konversation
KF5::NewStuff
Phonon::phonon4qt5)
if(TARGET Qt5::X11Extras)
target_link_libraries(konversation Qt5::X11Extras)
endif()
if (Qca-qt5_FOUND)
target_link_libraries(konversation qca-qt5)
endif ()
......
......@@ -26,6 +26,7 @@
#include "notificationhandler.h"
#include "awaymanager.h"
#include "konversation_log.h"
#include "config-konversation.h"
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
......@@ -36,6 +37,8 @@
#include <KTextEdit>
#include <KSharedConfig>
#include <KStartupInfo>
#include <KWindowSystem>
#include <kwindowsystem_version.h>
#include <QRegularExpression>
#include <QDBusConnection>
......@@ -45,6 +48,9 @@
#include <QTextCursor>
#include <QDesktopServices>
#include <QCommandLineParser>
#if HAVE_X11
#include <QX11Info>
#endif
using namespace Konversation;
......@@ -1347,9 +1353,19 @@ void Application::handleActivate(const QStringList& arguments)
newInstance(m_commandLineParser);
KStartupInfo::setNewStartupId(mainWindow->windowHandle(), KStartupInfo::startupId());
mainWindow->show();
#if HAVE_X11
if (KWindowSystem::isPlatformX11()) {
KStartupInfo::setNewStartupId(mainWindow->windowHandle(), QX11Info::nextStartupId());
} else
#endif
#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 83, 0)
if (KWindowSystem::isPlatformWayland()) {
KWindowSystem::setCurrentXdgActivationToken(qEnvironmentVariable("XDG_ACTIVATION_TOKEN"));
}
#endif
mainWindow->raise();
KWindowSystem::activateWindow(mainWindow->winId());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment