]> git.sesse.net Git - kdenlive/commitdiff
Show error message if Kdenlive cannot save the project
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 31 Oct 2008 13:16:41 +0000 (13:16 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 31 Oct 2008 13:16:41 +0000 (13:16 +0000)
svn path=/branches/KDE4/; revision=2608

src/kdenlivedoc.cpp
src/kdenlivedoc.h
src/mainwindow.cpp

index db4b3ef395d7d0a8032b201b9d864d44cdb958d0..c6322e7c0cbf5c432a8c9db03d7aa77664447e11 100644 (file)
@@ -558,7 +558,7 @@ QString KdenliveDoc::colorToString(const QColor& c) {
     return ret;
 }
 
-void KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
+bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
     QDomNode wes = sceneList.elementsByTagName("westley").at(0);
 
     QDomElement addedXml = sceneList.createElement("kdenlivedoc");
@@ -592,12 +592,13 @@ void KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
     QFile file(path);
     if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
         kWarning() << "//////  ERROR writing to file: " << path;
-        return;
+        KMessageBox::error(kapp->activeWindow(), i18n("Cannot write to file %1", path));
+        return false;
     }
     QTextStream out(&file);
     out << sceneList.toString();
     file.close();
-
+    return true;
 }
 
 QDomElement KdenliveDoc::documentInfoXml() {
index ce1ffafd401f465505293ec085c324e13aa95f8e..f301c4330b3008834e7ffd9045d25b2bf23744f0 100644 (file)
@@ -105,7 +105,7 @@ Q_OBJECT public:
     int zoom() const;
     const double dar();
     double projectDuration() const;
-    void saveSceneList(const QString &path, QDomDocument sceneList);
+    bool saveSceneList(const QString &path, QDomDocument sceneList);
 
 private:
     KUrl m_url;
index 67e4c0a883287ed8a03cf22903a5b27b36aa806e..5cb881cebfa1c924c0ad196fcf41a123f07c42f4 100644 (file)
@@ -935,7 +935,8 @@ void MainWindow::closeCurrentDocument() {
 
 void MainWindow::saveFileAs(const QString &outputFileName) {
     QDomDocument currentSceneList = m_projectMonitor->sceneList();
-    m_activeDocument->saveSceneList(outputFileName, currentSceneList);
+    if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
+       return;
     m_activeDocument->setUrl(KUrl(outputFileName));
     if (m_activeDocument->m_autosave == NULL) {
         m_activeDocument->m_autosave = new KAutoSaveFile(KUrl(outputFileName), this);