Skip to content
Snippets Groups Projects
Commit c9e008f0 authored by Anton Anikin's avatar Anton Anikin
Browse files

Add keyboard shortcut for "Switch Header/Source"

BUG: 359136

Differential Revision: https://phabricator.kde.org/D2757
parent d09880e0
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
<MenuBar>
<Menu name="navigation">
<Action name="switch_definition_declaration" group="navigation_jmp"/>
<Action name="switch_header_source" group="navigation_jmp"/>
</Menu>
</MenuBar>
</kpartgui>
......@@ -148,9 +148,27 @@ void SwitchToBuddyPlugin::createActionsForMainWindow(Sublime::MainWindow* /*wind
xmlFile = this->xmlFile();
QAction* switchDefinitionDeclaration = actions.addAction(QStringLiteral("switch_definition_declaration"));
switchDefinitionDeclaration->setText( i18n("&Switch Definition/Declaration") );
actions.setDefaultShortcut( switchDefinitionDeclaration, Qt::CTRL | Qt::SHIFT | Qt::Key_C );
switchDefinitionDeclaration->setText(i18n("&Switch Definition/Declaration"));
actions.setDefaultShortcut(switchDefinitionDeclaration, Qt::CTRL | Qt::SHIFT | Qt::Key_C);
connect(switchDefinitionDeclaration, &QAction::triggered, this, &SwitchToBuddyPlugin::switchDefinitionDeclaration);
QAction* switchHeaderSource = actions.addAction(QStringLiteral("switch_header_source"));
switchHeaderSource->setText(i18n("Switch Header/Source"));
actions.setDefaultShortcut(switchHeaderSource, Qt::CTRL | Qt::Key_Slash);
connect(switchHeaderSource, &QAction::triggered, this, &SwitchToBuddyPlugin::switchHeaderSource);
}
void SwitchToBuddyPlugin::switchHeaderSource()
{
qCDebug(PLUGIN_SWITCHTOBUDDY) << "switching header/source";
auto doc = ICore::self()->documentController()->activeDocument();
if (!doc)
return;
QString buddyUrl = findSwitchCandidate(doc->url());
if (!buddyUrl.isEmpty())
switchToBuddy(buddyUrl);
}
void SwitchToBuddyPlugin::switchToBuddy(const QString& url)
......
......@@ -62,6 +62,11 @@ private slots:
*/
void switchToBuddy(const QString& url);
/**
* Switch between header and source files
*/
void switchHeaderSource();
/**
* @brief Switch between definitions and declarations
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment