]> git.sesse.net Git - kdenlive/blobdiff - src/renderwidget.cpp
Make sure there is no write error when saving a file:
[kdenlive] / src / renderwidget.cpp
index b16c0e34b8b61db3eaea9ccd3f67401b9220aa30..84af5b95ee8cacf00870d14aab7c988d4cd4beda 100644 (file)
@@ -318,6 +318,11 @@ void RenderWidget::slotSaveProfile() {
         }
         QTextStream out(&file);
         out << doc.toString();
+        if (file.error() != QFile::NoError) {
+            KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
+            file.close();
+            return;
+        }
         file.close();
         parseProfiles(newMetaGroupId, newGroupName, newProfileName);
     }
@@ -410,18 +415,21 @@ void RenderWidget::slotEditProfile() {
         profiles.appendChild(profileElement);
 
         //QCString save = doc.toString().utf8();
-
+        delete d;
         if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
-            KMessageBox::sorry(this, i18n("Unable to write to file %1", exportFile));
-            delete d;
+            KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
             return;
         }
         QTextStream out(&file);
         out << doc.toString();
+        if (file.error() != QFile::NoError) {
+            KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
+            file.close();
+            return;
+        }
         file.close();
         parseProfiles(newMetaGroupId, newGroupName, newProfileName);
-    }
-    delete d;
+    } else delete d;
 }
 
 void RenderWidget::slotDeleteProfile(bool refresh) {
@@ -473,6 +481,11 @@ void RenderWidget::slotDeleteProfile(bool refresh) {
     }
     QTextStream out(&file);
     out << doc.toString();
+    if (file.error() != QFile::NoError) {
+        KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
+        file.close();
+        return;
+    }
     file.close();
     if (refresh) {
         parseProfiles(metaGroupId, currentGroup);