Core: Make Context parameter to registerAction optional

... and default to C_GLOBAL. A rather common case.
Similar for ActionContainer::addSeparator().

Change-Id: I7f9ba573af201c0a472132d5a494ad17cc4175b7
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
hjk
2015-02-19 11:35:47 +01:00
parent 5b80463050
commit 7f001dab1b
38 changed files with 169 additions and 224 deletions

View File

@@ -72,7 +72,6 @@ BookmarksPlugin::BookmarksPlugin() :
bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
{
Context textcontext(TextEditor::Constants::C_TEXTEDITOR);
Context globalcontext(Core::Constants::C_GLOBAL);
ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
ActionContainer *mbm = ActionManager::createMenu(Id(BOOKMARKS_MENU));
@@ -89,26 +88,26 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
//Previous
m_prevAction = new QAction(tr("Previous Bookmark"), this);
cmd = ActionManager::registerAction(m_prevAction, BOOKMARKS_PREV_ACTION, globalcontext);
cmd = ActionManager::registerAction(m_prevAction, BOOKMARKS_PREV_ACTION);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+,") : tr("Ctrl+,")));
mbm->addAction(cmd);
//Next
m_nextAction = new QAction(tr("Next Bookmark"), this);
cmd = ActionManager::registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION, globalcontext);
cmd = ActionManager::registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+.") : tr("Ctrl+.")));
mbm->addAction(cmd);
mbm->addSeparator(globalcontext);
mbm->addSeparator();
//Previous Doc
m_docPrevAction = new QAction(tr("Previous Bookmark in Document"), this);
cmd = ActionManager::registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION, globalcontext);
cmd = ActionManager::registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION);
mbm->addAction(cmd);
//Next Doc
m_docNextAction = new QAction(tr("Next Bookmark in Document"), this);
cmd = ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext);
cmd = ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION);
mbm->addAction(cmd);
m_editBookmarkAction = new QAction(tr("Edit Bookmark"), this);