ActionManager: Remove QShortcut registration API

Registering QShortcuts doesn't solve any problem that is not already
solved by registering QActions, and shortcuts are in fact much more
limited (not being able to register multiple shortcuts for different
contexts).

Change-Id: I9478e601b2cbc3c5e12fb5baee43cacc20d0fb9c
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2014-02-28 17:33:48 +01:00
parent 92e930b367
commit e58c1ab06e
18 changed files with 152 additions and 433 deletions

View File

@@ -82,7 +82,6 @@
#include <QComboBox>
#include <QDesktopServices>
#include <QMenu>
#include <QShortcut>
#include <QStackedLayout>
#include <QSplitter>
@@ -420,11 +419,10 @@ void HelpPlugin::setupUi()
m_centralWidget, SLOT(showTopicChooser(QMap<QString,QUrl>,QString)));
QMap<QString, Command*> shortcutMap;
QShortcut *shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Index in Help mode"));
Command *cmd = ActionManager::registerShortcut(shortcut, "Help.IndexShortcut", modecontext);
QAction *action = new QAction(tr("Activate Index in Help mode"), m_splitter);
Command *cmd = ActionManager::registerAction(action, "Help.IndexShortcut", modecontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+I") : tr("Ctrl+Shift+I")));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateIndex()));
connect(action, SIGNAL(triggered()), this, SLOT(activateIndex()));
shortcutMap.insert(QLatin1String(SB_INDEX), cmd);
ContentWindow *contentWindow = new ContentWindow();
@@ -433,11 +431,10 @@ void HelpPlugin::setupUi()
connect(contentWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget,
SLOT(setSource(QUrl)));
shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Contents in Help mode"));
cmd = ActionManager::registerShortcut(shortcut, "Help.ContentsShortcut", modecontext);
action = new QAction(tr("Activate Contents in Help mode"), m_splitter);
cmd = ActionManager::registerAction(action, "Help.ContentsShortcut", modecontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+C") : tr("Ctrl+Shift+C")));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateContents()));
connect(action, SIGNAL(triggered()), this, SLOT(activateContents()));
shortcutMap.insert(QLatin1String(SB_CONTENTS), cmd);
SearchWidget *searchWidget = new SearchWidget();
@@ -446,11 +443,10 @@ void HelpPlugin::setupUi()
connect(searchWidget, SIGNAL(linkActivated(QUrl)), m_centralWidget,
SLOT(setSourceFromSearch(QUrl)));
shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Search in Help mode"));
cmd = ActionManager::registerShortcut(shortcut, "Help.SearchShortcut", modecontext);
action = new QAction(tr("Activate Search in Help mode"), m_splitter);
cmd = ActionManager::registerAction(action, "Help.SearchShortcut", modecontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+/") : tr("Ctrl+Shift+/")));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateSearch()));
connect(action, SIGNAL(triggered()), this, SLOT(activateSearch()));
shortcutMap.insert(QLatin1String(SB_SEARCH), cmd);
BookmarkManager *manager = &LocalHelpManager::bookmarkManager();
@@ -462,22 +458,20 @@ void HelpPlugin::setupUi()
connect(bookmarkWidget, SIGNAL(createPage(QUrl,bool)), &OpenPagesManager::instance(),
SLOT(createPage(QUrl,bool)));
shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Bookmarks in Help mode"));
cmd = ActionManager::registerShortcut(shortcut, "Help.BookmarkShortcut", modecontext);
action = new QAction(tr("Activate Bookmarks in Help mode"), m_splitter);
cmd = ActionManager::registerAction(action, "Help.BookmarkShortcut", modecontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+B") : tr("Ctrl+Shift+B")));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateBookmarks()));
connect(action, SIGNAL(triggered()), this, SLOT(activateBookmarks()));
shortcutMap.insert(QLatin1String(SB_BOOKMARKS), cmd);
QWidget *openPagesWidget = OpenPagesManager::instance().openPagesWidget();
openPagesWidget->setWindowTitle(tr("Open Pages"));
m_openPagesItem = new SideBarItem(openPagesWidget, QLatin1String(SB_OPENPAGES));
shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Open Pages in Help mode"));
cmd = ActionManager::registerShortcut(shortcut, "Help.PagesShortcut", modecontext);
action = new QAction(tr("Activate Open Pages in Help mode"), m_splitter);
cmd = ActionManager::registerAction(action, "Help.PagesShortcut", modecontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+O") : tr("Ctrl+Shift+O")));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateOpenPages()));
connect(action, SIGNAL(triggered()), this, SLOT(activateOpenPages()));
shortcutMap.insert(QLatin1String(SB_OPENPAGES), cmd);
QList<SideBarItem*> itemList;