[kde-doc-english] [trojita] src/Gui: GUI: Add an action for closing of standalone message windows

Jan Kundrát jkt at kde.org
Thu Feb 4 14:05:27 UTC 2016


Git commit d45708b884f1948279e6505dc80676baca6385e6 by Jan Kundrát.
Committed on 02/02/2016 at 00:22.
Pushed by gerrit into branch 'master'.

GUI: Add an action for closing of standalone message windows

Unfortunately, one cannot use the GUI to assign for example "Esc" for
this particular shortcut because the GUI settings dialog intercepts that
one, and closes itself. However, assigning some other key for this
action and editing the config file afterwards works.

I've also double-checked that the signal-slots are correct, and that
only one popup window is closed when pressing that shortcut.

This is an alternative to https://gerrit.vesnicky.cesnet.cz/r/538 .

Change-Id: I7479be102736f071321fb7132a7f688f95c4bd7c
CCBUG: 357679

M  +3    -0    src/Gui/Window.cpp

http://commits.kde.org/trojita/d45708b884f1948279e6505dc80676baca6385e6

diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 145b7b3..cded79c 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -200,6 +200,7 @@ void MainWindow::defineActions()
     shortcutHandler->defineAction(QStringLiteral("action_network_offline"), QStringLiteral("network-disconnect"), tr("&Offline"));
     shortcutHandler->defineAction(QStringLiteral("action_network_expensive"), QStringLiteral("network-wireless"), tr("&Expensive Connection"));
     shortcutHandler->defineAction(QStringLiteral("action_network_online"), QStringLiteral("network-connect"), tr("&Free Access"));
+    shortcutHandler->defineAction(QStringLiteral("action_messagewindow_close"), QStringLiteral("window-close"), tr("Close Standalone Message Window"));
 }
 
 void MainWindow::createActions()
@@ -1034,6 +1035,8 @@ void MainWindow::msgListDoubleClicked(const QModelIndex &index)
     widget->setWindowTitle(index.data(Imap::Mailbox::RoleMessageSubject).toString());
     widget->setAttribute(Qt::WA_DeleteOnClose);
     widget->resize(800, 600);
+    QAction *closeAction = ShortcutHandler::instance()->createAction(QStringLiteral("action_messagewindow_close"), widget, SLOT(close()), widget);
+    widget->addAction(closeAction);
     widget->show();
 }
 



More information about the kde-doc-english mailing list