Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit db135c2e authored by Laurent Montel's avatar Laurent Montel 😁

Avoid to close dialog without ask if user wants to save modified file

parent 13d537a3
......@@ -21,6 +21,7 @@
#include "sieveeditorwidget.h"
#include <KLocalizedString>
#include <KMessageBox>
#include <QPushButton>
#include <QKeyEvent>
......@@ -178,3 +179,15 @@ void SieveEditor::addNormalMessage(const QString &msg)
{
d->mSieveEditorWidget->addNormalMessage(msg);
}
void SieveEditor::closeEvent(QCloseEvent *e)
{
if (d->mSieveEditorWidget->isModified()) {
if (KMessageBox::No == KMessageBox::warningYesNo(this, i18n("Script is modified. Do you want to close editor ?"))) {
e->ignore();
return;
}
}
Q_EMIT cancelClicked();
e->accept();
}
......@@ -60,7 +60,7 @@ Q_SIGNALS:
protected:
bool event(QEvent *e) override;
void closeEvent(QCloseEvent *e) override;
private:
void writeConfig();
void readConfig();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment