forked from qt-creator/qt-creator
ProjectExplorer: return back actions text
for Add New, Rename and Remove File actions. FolderNavigationWidgetFactory::registerActions with empty action text is called before ProjectExplorerPlugin::initialize with proper action registration Change-Id: I719f58735d672ad0831162a5f0cccebf73354976 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -850,21 +850,21 @@ void FolderNavigationWidgetFactory::registerActions()
|
|||||||
{
|
{
|
||||||
Core::Context context(C_FOLDERNAVIGATIONWIDGET);
|
Core::Context context(C_FOLDERNAVIGATIONWIDGET);
|
||||||
|
|
||||||
auto add = new QAction(this);
|
auto add = new QAction(tr("Add New..."), this);
|
||||||
Core::ActionManager::registerAction(add, Constants::ADDNEWFILE, context);
|
Core::ActionManager::registerAction(add, Constants::ADDNEWFILE, context);
|
||||||
connect(add, &QAction::triggered, Core::ICore::instance(), [] {
|
connect(add, &QAction::triggered, Core::ICore::instance(), [] {
|
||||||
if (auto navWidget = currentFolderNavigationWidget())
|
if (auto navWidget = currentFolderNavigationWidget())
|
||||||
navWidget->addNewItem();
|
navWidget->addNewItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto rename = new QAction(this);
|
auto rename = new QAction(tr("Rename..."), this);
|
||||||
Core::ActionManager::registerAction(rename, Constants::RENAMEFILE, context);
|
Core::ActionManager::registerAction(rename, Constants::RENAMEFILE, context);
|
||||||
connect(rename, &QAction::triggered, Core::ICore::instance(), [] {
|
connect(rename, &QAction::triggered, Core::ICore::instance(), [] {
|
||||||
if (auto navWidget = currentFolderNavigationWidget())
|
if (auto navWidget = currentFolderNavigationWidget())
|
||||||
navWidget->editCurrentItem();
|
navWidget->editCurrentItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto remove = new QAction(this);
|
auto remove = new QAction(tr("Remove..."), this);
|
||||||
Core::ActionManager::registerAction(remove, Constants::REMOVEFILE, context);
|
Core::ActionManager::registerAction(remove, Constants::REMOVEFILE, context);
|
||||||
connect(remove, &QAction::triggered, Core::ICore::instance(), [] {
|
connect(remove, &QAction::triggered, Core::ICore::instance(), [] {
|
||||||
if (auto navWidget = currentFolderNavigationWidget())
|
if (auto navWidget = currentFolderNavigationWidget())
|
||||||
|
@@ -1035,7 +1035,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
|
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
|
||||||
|
|
||||||
// add new file action
|
// add new file action
|
||||||
dd->m_addNewFileAction = new QAction(tr("Add New..."), this);
|
dd->m_addNewFileAction = new QAction(this);
|
||||||
cmd = ActionManager::registerAction(dd->m_addNewFileAction, Constants::ADDNEWFILE,
|
cmd = ActionManager::registerAction(dd->m_addNewFileAction, Constants::ADDNEWFILE,
|
||||||
projecTreeContext);
|
projecTreeContext);
|
||||||
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
|
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
|
||||||
@@ -1081,7 +1081,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
||||||
|
|
||||||
// remove file action
|
// remove file action
|
||||||
dd->m_removeFileAction = new QAction(tr("Remove File..."), this);
|
dd->m_removeFileAction = new QAction(this);
|
||||||
cmd = ActionManager::registerAction(dd->m_removeFileAction, Constants::REMOVEFILE,
|
cmd = ActionManager::registerAction(dd->m_removeFileAction, Constants::REMOVEFILE,
|
||||||
projecTreeContext);
|
projecTreeContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Delete);
|
cmd->setDefaultKeySequence(QKeySequence::Delete);
|
||||||
@@ -1107,7 +1107,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
||||||
|
|
||||||
// renamefile action
|
// renamefile action
|
||||||
dd->m_renameFileAction = new QAction(tr("Rename..."), this);
|
dd->m_renameFileAction = new QAction(this);
|
||||||
cmd = ActionManager::registerAction(dd->m_renameFileAction, Constants::RENAMEFILE,
|
cmd = ActionManager::registerAction(dd->m_renameFileAction, Constants::RENAMEFILE,
|
||||||
projecTreeContext);
|
projecTreeContext);
|
||||||
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
||||||
|
Reference in New Issue
Block a user