[Digikam-devel] branches/stable/extragear/graphics/digikam/showfoto

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


SVN commit 497215 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  +5 -11     showfoto.cpp  
 M  +47 -49    showfoto.h  


--- branches/stable/extragear/graphics/digikam/showfoto/showfoto.cpp #497214:497215
@@ -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
@@ -97,7 +98,6 @@
     m_BCGAction              = 0;
     m_deleteItem2Trash       = true;
     m_isReadOnly             = false;
-    m_dirtyImage             = false;
     m_fullScreen             = false;
     m_fullScreenHideToolBar  = false;
     m_fullScreenHideThumbBar = true;
@@ -836,7 +836,7 @@
     if (!m_currentItem)
         return true;
 
-    if (m_dirtyImage)
+    if (m_saveAction->isEnabled())
     {
         int result =
             KMessageBox::warningYesNoCancel(this,
@@ -861,7 +861,7 @@
         else
             return false;
     }
-     m_dirtyImage = false;
+    
     return true;
 }
 
@@ -923,7 +923,7 @@
     m_canvas->setModified( false );
     m_bar->invalidateThumb(m_currentItem);
     kapp->restoreOverrideCursor();
-    slotOpenURL(m_currentItem->url());
+    QTimer::singleShot(0, this, SLOT(slotOpenURL(m_currentItem->url())));
 
     return true;
 }
@@ -954,7 +954,6 @@
 
     slotUpdateItemInfo();
     QApplication::restoreOverrideCursor();
-    m_dirtyImage = false;
 }
 
 void ShowFoto::toggleNavigation(int index)
@@ -1132,7 +1131,6 @@
 
 void ShowFoto::slotChanged(bool moreUndo, bool moreRedo)
 {
-    m_dirtyImage = true;
     m_resLabel->setText(QString::number(m_canvas->imageWidth())  +
                         QString("x") +
                         QString::number(m_canvas->imageHeight()) +
@@ -1143,9 +1141,6 @@
     m_undoAction->setEnabled(moreUndo);
     m_redoAction->setEnabled(moreRedo);
     m_saveAction->setEnabled(moreUndo);
-
-    if (!m_isReadOnly)
-        m_saveAction->setEnabled(moreUndo);
 }
 
 void ShowFoto::slotAboutToShowUndoMenu()
@@ -1461,9 +1456,8 @@
     else
     {
         m_currentItem = m_bar->currentItem();
-        slotOpenURL(m_currentItem->url());
+        QTimer::singleShot(0, this, SLOT(slotOpenURL(m_currentItem->url())));
     }
-     m_dirtyImage = false;
 }
 
 void ShowFoto::slotUpdateItemInfo(void)
--- branches/stable/extragear/graphics/digikam/showfoto/showfoto.h #497214:497215
@@ -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
@@ -67,51 +68,6 @@
 protected:
 
     void closeEvent(QCloseEvent* e);
-    
-private slots:
-
-    void slotOpenFile();
-    void slotNext();
-    void slotPrev();
-    void slotLast();
-    void slotFirst();
-    void slotFilePrint();
-    void slotOpenURL(const KURL& url);
-    void slotOpenFolder(const KURL& url);
-    void slotOpenFilesInFolder();
-       
-    void slotDeleteCurrentItem();
-    void slotFileProperties();
-    
-    void slotToggleFullScreen();
-    void slotToggleSlideShow();
-    void slotAutoFit();
-    void slotZoomChanged(float zoom);
-    void slotResize();
-    void slotEscapePressed();
-    void slotToggleShowBar();
-    void slotViewHistogram();
-    void slotChangeBCG();
-    void slotImagePluginsHelp();
-    
-    void slotChanged(bool, bool);
-    void slotSelected(bool);
-    void slotUpdateItemInfo(void);
-    
-    void slotAboutToShowUndoMenu();
-    void slotAboutToShowRedoMenu();
-
-    void slotEditKeys();
-    void slotConfToolbars();
-    void slotNewToolbarConfig();
-    void slotSetup();
-    void slotContextMenu();
-        
-    void slotDeleteCurrentItemResult( KIO::Job * job );
-
-    void slotSave()   { save();   };
-    void slotSaveAs() { saveAs(); };
-     
                
 private:
 
@@ -193,11 +149,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;
     int                    m_itemsNb;
@@ -209,6 +162,51 @@
     bool                   m_fullScreenHideThumbBar;
     bool                   m_deleteItem2Trash;
     bool                   m_slideShowInFullScreen;
+
+private slots:
+
+    void slotOpenFile();
+    void slotNext();
+    void slotPrev();
+    void slotLast();
+    void slotFirst();
+    void slotFilePrint();
+    void slotOpenURL(const KURL& url);
+    void slotOpenFolder(const KURL& url);
+    void slotOpenFilesInFolder();
+       
+    void slotDeleteCurrentItem();
+    void slotFileProperties();
+    
+    void slotToggleFullScreen();
+    void slotToggleSlideShow();
+    void slotAutoFit();
+    void slotZoomChanged(float zoom);
+    void slotResize();
+    void slotEscapePressed();
+    void slotToggleShowBar();
+    void slotViewHistogram();
+    void slotChangeBCG();
+    void slotImagePluginsHelp();
+    
+    void slotChanged(bool, bool);
+    void slotSelected(bool);
+    void slotUpdateItemInfo(void);
+    
+    void slotAboutToShowUndoMenu();
+    void slotAboutToShowRedoMenu();
+
+    void slotEditKeys();
+    void slotConfToolbars();
+    void slotNewToolbarConfig();
+    void slotSetup();
+    void slotContextMenu();
+        
+    void slotDeleteCurrentItemResult( KIO::Job * job );
+
+    void slotSave()   { if (m_isReadOnly) saveAs(); else save(); };
+    void slotSaveAs() { saveAs(); };
+
 };
 
 #endif /* SHOWFOTO_H */



More information about the Digikam-devel mailing list