forked from qt-creator/qt-creator
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:
@@ -121,9 +121,6 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
// Create the globalcontext list to register actions accordingly
|
||||
Context globalcontext(Core::Constants::C_GLOBAL);
|
||||
|
||||
// Create the settings Page
|
||||
m_settings->fromSettings(ICore::settings());
|
||||
SettingsPage *settingsPage = new SettingsPage(m_settings);
|
||||
@@ -162,19 +159,19 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
|
||||
Command *command;
|
||||
|
||||
m_postEditorAction = new QAction(tr("Paste Snippet..."), this);
|
||||
command = ActionManager::registerAction(m_postEditorAction, "CodePaster.Post", globalcontext);
|
||||
command = ActionManager::registerAction(m_postEditorAction, "CodePaster.Post");
|
||||
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+P") : tr("Alt+C,Alt+P")));
|
||||
connect(m_postEditorAction, &QAction::triggered, this, &CodepasterPlugin::pasteSnippet);
|
||||
cpContainer->addAction(command);
|
||||
|
||||
m_fetchAction = new QAction(tr("Fetch Snippet..."), this);
|
||||
command = ActionManager::registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext);
|
||||
command = ActionManager::registerAction(m_fetchAction, "CodePaster.Fetch");
|
||||
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+F") : tr("Alt+C,Alt+F")));
|
||||
connect(m_fetchAction, &QAction::triggered, this, &CodepasterPlugin::fetch);
|
||||
cpContainer->addAction(command);
|
||||
|
||||
m_fetchUrlAction = new QAction(tr("Fetch from URL..."), this);
|
||||
command = ActionManager::registerAction(m_fetchUrlAction, "CodePaster.FetchUrl", globalcontext);
|
||||
command = ActionManager::registerAction(m_fetchUrlAction, "CodePaster.FetchUrl");
|
||||
connect(m_fetchUrlAction, &QAction::triggered, this, &CodepasterPlugin::fetchUrl);
|
||||
cpContainer->addAction(command);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user