Commit a6d78afb authored by David Faure's avatar David Faure

Port away from KStartupInfo::setNewStartupId deprecated API

parent 839add05
......@@ -24,6 +24,7 @@
#include "konqdebug.h"
#include <kstartupinfo.h>
#include <kwindowsystem_version.h>
KonqMainWindowAdaptor::KonqMainWindowAdaptor(KonqMainWindow *mainWindow)
: QDBusAbstractAdaptor(mainWindow), m_pMainWindow(mainWindow)
......@@ -46,13 +47,23 @@ void KonqMainWindowAdaptor::newTab(const QString &url, bool tempFile)
void KonqMainWindowAdaptor::newTabASN(const QString &url, const QByteArray &startup_id, bool tempFile)
{
#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5,62,0)
m_pMainWindow->setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(m_pMainWindow->windowHandle(), startup_id);
#else
KStartupInfo::setNewStartupId(m_pMainWindow, startup_id);
#endif
m_pMainWindow->openFilteredUrl(url, true, tempFile);
}
void KonqMainWindowAdaptor::newTabASNWithMimeType(const QString &url, const QString &mimetype, const QByteArray &startup_id, bool tempFile)
{
#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5,62,0)
m_pMainWindow->setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(m_pMainWindow->windowHandle(), startup_id);
#else
KStartupInfo::setNewStartupId(m_pMainWindow, startup_id);
#endif
m_pMainWindow->openFilteredUrl(url, mimetype, true, tempFile);
}
......
......@@ -45,6 +45,7 @@
#include <QCommandLineOption>
#include <KStartupInfo>
#include <KWindowSystem>
#include <kwindowsystem_version.h>
static void listSessions()
{
......@@ -237,7 +238,12 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
KonqMainWindow *mainWindow = handleCommandLine(parser, workingDirectory, &ret);
if (mainWindow) {
// terminate startup notification and activate the mainwindow:
#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5,62,0)
mainWindow->setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(mainWindow->windowHandle(), KStartupInfo::startupId());
#else
KStartupInfo::setNewStartupId(mainWindow, KStartupInfo::startupId());
#endif
KWindowSystem::forceActiveWindow(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