Commit 44935f20 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Always inform user if a file write fails

parent e2046ae1
Pipeline #206258 passed with stage
in 10 minutes and 57 seconds
......@@ -1007,6 +1007,8 @@ void KdenliveDoc::saveCustomEffects(const QDomNodeList &customeffects)
out.setCodec("UTF-8");
#endif
out << doc.toString();
} else {
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot write to file %1", file.fileName()));
}
}
}
......
......@@ -7,13 +7,16 @@
#include "abstractmodel/treeitem.hpp"
#include "effects/effectsrepository.hpp"
#include "kdenlivesettings.h"
#include <KLocalizedString>
#include <QApplication>
#include <QDomDocument>
#include <QFile>
#include <array>
#include <vector>
#include <KActionCategory>
#include <KLocalizedString>
#include <KMessageBox>
#include <QDebug>
#include <QMenu>
#include <QMessageBox>
......@@ -246,6 +249,8 @@ void EffectTreeModel::editCustomAsset(const QString &newName, const QString &new
out.setCodec("UTF-8");
#endif
out << doc.toString();
} else {
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot write to file %1", file.fileName()));
}
file.close();
......@@ -260,6 +265,8 @@ void EffectTreeModel::editCustomAsset(const QString &newName, const QString &new
out.setCodec("UTF-8");
#endif
out << doc.toString();
} else {
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot write to file %1", file.fileName()));
}
file.close();
reloadEffect(oldpath);
......
......@@ -9,11 +9,15 @@
#include "profiles/profilemodel.hpp"
#include "xml/xml.hpp"
#include <KLocalizedString>
#include <QApplication>
#include <QDir>
#include <QFile>
#include <QStandardPaths>
#include <QTextStream>
#include <KLocalizedString>
#include <KMessageBox>
#include <mlt++/Mlt.h>
std::unique_ptr<EffectsRepository> EffectsRepository::instance;
......@@ -383,6 +387,8 @@ QPair<QString, QString> EffectsRepository::fixCustomAssetFile(const QString &pat
out.setCodec("UTF-8");
#endif
out << doc.toString();
} else {
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot write to file %1", file.fileName()));
}
file.close();
results.first = path;
......
......@@ -566,6 +566,8 @@ void CollapsibleEffectView::slotSaveEffect()
out.setCodec("UTF-8");
#endif
out << doc.toString();
} else {
KMessageBox::sorry(this, i18n("Cannot write to file %1", file.fileName()));
}
file.close();
emit reloadEffect(dir.absoluteFilePath(name + QStringLiteral(".xml")));
......
......@@ -545,6 +545,8 @@ void EffectStackView::slotSaveStack()
out.setCodec("UTF-8");
#endif
out << doc.toString();
} else {
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot write to file %1", file.fileName()));
}
file.close();
emit reloadEffect(dir.absoluteFilePath(name + QStringLiteral(".xml")));
......
Supports Markdown
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