diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5347b208c..ce6874da5 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -101,6 +101,7 @@ MainWindow::MainWindow() : mUI.mActionClearResults->setEnabled(false); mUI.mActionSave->setEnabled(false); mUI.mActionRecheck->setEnabled(false); + EnableProjectOpenActions(true); EnableProjectActions(false); QStringList args = QCoreApplication::arguments(); @@ -238,6 +239,7 @@ void MainWindow::DoCheckFiles(const QStringList &files) Settings checkSettings = GetCppcheckSettings(); EnableProjectActions(false); + EnableProjectOpenActions(false); mThread->Check(checkSettings, false); } @@ -387,6 +389,7 @@ void MainWindow::CheckDone() mUI.mActionSettings->setEnabled(true); mUI.mActionOpenXML->setEnabled(true); EnableProjectActions(true); + EnableProjectOpenActions(true); if (mUI.mResults->HasResults()) { @@ -762,6 +765,7 @@ void MainWindow::CloseProjectFile() delete mProject; mProject = NULL; EnableProjectActions(false); + EnableProjectOpenActions(true); FormatAndSetTitle(); } @@ -803,3 +807,9 @@ void MainWindow::EnableProjectActions(bool enable) mUI.mActionCloseProjectFile->setEnabled(enable); mUI.mActionEditProjectFile->setEnabled(enable); } + +void MainWindow::EnableProjectOpenActions(bool enable) +{ + mUI.mActionNewProjectFile->setEnabled(enable); + mUI.mActionOpenProjectFile->setEnabled(enable); +} diff --git a/gui/mainwindow.h b/gui/mainwindow.h index a8863b93d..b166f71ae 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -307,10 +307,19 @@ protected: /** * @brief Enable or disable project file actions. + * Project editing and closing actions should be only enabled when project is + * open and we are not checking files. * @param enable If true then actions are enabled. */ void EnableProjectActions(bool enable); + /** + * @brief Enable or disable project file actions. + * Project opening and creating actions should be disabled when checking. + * @param enable If true then actions are enabled. + */ + void EnableProjectOpenActions(bool enable); + /** * @brief Program settings *