forked from qt-creator/qt-creator
Core: Use ActionBuilder in FolderNavigationWidgetFactory
Change-Id: I1f113724c2c9aba6657bddcc9ecfa9c0f151a7e8 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -926,28 +926,31 @@ void FolderNavigationWidgetFactory::removeRootPath(Utils::Id id)
|
|||||||
|
|
||||||
void FolderNavigationWidgetFactory::registerActions()
|
void FolderNavigationWidgetFactory::registerActions()
|
||||||
{
|
{
|
||||||
Core::Context context(C_FOLDERNAVIGATIONWIDGET);
|
const Context context(C_FOLDERNAVIGATIONWIDGET);
|
||||||
|
|
||||||
auto add = new QAction(Tr::tr("Add New..."), this);
|
ActionBuilder(this, ADDNEWFILE)
|
||||||
Core::ActionManager::registerAction(add, ADDNEWFILE, context);
|
.setText(Tr::tr("Add New..."))
|
||||||
connect(add, &QAction::triggered, Core::ICore::instance(), [] {
|
.setContext(context)
|
||||||
if (auto navWidget = currentFolderNavigationWidget())
|
.addOnTriggered([] {
|
||||||
navWidget->addNewItem();
|
if (auto navWidget = currentFolderNavigationWidget())
|
||||||
});
|
navWidget->addNewItem();
|
||||||
|
});
|
||||||
|
|
||||||
auto rename = new QAction(Tr::tr("Rename..."), this);
|
ActionBuilder(this, RENAMEFILE)
|
||||||
Core::ActionManager::registerAction(rename, RENAMEFILE, context);
|
.setText(Tr::tr("Rename..."))
|
||||||
connect(rename, &QAction::triggered, Core::ICore::instance(), [] {
|
.setContext(context)
|
||||||
if (auto navWidget = currentFolderNavigationWidget())
|
.addOnTriggered([] {
|
||||||
navWidget->editCurrentItem();
|
if (auto navWidget = currentFolderNavigationWidget())
|
||||||
});
|
navWidget->editCurrentItem();
|
||||||
|
});
|
||||||
|
|
||||||
auto remove = new QAction(Tr::tr("Remove..."), this);
|
ActionBuilder(this, REMOVEFILE)
|
||||||
Core::ActionManager::registerAction(remove, REMOVEFILE, context);
|
.setText(Tr::tr("Remove..."))
|
||||||
connect(remove, &QAction::triggered, Core::ICore::instance(), [] {
|
.setContext(context)
|
||||||
if (auto navWidget = currentFolderNavigationWidget())
|
.addOnTriggered([] {
|
||||||
navWidget->removeCurrentItem();
|
if (auto navWidget = currentFolderNavigationWidget())
|
||||||
});
|
navWidget->removeCurrentItem();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int DelayedFileCrumbLabel::immediateHeightForWidth(int w) const
|
int DelayedFileCrumbLabel::immediateHeightForWidth(int w) const
|
||||||
|
|||||||
Reference in New Issue
Block a user