[Digikam-devel] branches/stable/extragear/graphics/digikam/utilities/imageeditor

Gilles Caulier caulier.gilles at free.fr
Thu Jan 12 11:14:42 GMT 2006


SVN commit 497217 by cgilles:

digikam from stable : backport commits #496058 and #496316 from trunk:

SVN commit 496058 by cgilles:
digikam from trunk : simplify and fix dirty image flag if current image has changed. Removed m_dirtyImage flag witch cannot be use properly with any flag event from canvas (race condition). Sometimes IE/showfoto said if user want saving current image more than one time...

SVN commit 496316 by cgilles: 
digikam from trunk : IE/ Showfoto : if current image is read only (RAW file for example), we need to use saveAs() method instead save() method.

CCMAIL: digikam-devel at kde.org


 M  +6 -11     imagewindow.cpp  
 M  +5 -7      imagewindow.h  


--- branches/stable/extragear/graphics/digikam/utilities/imageeditor/imagewindow.cpp #497216:497217
@@ -5,6 +5,7 @@
  * Description :
  *
  * Copyright 2004-2005 by Renchi Raju, Gilles Caulier
+ * Copyright 2006 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -102,8 +103,6 @@
     m_fullScreen            = false;
     m_fullScreenHideToolBar = false;
     m_isReadOnly            = false;
-    m_dirtyImage            = false;
-     
     m_view                  = 0L;
     
     // -- construct the view ---------------------------------
@@ -608,8 +607,6 @@
        m_fileDelete->setEnabled(true);
        m_commentedit->setEnabled(true);
     }
-
-    m_dirtyImage = false;
 }
 
 void ImageWindow::slotLoadNext()
@@ -789,7 +786,6 @@
 
 void ImageWindow::slotChanged(bool moreUndo, bool moreRedo)
 {
-    m_dirtyImage = true;
     m_resLabel->setText(QString::number(m_canvas->imageWidth())  +
                         QString("x") +
                         QString::number(m_canvas->imageHeight()) +
@@ -800,7 +796,7 @@
     m_undoAction->setEnabled(moreUndo);
     m_redoAction->setEnabled(moreRedo);
 
-    if (m_allowSaving && !m_isReadOnly)
+    if (m_allowSaving)
     {
         m_saveAction->setEnabled(moreUndo);
     }
@@ -1011,9 +1007,8 @@
     
     m_canvas->setModified( false );
     emit signalFileModified(m_urlCurrent);
-    QTimer::singleShot(0, this, SLOT(slotLoadCurrent()));
+    slotLoadCurrent();
     kapp->restoreOverrideCursor();
-    m_dirtyImage = false;
     return true;
 }
 
@@ -1225,8 +1220,7 @@
 
     m_canvas->setModified( false );
     kapp->restoreOverrideCursor();
-    QTimer::singleShot(0, this, SLOT(slotLoadCurrent()));
-    m_dirtyImage = false;
+    slotLoadCurrent();
     return true;
 }
 
@@ -1333,7 +1327,7 @@
 
 bool ImageWindow::promptUserSave()
 {
-    if (m_dirtyImage)
+    if (m_saveAction->isEnabled())
     {
         int result =
             KMessageBox::warningYesNoCancel(this,
@@ -1352,6 +1346,7 @@
         }
         else if (result == KMessageBox::No)
         {
+            m_saveAction->setEnabled(false);
             return true;
         }
         else
--- branches/stable/extragear/graphics/digikam/utilities/imageeditor/imagewindow.h #497216:497217
@@ -4,7 +4,8 @@
  * Date  : 2004-02-12
  * Description : 
  * 
- * Copyright 2004 by Renchi Raju, Gilles Caulier
+ * Copyright 2004-2005 by Renchi Raju, Gilles Caulier
+ * Copyright 2006 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -86,11 +87,8 @@
 
     // If current image file format is only available in read only,
     // typicially all RAW image file formats.
-    bool                    m_isReadOnly;
+    bool                   m_isReadOnly;
     
-    // 'true' if current image have been modified, else 'false'.
-    bool                    m_dirtyImage;
-    
     int                    m_JPEGCompression;
     int                    m_PNGCompression;
     
@@ -181,8 +179,8 @@
     void slotSelected(bool);
 
     void slotRotatedOrFlipped();
-    
-    void slotSave()   { save();   };
+
+    void slotSave()   { if (m_isReadOnly) saveAs(); else save(); };
     void slotSaveAs() { saveAs(); };
 
     void slotAboutToShowUndoMenu();



More information about the Digikam-devel mailing list