Support raising when we receive a notification
This commit is contained in:
committed by
Aleix Pol Gonzalez
parent
8722c99c93
commit
284a1734ae
@@ -352,9 +352,14 @@ Kirigami.ApplicationWindow {
|
||||
showPassiveNotification(i18n("%1: %2", error, detail));
|
||||
}
|
||||
|
||||
function onShowWindow() {
|
||||
function onShowWindow(token = null) {
|
||||
root.showWindow()
|
||||
root.raise()
|
||||
if (token && KWindowSystem) {
|
||||
KWindowSystem.setCurrentXdgActivationToken(basicNotification.xdgActivationToken)
|
||||
KWindowSystem.activateWindow(root)
|
||||
} else {
|
||||
root.raise()
|
||||
}
|
||||
}
|
||||
|
||||
function onUserConsentRequired(url) {
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
#ifdef HAVE_KDBUSADDONS
|
||||
#ifdef HAVE_WINDOWSYSTEM
|
||||
static void raiseWindow(QWindow *window)
|
||||
{
|
||||
if (KWindowSystem::isPlatformWayland()) {
|
||||
@@ -209,6 +209,12 @@ int main(int argc, char *argv[])
|
||||
qRegisterMetaType<GetRoomEventsJob *>("GetRoomEventsJob*");
|
||||
qRegisterMetaType<QMimeType>("QMimeType");
|
||||
|
||||
#ifdef HAVE_WINDOWSYSTEM
|
||||
qmlRegisterSingletonType<KWindowSystem>("org.kde.kwindowsystem.private", 1, 0, "KWindowSystem", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||
return KWindowSystem::self();
|
||||
});
|
||||
#endif
|
||||
|
||||
qRegisterMetaTypeStreamOperators<Emoji>();
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include "knotifications_version.h"
|
||||
#include <KLocalizedString>
|
||||
#include <KNotification>
|
||||
#ifdef HAVE_WINDOWSYSTEM
|
||||
#include <KWindowSystem>
|
||||
#endif
|
||||
#if KNOTIFICATIONS_VERSION >= QT_VERSION_CHECK(5, 81, 0)
|
||||
#include <KNotificationReplyAction>
|
||||
#endif
|
||||
@@ -85,6 +88,9 @@ void NotificationsManager::postInviteNotification(NeoChatRoom *room, const QStri
|
||||
notification->setPixmap(img);
|
||||
notification->setDefaultAction(i18n("Open this invitation in NeoChat"));
|
||||
connect(notification, &KNotification::defaultActivated, this, [=]() {
|
||||
#ifdef HAVE_WINDOWSYSTEM
|
||||
KWindowSystem::setCurrentXdgActivationToken(notification->xdgActivationToken());
|
||||
#endif
|
||||
RoomManager::instance().enterRoom(room);
|
||||
Q_EMIT Controller::instance().showWindow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user