# HG changeset patch # User Yuya Nishihara # Date 1659752753 -32400 # Sat Aug 06 11:25:53 2022 +0900 # Node ID 992cb05b22aa6301f276f0b9327d1d0066af3967 # Parent 755ff0d181e752e19a86598edf70c60d7a0462df hgchangesetpanel: add user command actions to widget so shortcuts are handled diff --git a/app/hgchangesetpanel.cpp b/app/hgchangesetpanel.cpp --- a/app/hgchangesetpanel.cpp +++ b/app/hgchangesetpanel.cpp @@ -111,7 +111,9 @@ addAction(repoActionRunner_->diffChangesetAction()); addAction(repoActionRunner_->updateAction()); - // TODO: register userCommandActions() on current repository changed and config loaded + registerUserCommandActions(); + connect(repoActionRunner_, &HgRepoActionRunner::userCommandActionsReset, this, + &HgChangesetPanel::registerUserCommandActions); ui_->reloadButton->setDefaultAction(&actions_->reload); ui_->findPreviousButton->setDefaultAction(&actions_->findPreviousRevision); @@ -672,6 +674,11 @@ menu->popup(ui_->changesetView->viewport()->mapToGlobal(pos)); } +void HgChangesetPanel::registerUserCommandActions() +{ + addActions(repoActionRunner_->userCommandActions()); +} + void HgChangesetPanel::updateActionRunner() { repoActionRunner_->setCurrentRevision(currentRevision()); diff --git a/app/hgchangesetpanel.h b/app/hgchangesetpanel.h --- a/app/hgchangesetpanel.h +++ b/app/hgchangesetpanel.h @@ -70,6 +70,7 @@ void onRevisionClicked(const QModelIndex &index); void displayCurrentRevision(); void popupContextMenuForChangesetView(const QPoint &pos); + void registerUserCommandActions(); void updateActionRunner(); private: diff --git a/app/hgrepoactionrunner.cpp b/app/hgrepoactionrunner.cpp --- a/app/hgrepoactionrunner.cpp +++ b/app/hgrepoactionrunner.cpp @@ -111,6 +111,8 @@ action->setShortcutContext(Qt::WidgetWithChildrenShortcut); } } + + emit userCommandActionsReset(); } QWidget *HgRepoActionRunner::parentWidget() const diff --git a/app/hgrepoactionrunner.h b/app/hgrepoactionrunner.h --- a/app/hgrepoactionrunner.h +++ b/app/hgrepoactionrunner.h @@ -33,6 +33,9 @@ QAction *updateAction() const; QList userCommandActions() const; +signals: + void userCommandActionsReset(); + private slots: void onRepositoryServiceStopped(); void onConfigLoaded();