Commit 5c7ff447 authored by Bharadwaj Raju's avatar Bharadwaj Raju Committed by Nicolas Fella
Browse files

Fix notification reply window activation and focus

Ensures the reply window is raised using Qt::WindowActive state. This
properly raises the window reliably (including from plasmoid, which
didn't work at all before) and focuses the reply textbox.

(cherry picked from commit a45bfe36)
parent bbcfae42
Pipeline #55103 skipped
...@@ -86,6 +86,9 @@ endif() ...@@ -86,6 +86,9 @@ endif()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII) add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick QuickControls2 Network Multimedia) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick QuickControls2 Network Multimedia)
if (UNIX AND NOT APPLE)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
endif()
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS}) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS})
if (KF5_OPTIONAL_COMPONENTS) if (KF5_OPTIONAL_COMPONENTS)
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS}) find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS})
......
...@@ -21,4 +21,11 @@ target_link_libraries(kdeconnect_notifications ...@@ -21,4 +21,11 @@ target_link_libraries(kdeconnect_notifications
Qt5::DBus Qt5::DBus
KF5::Notifications KF5::Notifications
KF5::I18n KF5::I18n
KF5::WindowSystem
) )
if (UNIX AND NOT APPLE)
target_link_libraries(kdeconnect_notifications
Qt::X11Extras
)
endif()
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
#include <dbushelper.h> #include <dbushelper.h>
#include <KPluginFactory> #include <KPluginFactory>
#include <KStartupInfo>
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
#include <QX11Info>
#endif
K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json") K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json")
...@@ -149,6 +154,12 @@ void NotificationsPlugin::replyRequested(Notification* noti) ...@@ -149,6 +154,12 @@ void NotificationsPlugin::replyRequested(Notification* noti)
SendReplyDialog* dialog = new SendReplyDialog(originalMessage, replyId, appName); SendReplyDialog* dialog = new SendReplyDialog(originalMessage, replyId, appName);
connect(dialog, &SendReplyDialog::sendReply, this, &NotificationsPlugin::sendReply); connect(dialog, &SendReplyDialog::sendReply, this, &NotificationsPlugin::sendReply);
dialog->show(); dialog->show();
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
auto window = qobject_cast<QWindow*>(dialog->windowHandle());
if (window && QX11Info::isPlatformX11()) {
KStartupInfo::setNewStartupId(window, QX11Info::nextStartupId());
}
#endif
dialog->raise(); dialog->raise();
} }
......
...@@ -32,6 +32,7 @@ SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString& ...@@ -32,6 +32,7 @@ SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString&
setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect"), setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect"),
QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnect.svg"))))); QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnect.svg")))));
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
m_ui->replyEdit->setFocus();
} }
SendReplyDialog::~SendReplyDialog() = default; SendReplyDialog::~SendReplyDialog() = default;
......
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