From d0973148731fbd60269b83aebc3a717800642d20 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 19 Nov 2021 11:28:25 +0100 Subject: [PATCH] Split "New File or Project" into "File" and "Project" parts This was non-standard to begin with, and splitting it makes it possible to have different designs for New Project and New File dialogs that are more tailored for the different needs (as is done in Design Studio) Change-Id: Ie6246e3c3f3527702c4562ec6f8fcbf5fae6c6ad Reviewed-by: Leena Miettinen Reviewed-by: hjk --- .../creator-only/creator-modeling.qdoc | 2 +- .../editors/creator-only/creator-scxml.qdoc | 2 +- .../src/howto/creator-keyboard-shortcuts.qdoc | 5 +- .../howto/creator-only/creator-autotest.qdoc | 8 ++-- .../howto/creator-only/creator-how-tos.qdoc | 4 +- doc/qtcreator/src/mcu/creator-mcu-dev.qdoc | 2 +- .../creator-projects-creating.qdoc | 8 ++-- .../creator-projects-custom-wizards.qdoc | 4 +- .../creator-projects-generic.qdoc | 2 +- .../creator-projects-libraries.qdoc | 2 +- .../creator-only/creator-projects-nimble.qdoc | 4 +- .../creator-only/qtquick-app-tutorial.qdoc | 4 +- .../creator-only/qtquick-creating.qdoc | 6 +-- .../qtquick-from-qmlproject-to-pro.qdoc | 2 +- .../src/vcs/creator-only/creator-vcs.qdoc | 2 +- .../src/widgets/qtdesigner-app-tutorial.qdoc | 8 ++-- .../src/common-extension-tasks.qdoc | 2 +- doc/qtcreatordev/src/first-plugin.qdoc | 2 +- .../src/qtcreator-dev-wizards.qdoc | 6 +-- doc/qtcreatordev/src/qtcreator-dev.qdoc | 2 +- .../coreplugin/dialogs/newdialogwidget.cpp | 2 + src/plugins/coreplugin/iwizardfactory.cpp | 2 +- src/plugins/coreplugin/mainwindow.cpp | 46 +++++++++---------- 23 files changed, 66 insertions(+), 61 deletions(-) diff --git a/doc/qtcreator/src/editors/creator-only/creator-modeling.qdoc b/doc/qtcreator/src/editors/creator-only/creator-modeling.qdoc index 10e40c2849c..876c296d454 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-modeling.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-modeling.qdoc @@ -159,7 +159,7 @@ \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New File} > \uicontrol Modeling > \uicontrol Model > or \uicontrol {Scratch Model} > \uicontrol Choose to create a model or a scratch model. diff --git a/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc b/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc index a8eee8965c5..9aadd3702e9 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc @@ -110,7 +110,7 @@ \li Select \uicontrol {Restart Now} to restart \QC and load the plugin. - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New File} > \uicontrol {Files and Classes} > \uicontrol Modeling > \uicontrol {State Chart} > \uicontrol Choose to create an empty state chart and to open it in the SCXML editor. diff --git a/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc b/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc index 8ac3aff9aa1..377cb5a4c9b 100644 --- a/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc +++ b/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc @@ -143,7 +143,10 @@ \li Open file or project \li Ctrl+O \row - \li New file or project + \li New project + \li Ctrl+Shift+N + \row + \li New file \li Ctrl+N \row \li Open in external editor diff --git a/doc/qtcreator/src/howto/creator-only/creator-autotest.qdoc b/doc/qtcreator/src/howto/creator-only/creator-autotest.qdoc index 85a7a2256c0..8fde8a2ea95 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-autotest.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-autotest.qdoc @@ -81,7 +81,7 @@ To create a Qt or Qt Quick test: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Other Project} > \uicontrol {Auto Test Project} > \uicontrol Choose to create a project with boilerplate code for a Qt test or a Qt Quick test. @@ -126,7 +126,7 @@ To create a Google test: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Other Project} > \uicontrol {Auto Test Project} > \uicontrol Choose to create a project with boilerplate code for a Google test. @@ -180,7 +180,7 @@ To create a Boost test: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Other Project} > \uicontrol {Auto Test Project} > \uicontrol Choose to create a project with boilerplate code for a Boost test. @@ -221,7 +221,7 @@ To create a basic Catch2 test: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Other Project} > \uicontrol {Auto Test Project} > \uicontrol Choose to create a project with boilerplate code for a Catch2 test. diff --git a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc index 229abbddb5e..a7be1b3c0a8 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc @@ -326,8 +326,8 @@ \section1 Quickly write down notes somewhere - Select \uicontrol File > \uicontrol {New File or Project} > - \uicontrol {Files and Classes} > \uicontrol General > \uicontrol {Scratch Buffer}. + Select \uicontrol File > \uicontrol {New File} > + \uicontrol General > \uicontrol {Scratch Buffer}. Alternatively, \key {Ctrl+N} can be used to open this dialog, which is fully navigable via keyboard by using the up and down arrow keys and the tab key. diff --git a/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc b/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc index 479ae52ea4e..198148def46 100644 --- a/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc +++ b/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc @@ -184,7 +184,7 @@ To create an application and run it on a MCU board: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Application (Qt for MCU)} > \uicontrol {MCU Support Application} > \uicontrol Choose. \li Follow the instructions of the wizard to create the project. diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc index 76a67382562..30e54823273 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc @@ -226,7 +226,7 @@ This enables you to use \QC as a code editor. \endtable - To create a new project, select \uicontrol File > \uicontrol{New File or Project} and + To create a new project, select \uicontrol File > \uicontrol{New Project} and select the type of your project. The contents of the wizard dialogs depend on the project type and the \l{glossary-buildandrun-kit}{kits} that you select in the \uicontrol {Kit Selection} dialog. Follow the instructions of the wizard. @@ -387,7 +387,7 @@ platform-independent mechanism for storing files in the application's executable. - \image qtcreator-add-resource-wizard.png "New File or Project dialog" + \image qtcreator-add-resource-wizard.png "New File dialog" The wizard creates a resource collection file (.qrc) that you can manage in the resource editor. @@ -472,7 +472,7 @@ must specify that qmake uses the \c subdirs template to build the project. To create a root project, select \uicontrol File > - \uicontrol {New File or Project} > \uicontrol {Other Project} > + \uicontrol {New Project} > \uicontrol {Other Project} > \uicontrol {Subdirs Project} > \uicontrol Choose. On the \uicontrol Summary page, select \uicontrol {Finish & Add Subproject} to create @@ -503,7 +503,7 @@ If you use a wizard regularly, you can bind a custom keyboard shortcut to it. Triggering this keyboard shortcut will directly open the wizard without - the need to navigate to \uicontrol File > \uicontrol {New File or Project}. + the need to navigate to \uicontrol File > \uicontrol {New File} or \uicontrol {New Project}. Keyboard shortcuts for wizards can be set in \uicontrol Tools > \uicontrol Options > \uicontrol Environment > \uicontrol Keyboard > diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards.qdoc index 6a919d5da2b..0a4fc154023 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards.qdoc @@ -60,7 +60,7 @@ directories \QC searches wizards from. \QC displays the wizards that it finds in the - \uicontrol {New File or Project} dialog. For each wizard, an icon (1), a + \uicontrol {New File} and \uicontrol {New Project} dialogs. For each wizard, an icon (1), a display name (2), and a description (3) are displayed. \image qtcreator-custom-wizard.png @@ -126,7 +126,7 @@ \li \uicontrol {Factory.Reset} \li Triggering this action makes \QC forget all wizard factories, causing it to reload all wizard definitions when for example - opening \uicontrol File > \uicontrol {New File or Project}. + opening \uicontrol File > \uicontrol {New Project}. This way you can avoid having to restart \QC for your changes to a wizard definition to become visible. \endtable diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-generic.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-generic.qdoc index df454aaa6d1..1661c8bdc32 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-generic.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-generic.qdoc @@ -51,7 +51,7 @@ \list 1 - \li Select \uicontrol File > \uicontrol{New File or Project} > \uicontrol{Import Project} + \li Select \uicontrol File > \uicontrol{New Project} > \uicontrol{Import Project} > \uicontrol{Import Existing Project}. \li In \uicontrol{Import Existing Project}, enter the project name diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-libraries.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-libraries.qdoc index 6360edc893e..699a8f0fd8c 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-libraries.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-libraries.qdoc @@ -104,7 +104,7 @@ \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol Library > \uicontrol {C++ Library}. \li Select \uicontrol Choose to open the \uicontrol {Project Location} diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-nimble.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-nimble.qdoc index 0860df2dbe1..f367625726c 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-nimble.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-nimble.qdoc @@ -71,8 +71,8 @@ managed with Nimble: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > - \uicontrol Projects > \uicontrol {Non-Qt Project} > + \li Select \uicontrol File > \uicontrol {New Project} > + \uicontrol {Non-Qt Project} > \uicontrol {Nimble Application}. \li Specify the name and location of the application. \li Select \uicontrol Next. diff --git a/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc b/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc index 75495477244..abf3dec533e 100644 --- a/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc +++ b/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc @@ -77,8 +77,8 @@ To create a custom QML type: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > - \uicontrol {Files and Classes} > \uicontrol Qt > + \li Select \uicontrol File > \uicontrol {New File} > + \uicontrol Qt > \uicontrol {QML File (Qt Quick 2)}. \li Select \uicontrol Choose to open the \uicontrol Location dialog. \li In the \uicontrol {File name} field, enter a name for the custom diff --git a/doc/qtcreator/src/qtquick/creator-only/qtquick-creating.qdoc b/doc/qtcreator/src/qtquick/creator-only/qtquick-creating.qdoc index cea341db4b8..c3f4d9d1bb3 100644 --- a/doc/qtcreator/src/qtquick/creator-only/qtquick-creating.qdoc +++ b/doc/qtcreator/src/qtquick/creator-only/qtquick-creating.qdoc @@ -36,7 +36,7 @@ \title Creating Qt Quick Projects - \image qmldesigner-new-project.png "New File or Project dialog" + \image qmldesigner-new-project.png "New Project dialog" The following table lists the wizard templates for creating a new Qt Quick project from scratch. @@ -90,7 +90,7 @@ \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Application (Qt)} > \uicontrol {Qt Quick Application} > \uicontrol Choose. @@ -185,7 +185,7 @@ \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Other Project} > \uicontrol {Qt Quick UI Prototype}. \li Select \uicontrol Choose to open the \uicontrol {Project Location} diff --git a/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc b/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc index b1c7c4d3ce9..289c61b41f2 100644 --- a/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc @@ -99,7 +99,7 @@ file: \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Application (Qt)} > \uicontrol {Qt Quick Application} > \uicontrol Choose. \li In the \uicontrol {Build system} field, select \l qmake as the build diff --git a/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc b/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc index e981c40e57c..c00cd06cb1b 100644 --- a/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc +++ b/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc @@ -105,7 +105,7 @@ in the submenu for the version control system. To import a project that is under version control, choose \uicontrol File > - \uicontrol {New File or Project} > \uicontrol {Project from Version Control} + \uicontrol {New Project} > \uicontrol {Project from Version Control} and select the version control system that you use. Follow the instructions of the wizard to import the project. diff --git a/doc/qtcreator/src/widgets/qtdesigner-app-tutorial.qdoc b/doc/qtcreator/src/widgets/qtdesigner-app-tutorial.qdoc index 2dab21729ec..d2359700227 100644 --- a/doc/qtcreator/src/widgets/qtdesigner-app-tutorial.qdoc +++ b/doc/qtcreator/src/widgets/qtdesigner-app-tutorial.qdoc @@ -47,11 +47,11 @@ \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol {Application (Qt)} > \uicontrol {Qt Widgets Application} > \uicontrol Choose. - \image qtcreator-new-qt-gui-application.png "New File or Project dialog" + \image qtcreator-new-qt-gui-application.png "New Project dialog" The \uicontrol{Introduction and Project Location} dialog opens. @@ -301,10 +301,10 @@ \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New File} > \uicontrol Qt > \uicontrol {Qt Resource File} > \uicontrol Choose. - \image qtcreator-add-resource-wizard.png "New File or Project dialog" + \image qtcreator-add-resource-wizard.png "New File dialog" The \uicontrol {Choose the Location} dialog opens. diff --git a/doc/qtcreatordev/src/common-extension-tasks.qdoc b/doc/qtcreatordev/src/common-extension-tasks.qdoc index 807c84e1bde..7f514af3706 100644 --- a/doc/qtcreatordev/src/common-extension-tasks.qdoc +++ b/doc/qtcreatordev/src/common-extension-tasks.qdoc @@ -61,7 +61,7 @@ \row \li Add a new wizard. \li You can extend the wizards in \uicontrol File > - \uicontrol {New File or Project} with your own file + \uicontrol {New File} and \uicontrol {New Project} with your own file and project templates. We recommend that you create JSON-based wizards instead of implementing new wizards in C++ code. diff --git a/doc/qtcreatordev/src/first-plugin.qdoc b/doc/qtcreatordev/src/first-plugin.qdoc index 9b347facc35..99c709a7133 100644 --- a/doc/qtcreatordev/src/first-plugin.qdoc +++ b/doc/qtcreatordev/src/first-plugin.qdoc @@ -48,7 +48,7 @@ with. \list 1 - \li Select \uicontrol File > \uicontrol {New File or Project} > + \li Select \uicontrol File > \uicontrol {New Project} > \uicontrol Library > \uicontrol {Qt Creator Plugin} > \uicontrol Choose. diff --git a/doc/qtcreatordev/src/qtcreator-dev-wizards.qdoc b/doc/qtcreatordev/src/qtcreator-dev-wizards.qdoc index ddb11119eae..1888f7516ec 100644 --- a/doc/qtcreatordev/src/qtcreator-dev-wizards.qdoc +++ b/doc/qtcreatordev/src/qtcreator-dev-wizards.qdoc @@ -44,7 +44,7 @@ the wizard does and what its UI looks like. \li Providing a set of parameters that determine how the wizard shows up - in the list of wizards in the \uicontrol {New File or Project} dialog. + in the list of wizards in the \uicontrol {New File} or \uicontrol {New Project} dialog. When deriving from Core::IWizardFactory, the constructor has to call the following setters provided by the base class: @@ -103,7 +103,7 @@ \section2 Setters and Getters of IWizardFactory The setters and getters listed below determine how the wizard shows up - in the list of wizards in the \uicontrol {New File or Project} dialog. + in the list of wizards in the \uicontrol {New File} or \uicontrol {New Project} dialog. \table \header @@ -151,6 +151,6 @@ \endtable All wizards that have the same category set will be grouped together in the - \uicontrol {New File or Project} dialog. + \uicontrol {New File} or \uicontrol {New Project} dialog. */ diff --git a/doc/qtcreatordev/src/qtcreator-dev.qdoc b/doc/qtcreatordev/src/qtcreator-dev.qdoc index 74ba98bcb26..7a1e1093be8 100644 --- a/doc/qtcreatordev/src/qtcreator-dev.qdoc +++ b/doc/qtcreatordev/src/qtcreator-dev.qdoc @@ -67,7 +67,7 @@ \section2 File and Project Templates You can extend the wizards in \uicontrol File > - \uicontrol {New File or Project} with your own file and project templates by + \uicontrol {New File} or \uicontrol {New Project} with your own file and project templates by writing JSON definition files for them. \list \li \l{https://doc.qt.io/qtcreator/creator-project-wizards.html} diff --git a/src/plugins/coreplugin/dialogs/newdialogwidget.cpp b/src/plugins/coreplugin/dialogs/newdialogwidget.cpp index 66569b85cfe..a6feb9b11ce 100644 --- a/src/plugins/coreplugin/dialogs/newdialogwidget.cpp +++ b/src/plugins/coreplugin/dialogs/newdialogwidget.cpp @@ -285,6 +285,8 @@ void NewDialogWidget::setWizardFactories(QList factories, } addItem(kindItem, factory); } + if (filesKindItem->columnCount() == 0) + parentItem->removeRow(1); if (projectKindItem->columnCount() == 0) parentItem->removeRow(0); } diff --git a/src/plugins/coreplugin/iwizardfactory.cpp b/src/plugins/coreplugin/iwizardfactory.cpp index ea4ec09e774..60ec5c2b35d 100644 --- a/src/plugins/coreplugin/iwizardfactory.cpp +++ b/src/plugins/coreplugin/iwizardfactory.cpp @@ -54,7 +54,7 @@ {Adding New Custom Wizards}. The wizard interface is a very thin abstraction for the wizards in - \uicontrol File > \uicontrol {New File or Project}. + \uicontrol File > \uicontrol {New File} and \uicontrol{New Project}. Basically, it defines what to show to the user in the wizard selection dialogs, and a hook that is called if the user selects the wizard. diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index d2043b733ae..a21aa7fcf2a 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -528,38 +528,38 @@ void MainWindow::registerDefaultActions() // New File Action QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), Utils::Icons::NEWFILE.icon()); - const bool isQDS = isQtDesignStudio(); - const QString newActionText = isQDS ? tr("&New Project...") : tr("&New File or Project..."); - m_newAction = new QAction(icon, newActionText, this); + m_newAction = new QAction(icon, tr("&New Project..."), this); cmd = ActionManager::registerAction(m_newAction, Constants::NEW); - cmd->setDefaultKeySequence(QKeySequence::New); + cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+N")); mfile->addAction(cmd, Constants::G_FILE_NEW); connect(m_newAction, &QAction::triggered, this, []() { if (!ICore::isNewItemDialogRunning()) { - ICore::showNewItemDialog(tr("New File or Project", "Title of dialog"), - IWizardFactory::allWizardFactories(), FilePath()); + ICore::showNewItemDialog( + tr("New Project", "Title of dialog"), + Utils::filtered(Core::IWizardFactory::allWizardFactories(), + Utils::equal(&Core::IWizardFactory::kind, + Core::IWizardFactory::ProjectWizard)), + FilePath()); } else { ICore::raiseWindow(ICore::newItemDialog()); } }); - if (isQDS) { - auto action = new QAction(icon, tr("New File..."), this); - cmd = ActionManager::registerAction(action, Constants::NEW_FILE); - mfile->addAction(cmd, Constants::G_FILE_NEW); - connect(action, &QAction::triggered, this, []() { - if (!ICore::isNewItemDialogRunning()) { - ICore::showNewItemDialog( - tr("New File", "Title of dialog"), - Utils::filtered(Core::IWizardFactory::allWizardFactories(), - Utils::equal(&Core::IWizardFactory::kind, - Core::IWizardFactory::FileWizard)), - FilePath()); - } else { - ICore::raiseWindow(ICore::newItemDialog()); - } - }); - } + auto action = new QAction(icon, tr("New File..."), this); + cmd = ActionManager::registerAction(action, Constants::NEW_FILE); + cmd->setDefaultKeySequence(QKeySequence::New); + mfile->addAction(cmd, Constants::G_FILE_NEW); + connect(action, &QAction::triggered, this, []() { + if (!ICore::isNewItemDialogRunning()) { + ICore::showNewItemDialog(tr("New File", "Title of dialog"), + Utils::filtered(Core::IWizardFactory::allWizardFactories(), + Utils::equal(&Core::IWizardFactory::kind, + Core::IWizardFactory::FileWizard)), + FilePath()); + } else { + ICore::raiseWindow(ICore::newItemDialog()); + } + }); // Open Action icon = QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon());