Commit 24910a27 authored by Igor Kushnir's avatar Igor Kushnir
Browse files

Preserve custom Locate Current Document action's shortcut

This shortcut can be configured in the Configure Keyboard Shortcuts
window. The custom-set shortcut works at first. But once KDevelop is
restarted, the shortcut is reset to the default Ctrl+<.

Calling KActionCollection::setDefaultShortcut() instead of
QAction::setShortcut() preserves the shortcut between KDevelop launches.
parent 52d433d3
......@@ -87,11 +87,9 @@ ProjectManagerView::ProjectManagerView( ProjectManagerViewPlugin* plugin, QWidge
Q_ASSERT(m_syncAction);
m_syncAction->setCheckable(true);
m_syncAction->setChecked(pmviewConfig.readEntry<bool>(syncCurrentDocumentKey, true));
m_syncAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_syncAction->setText(i18nc("@action", "Locate Current Document"));
m_syncAction->setToolTip(i18nc("@info:tooltip", "Locates the current document in the project tree and selects it."));
m_syncAction->setIcon(QIcon::fromTheme(QStringLiteral("dirsync")));
m_syncAction->setShortcut(Qt::CTRL | Qt::Key_Less);
connect(m_syncAction, &QAction::triggered, this, &ProjectManagerView::toggleSyncCurrentDocument);
connect(ICore::self()->documentController(), &KDevelop::IDocumentController::documentActivated, this, [this]{
if (m_syncAction->isChecked()) {
......
......@@ -177,10 +177,14 @@ ProjectManagerViewPlugin::ProjectManagerViewPlugin( QObject *parent, const QVari
d->m_prune->setEnabled( false );
connect( d->m_prune, &QAction::triggered, this, &ProjectManagerViewPlugin::pruneProjectItems );
actionCollection()->addAction( QStringLiteral("project_prune"), d->m_prune );
// only add the action so that its known in the actionCollection
// and so that it's shortcut etc. pp. is restored
// apparently that is not possible to be done in the view itself *sigh*
actionCollection()->addAction( QStringLiteral("locate_document") );
auto locateDocumentAction = actionCollection()->addAction(QStringLiteral("locate_document"));
locateDocumentAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
actionCollection()->setDefaultShortcut(locateDocumentAction, Qt::CTRL | Qt::Key_Less);
setXMLFile( QStringLiteral("kdevprojectmanagerview.rc") );
d->factory = new KDevProjectManagerViewFactory( this );
core()->uiController()->addToolView(i18nc("@title:window", "Projects"), d->factory);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment