Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.

Commit de3c774

Browse files
committed
Improve notification on file change
Signed-off-by: Alexander Scheel <[email protected]>
1 parent 94d2f0e commit de3c774

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/MainWindow.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "RemediationRoleSaver.h"
3838

3939
#include <QFileDialog>
40+
#include <QPushButton>
4041
#include <QAbstractEventDispatcher>
4142
#include <QCloseEvent>
4243
#include <QFileSystemWatcher>
@@ -1558,11 +1559,21 @@ void MainWindow::fileChanged(const QString& path)
15581559
return;
15591560
mFSLastSeen = path;
15601561

1561-
QMessageBox::information(
1562-
this, QObject::tr("SCAP Workbench"),
1563-
QObject::tr("Opened file was modified after opening: %1\n\n"
1564-
"To reload, click File -> Reload Opened Content").arg(path)
1565-
);
1562+
QMessageBox question;
1563+
question.setText(QObject::tr("The following file was modified after opening: %1").arg(path));
1564+
question.setInformativeText(QObject::tr("Do you wish to reload it, losing any unsaved tailoring changes?"));
1565+
1566+
QPushButton *reload = question.addButton(QObject::tr("Reload"), QMessageBox::AcceptRole);
1567+
QPushButton *ignore = question.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole);
1568+
question.setDefaultButton(ignore);
1569+
question.setIcon(QMessageBox::Question);
1570+
1571+
question.exec();
1572+
1573+
if (question.clickedButton() == reload)
1574+
{
1575+
reloadContent();
1576+
}
15661577
}
15671578

15681579
QString MainWindow::getDefaultSaveDirectory()

0 commit comments

Comments
 (0)