diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index cfaf97452..29d0bef42 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -59,7 +59,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : mCStandardActions(new QActionGroup(this)), mCppStandardActions(new QActionGroup(this)), mSelectLanguageActions(new QActionGroup(this)), - mExiting(false) + mExiting(false), + mIsLogfileLoaded(false) { mUI.setupUi(this); mThread = new ThreadHandler(this); @@ -359,10 +360,14 @@ void MainWindow::DoCheckFiles(const QStringList &files) } ClearResults(); + mIsLogfileLoaded = false; FileList pathList; pathList.AddPathList(files); - if (mProject) + if (mProject) { pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths()); + } else { + EnableProjectActions(false); + } QStringList fileNames = pathList.GetFileList(); mUI.mResults->Clear(true); @@ -729,7 +734,12 @@ void MainWindow::CheckDone() EnableCheckButtons(true); mUI.mActionSettings->setEnabled(true); mUI.mActionOpenXML->setEnabled(true); - EnableProjectActions(true); + if (mProject) { + EnableProjectActions(true); + } else if (mIsLogfileLoaded) { + mUI.mActionRecheckModified->setEnabled(false); + mUI.mActionRecheckAll->setEnabled(false); + } EnableProjectOpenActions(true); mPlatformActions->setEnabled(true); mCStandardActions->setEnabled(true); @@ -900,7 +910,12 @@ void MainWindow::OpenResults() void MainWindow::LoadResults(const QString selectedFile) { if (!selectedFile.isEmpty()) { + if (mProject) + CloseProjectFile(); + mIsLogfileLoaded = true; mUI.mResults->Clear(true); + mUI.mActionRecheckModified->setEnabled(false); + mUI.mActionRecheckAll->setEnabled(false); mUI.mResults->ReadErrorsXml(selectedFile); SetPath(SETTINGS_LAST_RESULT_PATH, selectedFile); } @@ -1181,6 +1196,7 @@ void MainWindow::LoadProjectFile(const QString &filePath) FormatAndSetTitle(tr("Project:") + QString(" ") + filename); AddProjectMRU(filePath); + mIsLogfileLoaded = false; mUI.mActionCloseProjectFile->setEnabled(true); mUI.mActionEditProjectFile->setEnabled(true); delete mProject; diff --git a/gui/mainwindow.h b/gui/mainwindow.h index ec4746e3f..c4db811cd 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -570,6 +570,11 @@ private: */ bool mExiting; + /** + * @brief Set in case of loading project file. + */ + bool mIsLogfileLoaded; + /** * @brief Project MRU menu actions. * List of MRU menu actions. Needs also to store the separator. diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 4d0db453e..c92ae0b5d 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -39,6 +39,7 @@ #include "printablereport.h" #include "applicationlist.h" #include "checkstatistics.h" +#include "path.h" ResultsView::ResultsView(QWidget * parent) : QWidget(parent), @@ -374,7 +375,7 @@ void ResultsView::UpdateDetails(const QModelIndex &index) .arg(tr("Message")).arg(message); const QString file0 = data["file0"].toString(); - if (file0 != "" && file0 != data["file"].toString()) + if (file0 != "" && Path::isHeader(data["file"].toString().toStdString())) formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0)); if (mUI.mTree->ShowIdColumn())