[kde-doc-english] [trojita] src/Gui: GUI: let zooming shortcuts go through ShortcutHandler
Caspar Schutijser
caspar at schutijser.com
Thu May 26 09:52:06 UTC 2016
Git commit 6fa54e7e2d2cfe5e622187c7b84143e494abb457 by Caspar Schutijser.
Committed on 23/05/2016 at 20:15.
Pushed by gerrit into branch 'master'.
GUI: let zooming shortcuts go through ShortcutHandler
Change-Id: Id0a4add59c5e2fa643c1a895d1f473cfa369f699
M +4 -5 src/Gui/MessageView.cpp
M +5 -2 src/Gui/Window.cpp
http://commits.kde.org/trojita/6fa54e7e2d2cfe5e622187c7b84143e494abb457
diff --git a/src/Gui/MessageView.cpp b/src/Gui/MessageView.cpp
index 5532b79..3040f96 100644
--- a/src/Gui/MessageView.cpp
+++ b/src/Gui/MessageView.cpp
@@ -62,6 +62,7 @@
#include "Imap/Model/Utils.h"
#include "Imap/Network/MsgPartNetAccessManager.h"
#include "Plugins/PluginManager.h"
+#include "ShortcutHandler/ShortcutHandler.h"
#include "UiUtils/IconLoader.h"
namespace Gui
@@ -86,17 +87,15 @@ MessageView::MessageView(QWidget *parent, QSettings *settings, Plugins::PluginMa
setFocusPolicy(Qt::StrongFocus); // not by the wheel
- m_zoomIn = new QAction(UiUtils::loadIcon(QStringLiteral("zoom-in")), tr("Zoom In"), this);
- m_zoomIn->setShortcut(QKeySequence::ZoomIn);
+ m_zoomIn = ShortcutHandler::instance()->createAction(QStringLiteral("action_zoom_in"), this);
addAction(m_zoomIn);
connect(m_zoomIn, &QAction::triggered, this, &MessageView::zoomIn);
- m_zoomOut = new QAction(UiUtils::loadIcon(QStringLiteral("zoom-out")), tr("Zoom Out"), this);
- m_zoomOut->setShortcut(QKeySequence::ZoomOut);
+ m_zoomOut = ShortcutHandler::instance()->createAction(QStringLiteral("action_zoom_out"), this);
addAction(m_zoomOut);
connect(m_zoomOut, &QAction::triggered, this, &MessageView::zoomOut);
- m_zoomOriginal = new QAction(UiUtils::loadIcon(QStringLiteral("zoom-original")), tr("Original Size"), this);
+ m_zoomOriginal = ShortcutHandler::instance()->createAction(QStringLiteral("action_zoom_original"), this);
addAction(m_zoomOriginal);
connect(m_zoomOriginal, &QAction::triggered, this, &MessageView::zoomOriginal);
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index f8d3227..9de36f6 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -143,13 +143,13 @@ MainWindow::MainWindow(QSettings *settings): QMainWindow(), m_imapAccess(0), m_m
connect(m_imapAccess, &Imap::ImapAccess::cacheError, this, &MainWindow::cacheError);
connect(m_imapAccess, &Imap::ImapAccess::checkSslPolicy, this, &MainWindow::checkSslPolicy, Qt::QueuedConnection);
- createWidgets();
-
ShortcutHandler *shortcutHandler = new ShortcutHandler(this);
shortcutHandler->setSettingsObject(m_settings);
defineActions();
shortcutHandler->readSettings(); // must happen after defineActions()
+ createWidgets();
+
Imap::migrateSettings(m_settings);
m_senderIdentities = new Composer::SenderIdentitiesModel(this);
@@ -236,6 +236,9 @@ void MainWindow::defineActions()
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"));
shortcutHandler->defineAction(QStringLiteral("action_oneattime_go_back"), QStringLiteral("go-previous"), tr("Navigate Back"), QKeySequence(QKeySequence::Back).toString());
+ shortcutHandler->defineAction(QStringLiteral("action_zoom_in"), QStringLiteral("zoom-in"), tr("Zoom In"), QKeySequence::ZoomIn);
+ shortcutHandler->defineAction(QStringLiteral("action_zoom_out"), QStringLiteral("zoom-out"), tr("Zoom Out"), QKeySequence::ZoomOut);
+ shortcutHandler->defineAction(QStringLiteral("action_zoom_original"), QStringLiteral("zoom-original"), tr("Original Size"));
}
void MainWindow::createActions()
More information about the kde-doc-english
mailing list