forked from qt-creator/qt-creator
Run "New ..." dialog as non-blocking, stay-on-top.
Task-number: QTCREATORBUG-6102 Change-Id: I384c37e5867ce1cbd6127e96c49cb7790298713c Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -122,7 +122,7 @@ WizardEventLoop::WizardResult WizardEventLoop::execWizardPage(QWizard &wizard)
|
|||||||
connect(&wizard, SIGNAL(currentIdChanged(int)), eventLoop, SLOT(pageChanged(int)));
|
connect(&wizard, SIGNAL(currentIdChanged(int)), eventLoop, SLOT(pageChanged(int)));
|
||||||
connect(&wizard, SIGNAL(accepted()), eventLoop, SLOT(accepted()));
|
connect(&wizard, SIGNAL(accepted()), eventLoop, SLOT(accepted()));
|
||||||
connect(&wizard, SIGNAL(rejected()), eventLoop, SLOT(rejected()));
|
connect(&wizard, SIGNAL(rejected()), eventLoop, SLOT(rejected()));
|
||||||
wizard.setAttribute(Qt::WA_ShowModal, true);
|
wizard.setWindowFlags(wizard.windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
wizard.show();
|
wizard.show();
|
||||||
}
|
}
|
||||||
const WizardResult result = eventLoop->execWizardPageI();
|
const WizardResult result = eventLoop->execWizardPageI();
|
||||||
@@ -138,7 +138,7 @@ WizardEventLoop::WizardResult WizardEventLoop::execWizardPage(QWizard &wizard)
|
|||||||
WizardEventLoop::WizardResult WizardEventLoop::execWizardPageI()
|
WizardEventLoop::WizardResult WizardEventLoop::execWizardPageI()
|
||||||
{
|
{
|
||||||
m_result = Rejected;
|
m_result = Rejected;
|
||||||
exec(QEventLoop::DialogExec);
|
exec();
|
||||||
return m_result;
|
return m_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,15 +31,19 @@
|
|||||||
#include "ui_newdialog.h"
|
#include "ui_newdialog.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <coreplugin/documentmanager.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QModelIndex>
|
|
||||||
#include <QAbstractProxyModel>
|
#include <QAbstractProxyModel>
|
||||||
#include <QSortFilterProxyModel>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QStandardItem>
|
|
||||||
#include <QItemDelegate>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QItemDelegate>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QModelIndex>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
#include <QStandardItem>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Core::IWizardFactory*)
|
Q_DECLARE_METATYPE(Core::IWizardFactory*)
|
||||||
|
|
||||||
@@ -183,12 +187,16 @@ Q_DECLARE_METATYPE(WizardFactoryContainer)
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
|
QString NewDialog::m_lastCategory = QString();
|
||||||
|
|
||||||
NewDialog::NewDialog(QWidget *parent) :
|
NewDialog::NewDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
m_ui(new Core::Internal::Ui::NewDialog),
|
m_ui(new Core::Internal::Ui::NewDialog),
|
||||||
m_okButton(0)
|
m_okButton(0)
|
||||||
{
|
{
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
QPalette p = m_ui->frame->palette();
|
QPalette p = m_ui->frame->palette();
|
||||||
p.setColor(QPalette::Window, p.color(QPalette::Base));
|
p.setColor(QPalette::Window, p.color(QPalette::Base));
|
||||||
@@ -236,8 +244,12 @@ static bool wizardFactoryLessThan(const IWizardFactory *f1, const IWizardFactory
|
|||||||
return f1->id().compare(f2->id()) < 0;
|
return f1->id().compare(f2->id()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewDialog::setWizardFactories(QList<IWizardFactory*> factories)
|
void NewDialog::setWizardFactories(QList<IWizardFactory *> factories,
|
||||||
|
const QString &defaultLocation,
|
||||||
|
const QVariantMap &extraVariables)
|
||||||
{
|
{
|
||||||
|
m_defaultLocation = defaultLocation;
|
||||||
|
m_extraVariables = extraVariables;
|
||||||
qStableSort(factories.begin(), factories.end(), wizardFactoryLessThan);
|
qStableSort(factories.begin(), factories.end(), wizardFactoryLessThan);
|
||||||
|
|
||||||
m_model->clear();
|
m_model->clear();
|
||||||
@@ -287,14 +299,13 @@ void NewDialog::setWizardFactories(QList<IWizardFactory*> factories)
|
|||||||
parentItem->removeRow(0);
|
parentItem->removeRow(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IWizardFactory *NewDialog::showDialog()
|
void NewDialog::showDialog()
|
||||||
{
|
{
|
||||||
static QString lastCategory;
|
|
||||||
QModelIndex idx;
|
QModelIndex idx;
|
||||||
|
|
||||||
if (!lastCategory.isEmpty())
|
if (!m_lastCategory.isEmpty())
|
||||||
foreach (QStandardItem* item, m_categoryItems) {
|
foreach (QStandardItem* item, m_categoryItems) {
|
||||||
if (item->data(Qt::UserRole) == lastCategory)
|
if (item->data(Qt::UserRole) == m_lastCategory)
|
||||||
idx = m_twoLevelProxyModel->mapToSource(m_model->indexFromItem(item));
|
idx = m_twoLevelProxyModel->mapToSource(m_model->indexFromItem(item));
|
||||||
}
|
}
|
||||||
if (!idx.isValid())
|
if (!idx.isValid())
|
||||||
@@ -312,18 +323,7 @@ Core::IWizardFactory *NewDialog::showDialog()
|
|||||||
currentItemChanged(m_ui->templatesView->rootIndex().child(0,0));
|
currentItemChanged(m_ui->templatesView->rootIndex().child(0,0));
|
||||||
|
|
||||||
updateOkButton();
|
updateOkButton();
|
||||||
|
show();
|
||||||
const int retVal = exec();
|
|
||||||
|
|
||||||
idx = m_ui->templateCategoryView->currentIndex();
|
|
||||||
QStandardItem *currentItem = m_model->itemFromIndex(m_twoLevelProxyModel->mapToSource(idx));
|
|
||||||
if (currentItem)
|
|
||||||
lastCategory = currentItem->data(Qt::UserRole).toString();
|
|
||||||
|
|
||||||
if (retVal != Accepted)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return currentWizardFactory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NewDialog::selectedPlatform() const
|
QString NewDialog::selectedPlatform() const
|
||||||
@@ -333,6 +333,18 @@ QString NewDialog::selectedPlatform() const
|
|||||||
return m_ui->comboBox->itemData(index).toString();
|
return m_ui->comboBox->itemData(index).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NewDialog::event(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
|
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||||
|
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||||
|
ke->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QDialog::event(event);
|
||||||
|
}
|
||||||
|
|
||||||
NewDialog::~NewDialog()
|
NewDialog::~NewDialog()
|
||||||
{
|
{
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
@@ -422,10 +434,48 @@ void NewDialog::currentItemChanged(const QModelIndex &index)
|
|||||||
updateOkButton();
|
updateOkButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewDialog::saveState()
|
||||||
|
{
|
||||||
|
QModelIndex idx = m_ui->templateCategoryView->currentIndex();
|
||||||
|
QStandardItem *currentItem = m_model->itemFromIndex(m_twoLevelProxyModel->mapToSource(idx));
|
||||||
|
if (currentItem)
|
||||||
|
m_lastCategory = currentItem->data(Qt::UserRole).toString();
|
||||||
|
}
|
||||||
|
|
||||||
void NewDialog::okButtonClicked()
|
void NewDialog::okButtonClicked()
|
||||||
{
|
{
|
||||||
if (m_ui->templatesView->currentIndex().isValid())
|
if (m_ui->templatesView->currentIndex().isValid()) {
|
||||||
accept();
|
hide();
|
||||||
|
saveState();
|
||||||
|
|
||||||
|
IWizardFactory *wizard = currentWizardFactory();
|
||||||
|
QTC_ASSERT(wizard, accept(); return);
|
||||||
|
QString path = m_defaultLocation;
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
switch (wizard->kind()) {
|
||||||
|
case IWizardFactory::ProjectWizard:
|
||||||
|
// Project wizards: Check for projects directory or
|
||||||
|
// use last visited directory of file dialog. Never start
|
||||||
|
// at current.
|
||||||
|
path = DocumentManager::useProjectsDirectory() ?
|
||||||
|
DocumentManager::projectsDirectory() :
|
||||||
|
DocumentManager::fileDialogLastVisitedDirectory();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
path = DocumentManager::fileDialogInitialDirectory();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wizard->runWizard(path, ICore::dialogParent(), selectedPlatform(), m_extraVariables);
|
||||||
|
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewDialog::reject()
|
||||||
|
{
|
||||||
|
saveState();
|
||||||
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewDialog::updateOkButton()
|
void NewDialog::updateOkButton()
|
||||||
|
@@ -60,21 +60,28 @@ public:
|
|||||||
explicit NewDialog(QWidget *parent);
|
explicit NewDialog(QWidget *parent);
|
||||||
virtual ~NewDialog();
|
virtual ~NewDialog();
|
||||||
|
|
||||||
void setWizardFactories(QList<IWizardFactory*> factories);
|
void setWizardFactories(QList<IWizardFactory*> factories, const QString &defaultLocation, const QVariantMap &extraVariables);
|
||||||
|
|
||||||
Core::IWizardFactory *showDialog();
|
void showDialog();
|
||||||
QString selectedPlatform() const;
|
QString selectedPlatform() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void currentCategoryChanged(const QModelIndex &);
|
void currentCategoryChanged(const QModelIndex &);
|
||||||
void currentItemChanged(const QModelIndex &);
|
void currentItemChanged(const QModelIndex &);
|
||||||
void okButtonClicked();
|
void okButtonClicked();
|
||||||
|
void reject();
|
||||||
void updateOkButton();
|
void updateOkButton();
|
||||||
void setSelectedPlatform(const QString &platform);
|
void setSelectedPlatform(const QString &platform);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::IWizardFactory *currentWizardFactory() const;
|
Core::IWizardFactory *currentWizardFactory() const;
|
||||||
void addItem(QStandardItem *topLevelCategoryItem, IWizardFactory *factory);
|
void addItem(QStandardItem *topLevelCategoryItem, IWizardFactory *factory);
|
||||||
|
void saveState();
|
||||||
|
|
||||||
|
static QString m_lastCategory;
|
||||||
|
|
||||||
Ui::NewDialog *m_ui;
|
Ui::NewDialog *m_ui;
|
||||||
QStandardItemModel *m_model;
|
QStandardItemModel *m_model;
|
||||||
@@ -83,6 +90,8 @@ private:
|
|||||||
QPushButton *m_okButton;
|
QPushButton *m_okButton;
|
||||||
QIcon m_dummyIcon;
|
QIcon m_dummyIcon;
|
||||||
QList<QStandardItem*> m_categoryItems;
|
QList<QStandardItem*> m_categoryItems;
|
||||||
|
QString m_defaultLocation;
|
||||||
|
QVariantMap m_extraVariables;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -311,6 +311,11 @@ ICore *ICore::instance()
|
|||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ICore::isNewItemDialogRunning()
|
||||||
|
{
|
||||||
|
return m_mainwindow->isNewItemDialogRunning();
|
||||||
|
}
|
||||||
|
|
||||||
ICore::ICore(MainWindow *mainwindow)
|
ICore::ICore(MainWindow *mainwindow)
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
@@ -318,6 +323,8 @@ ICore::ICore(MainWindow *mainwindow)
|
|||||||
// Save settings once after all plugins are initialized:
|
// Save settings once after all plugins are initialized:
|
||||||
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()),
|
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()),
|
||||||
this, SLOT(saveSettings()));
|
this, SLOT(saveSettings()));
|
||||||
|
connect(m_mainwindow, SIGNAL(newItemDialogRunningChanged()),
|
||||||
|
this, SIGNAL(newItemDialogRunningChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ICore::~ICore()
|
ICore::~ICore()
|
||||||
|
@@ -67,6 +67,7 @@ public:
|
|||||||
// it returns a ICore.
|
// it returns a ICore.
|
||||||
static ICore *instance();
|
static ICore *instance();
|
||||||
|
|
||||||
|
static bool isNewItemDialogRunning();
|
||||||
static void showNewItemDialog(const QString &title,
|
static void showNewItemDialog(const QString &title,
|
||||||
const QList<IWizardFactory *> &factories,
|
const QList<IWizardFactory *> &factories,
|
||||||
const QString &defaultLocation = QString(),
|
const QString &defaultLocation = QString(),
|
||||||
@@ -126,6 +127,7 @@ signals:
|
|||||||
void coreAboutToOpen();
|
void coreAboutToOpen();
|
||||||
void coreOpened();
|
void coreOpened();
|
||||||
void newItemsDialogRequested();
|
void newItemsDialogRequested();
|
||||||
|
void newItemDialogRunningChanged();
|
||||||
void saveSettingsRequested();
|
void saveSettingsRequested();
|
||||||
void optionsDialogRequested();
|
void optionsDialogRequested();
|
||||||
void coreAboutToClose();
|
void coreAboutToClose();
|
||||||
|
@@ -76,6 +76,7 @@
|
|||||||
#include <coreplugin/settingsdatabase.h>
|
#include <coreplugin/settingsdatabase.h>
|
||||||
#include <utils/historycompleter.h>
|
#include <utils/historycompleter.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
@@ -248,6 +249,11 @@ void MainWindow::setIsFullScreen(bool fullScreen)
|
|||||||
m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
|
m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::isNewItemDialogRunning() const
|
||||||
|
{
|
||||||
|
return !m_newDialog.isNull();
|
||||||
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
ExtensionSystem::PluginManager::removeObject(m_shortcutSettings);
|
ExtensionSystem::PluginManager::removeObject(m_shortcutSettings);
|
||||||
@@ -869,46 +875,14 @@ void MainWindow::showNewItemDialog(const QString &title,
|
|||||||
const QString &defaultLocation,
|
const QString &defaultLocation,
|
||||||
const QVariantMap &extraVariables)
|
const QVariantMap &extraVariables)
|
||||||
{
|
{
|
||||||
// Scan for wizards matching the filter and pick one. Don't show
|
QTC_ASSERT(!m_newDialog, return);
|
||||||
// dialog if there is only one.
|
m_newAction->setEnabled(false);
|
||||||
IWizardFactory *wizard = 0;
|
m_newDialog = new NewDialog(this);
|
||||||
QString selectedPlatform;
|
connect(m_newDialog.data(), SIGNAL(destroyed()), this, SLOT(newItemDialogFinished()));
|
||||||
switch (factories.size()) {
|
m_newDialog->setWizardFactories(factories, defaultLocation, extraVariables);
|
||||||
case 0:
|
m_newDialog->setWindowTitle(title);
|
||||||
break;
|
m_newDialog->showDialog();
|
||||||
case 1:
|
emit newItemDialogRunningChanged();
|
||||||
wizard = factories.front();
|
|
||||||
break;
|
|
||||||
default: {
|
|
||||||
NewDialog dlg(this);
|
|
||||||
dlg.setWizardFactories(factories);
|
|
||||||
dlg.setWindowTitle(title);
|
|
||||||
wizard = dlg.showDialog();
|
|
||||||
selectedPlatform = dlg.selectedPlatform();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wizard)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString path = defaultLocation;
|
|
||||||
if (path.isEmpty()) {
|
|
||||||
switch (wizard->kind()) {
|
|
||||||
case IWizardFactory::ProjectWizard:
|
|
||||||
// Project wizards: Check for projects directory or
|
|
||||||
// use last visited directory of file dialog. Never start
|
|
||||||
// at current.
|
|
||||||
path = DocumentManager::useProjectsDirectory() ?
|
|
||||||
DocumentManager::projectsDirectory() :
|
|
||||||
DocumentManager::fileDialogLastVisitedDirectory();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
path = DocumentManager::fileDialogInitialDirectory();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wizard->runWizard(path, this, selectedPlatform, extraVariables);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::showOptionsDialog(Id category, Id page, QWidget *parent)
|
bool MainWindow::showOptionsDialog(Id category, Id page, QWidget *parent)
|
||||||
@@ -1263,5 +1237,12 @@ void MainWindow::restoreWindowState()
|
|||||||
m_statusBarManager->restoreSettings();
|
m_statusBarManager->restoreSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::newItemDialogFinished()
|
||||||
|
{
|
||||||
|
m_newAction->setEnabled(true);
|
||||||
|
// fire signal when the dialog is actually destroyed
|
||||||
|
QTimer::singleShot(0, this, SIGNAL(newItemDialogRunningChanged()));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "icontext.h"
|
#include "icontext.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
|
#include "dialogs/newdialog.h"
|
||||||
|
|
||||||
#include <utils/appmainwindow.h>
|
#include <utils/appmainwindow.h>
|
||||||
|
|
||||||
@@ -107,8 +108,12 @@ public:
|
|||||||
void setOverrideColor(const QColor &color);
|
void setOverrideColor(const QColor &color);
|
||||||
|
|
||||||
void setIsFullScreen(bool fullScreen);
|
void setIsFullScreen(bool fullScreen);
|
||||||
|
|
||||||
|
bool isNewItemDialogRunning() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void windowActivated();
|
void windowActivated();
|
||||||
|
void newItemDialogRunningChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void newFile();
|
void newFile();
|
||||||
@@ -148,6 +153,7 @@ private slots:
|
|||||||
void destroyVersionDialog();
|
void destroyVersionDialog();
|
||||||
void openDelayedFiles();
|
void openDelayedFiles();
|
||||||
void restoreWindowState();
|
void restoreWindowState();
|
||||||
|
void newItemDialogFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateContextObject(const QList<IContext *> &context);
|
void updateContextObject(const QList<IContext *> &context);
|
||||||
@@ -179,6 +185,7 @@ private:
|
|||||||
RightPaneWidget *m_rightPaneWidget;
|
RightPaneWidget *m_rightPaneWidget;
|
||||||
Core::StatusBarWidget *m_outputView;
|
Core::StatusBarWidget *m_outputView;
|
||||||
VersionDialog *m_versionDialog;
|
VersionDialog *m_versionDialog;
|
||||||
|
QPointer<NewDialog> m_newDialog;
|
||||||
|
|
||||||
QList<IContext *> m_activeContext;
|
QList<IContext *> m_activeContext;
|
||||||
|
|
||||||
|
@@ -1044,6 +1044,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
connect(ICore::instance(), SIGNAL(coreAboutToOpen()),
|
connect(ICore::instance(), SIGNAL(coreAboutToOpen()),
|
||||||
this, SLOT(determineSessionToRestoreAtStartup()));
|
this, SLOT(determineSessionToRestoreAtStartup()));
|
||||||
connect(ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
|
connect(ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
|
||||||
|
connect(ICore::instance(), SIGNAL(newItemDialogRunningChanged()),
|
||||||
|
this, SLOT(updateActions()));
|
||||||
|
|
||||||
updateWelcomePage();
|
updateWelcomePage();
|
||||||
|
|
||||||
@@ -1933,6 +1935,8 @@ void ProjectExplorerPlugin::updateActions()
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "ProjectExplorerPlugin::updateActions";
|
qDebug() << "ProjectExplorerPlugin::updateActions";
|
||||||
|
|
||||||
|
d->m_newAction->setEnabled(!ICore::isNewItemDialogRunning());
|
||||||
|
|
||||||
Project *project = SessionManager::startupProject();
|
Project *project = SessionManager::startupProject();
|
||||||
|
|
||||||
QPair<bool, QString> buildActionState = buildSettingsEnabled(project);
|
QPair<bool, QString> buildActionState = buildSettingsEnabled(project);
|
||||||
@@ -2780,9 +2784,11 @@ void ProjectExplorerPlugin::updateContextMenuActions()
|
|||||||
}
|
}
|
||||||
if (qobject_cast<FolderNode*>(d->m_currentNode)) {
|
if (qobject_cast<FolderNode*>(d->m_currentNode)) {
|
||||||
// Also handles ProjectNode
|
// Also handles ProjectNode
|
||||||
d->m_addNewFileAction->setEnabled(actions.contains(ProjectExplorer::AddNewFile));
|
d->m_addNewFileAction->setEnabled(actions.contains(ProjectExplorer::AddNewFile)
|
||||||
|
&& !ICore::isNewItemDialogRunning());
|
||||||
d->m_addNewSubprojectAction->setEnabled(d->m_currentNode->nodeType() == ProjectNodeType
|
d->m_addNewSubprojectAction->setEnabled(d->m_currentNode->nodeType() == ProjectNodeType
|
||||||
&& actions.contains(ProjectExplorer::AddSubProject));
|
&& actions.contains(ProjectExplorer::AddSubProject)
|
||||||
|
&& !ICore::isNewItemDialogRunning());
|
||||||
d->m_addExistingFilesAction->setEnabled(actions.contains(ProjectExplorer::AddExistingFile));
|
d->m_addExistingFilesAction->setEnabled(actions.contains(ProjectExplorer::AddExistingFile));
|
||||||
d->m_addExistingDirectoryAction->setEnabled(actions.contains(ProjectExplorer::AddExistingDirectory));
|
d->m_addExistingDirectoryAction->setEnabled(actions.contains(ProjectExplorer::AddExistingDirectory));
|
||||||
d->m_renameFileAction->setEnabled(actions.contains(ProjectExplorer::Rename));
|
d->m_renameFileAction->setEnabled(actions.contains(ProjectExplorer::Rename));
|
||||||
|
Reference in New Issue
Block a user