Bug 103219

Summary: Save action is disabled / dirty flag is cleared, even if saving failed
Product: [Applications] digikam Reporter: Will Stephenson <wstephenson>
Component: ImageEditor-SaveAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.7.3   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 7.5.0

Description Will Stephenson 2005-04-04 19:37:06 UTC
Version:           0.7.2 (using KDE 3.4.0 Level "b" , SUSE 9.3)
Compiler:          gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)
OS:                Linux (x86_64) release 2.6.11.4-20a-default

Edit an image which is mode 444 on the disk.  Save it.  You get an 'Access denied' message box. 

You'll notice that the Save action is now disabled, even though the save failed. 

I had a quick look in your source and it is because the move of the temporary file fails because of the file perms, but you update the UI and undo/redo state earlier, according to the result of the imlib tempfile save at the top of ImageWindow::save(), not according to the result of the SyncJob::file_move() at the bottom of ImageWindow::save().
Comment 1 Will Stephenson 2005-04-04 19:42:48 UTC
Still present in CVS
Comment 2 Tom Albers 2005-04-05 23:16:12 UTC
CVS commit by toma: 

Fixed the bug where the menu items thought the image was saved correctly because the temporary file was successfully saved. But if the real image file misses write rights, that would result in a situation where it is not possible to save the modified image anymore. Bug caused by implementation of wish 87105 (redo)...
BUGS:103219


  M +5 -0      canvas.cpp   1.37
  M +1 -0      canvas.h   1.25
  M +3 -2      imagewindow.cpp   1.96
  M +14 -7     imlibinterface.cpp   1.46
  M +1 -0      imlibinterface.h   1.25


--- kdeextragear-3/digikam/utilities/imageeditor/canvas.cpp  #1.36:1.37
@@ -400,4 +400,9 @@ int Canvas::saveAsTmpFile(const QString&
 }
 
+void Canvas::setModified(bool val) 
+{
+    d->im->setModified(val); 
+}
+
 int Canvas::imageWidth()
 {

--- kdeextragear-3/digikam/utilities/imageeditor/canvas.h  #1.24:1.25
@@ -58,4 +58,5 @@ public:
                        int PNGcompression, bool TIFFcompression, 
                        const QString& mimeType=0);
+    void setModified(bool val);
         
     bool  maxZoom();

--- kdeextragear-3/digikam/utilities/imageeditor/imagewindow.cpp  #1.95:1.96
@@ -944,8 +944,9 @@ bool ImageWindow::save()
     {
         QString errMsg(SyncJob::lastErrorMsg());
-        KMessageBox::error(this, errMsg, errMsg);
+        KMessageBox::error(this, errMsg, "Error Saving File");
         return false;
     }
 
+    m_canvas->setModified( false );
     emit signalFileModified(m_urlCurrent);
     QTimer::singleShot(0, this, SLOT(slotLoadCurrent()));

--- kdeextragear-3/digikam/utilities/imageeditor/imlibinterface.cpp  #1.45:1.46
@@ -417,11 +417,18 @@ bool ImlibInterface::saveAs(const QStrin
     imlib_context_pop();
 
-    if (result)
+    return result;
+}
+
+void ImlibInterface::setModified(bool val)
+{
+    if (val)
+    {
+        emit signalModified(true, true);
+    }
+    else 
     {
         d->undoMan->clear();
         emit signalModified(false, false);
     }
-
-    return result;    
 }
 

--- kdeextragear-3/digikam/utilities/imageeditor/imlibinterface.h  #1.24:1.25
@@ -59,4 +59,5 @@ public:
                 int PNGcompression, bool TIFFcompression,
                 const QString& mimeType=0);
+    void setModified (bool val);
         
     void zoom(double val);