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.
This commit is contained in:
parent
b2036bd374
commit
a45bfe36d5
4 changed files with 22 additions and 0 deletions
|
@ -88,6 +88,9 @@ endif()
|
|||
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)
|
||||
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})
|
||||
if (KF5_OPTIONAL_COMPONENTS)
|
||||
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS})
|
||||
|
|
|
@ -21,4 +21,11 @@ target_link_libraries(kdeconnect_notifications
|
|||
Qt5::DBus
|
||||
KF5::Notifications
|
||||
KF5::I18n
|
||||
KF5::WindowSystem
|
||||
)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(kdeconnect_notifications
|
||||
Qt::X11Extras
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
#include <dbushelper.h>
|
||||
|
||||
#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")
|
||||
|
||||
|
@ -152,6 +157,12 @@ void NotificationsPlugin::replyRequested(Notification* noti)
|
|||
SendReplyDialog* dialog = new SendReplyDialog(originalMessage, replyId, appName);
|
||||
connect(dialog, &SendReplyDialog::sendReply, this, &NotificationsPlugin::sendReply);
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString&
|
|||
setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect"),
|
||||
QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnect.svg")))));
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
m_ui->replyEdit->setFocus();
|
||||
}
|
||||
|
||||
SendReplyDialog::~SendReplyDialog() = default;
|
||||
|
|
Loading…
Reference in a new issue