[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at free.fr
Mon Jan 9 15:48:25 GMT 2006


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...

To the team : I have checked indeep all cases in IE and showfoto when current image is changed and with all user interactions :
- changing current image;
- save and saveas;
- removing current image;
- Loading images/folder (showfoto)

All seam to work fine now. Please, check if all working fine for you. If yes, this commit must be backported to stable...

CCMAIL: digikam-devel at kde.org


 M  +4 -12     showfoto/showfoto.cpp  
 M  +0 -3      showfoto/showfoto.h  
 M  +2 -7      utilities/imageeditor/editor/imagewindow.cpp  
 M  +0 -3      utilities/imageeditor/editor/imagewindow.h  


--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #496057:496058
@@ -105,7 +105,6 @@
     m_fullScreenHideToolBar  = false;
     m_fullScreenHideThumbBar = true;
     m_isReadOnly             = false;
-    m_dirtyImage             = false;
     m_config                 = kapp->config();
 
     m_config->setGroup("ImageViewer Settings");
@@ -662,8 +661,6 @@
         }
         toggleActions(true);
     }
-    
-    
 }
 
 void ShowFoto::slotFirst()
@@ -839,7 +836,7 @@
     }
 
     m_canvas->setModified( false );
-    
+
     // add the file to the list of images if it's not there already
     Digikam::ThumbBarItem* foundItem = m_bar->findItemByURL(saveAsURL);
     m_bar->invalidateThumb(foundItem);
@@ -849,6 +846,7 @@
     
     m_bar->setSelected(foundItem);
     kapp->restoreOverrideCursor();
+
     return true;
 }
 
@@ -857,7 +855,7 @@
     if (!m_currentItem)
         return true;
 
-    if (m_dirtyImage)
+    if (m_saveAction->isEnabled())
     {
         int result = KMessageBox::warningYesNoCancel(this,
                                   i18n("The image '%1\' has been modified.\n"
@@ -930,9 +928,8 @@
     m_canvas->setModified( false );
     m_bar->invalidateThumb(m_currentItem);
     kapp->restoreOverrideCursor();
-    slotOpenURL(m_currentItem->url());
+    QTimer::singleShot(0, this, SLOT(slotOpenURL(m_currentItem->url())));
 
-    m_dirtyImage = false;
     return true;
 }
 
@@ -972,8 +969,6 @@
 
     slotUpdateItemInfo();
     QApplication::restoreOverrideCursor();
-
-    m_dirtyImage = false;
 }
 
 void ShowFoto::toggleNavigation(int index)
@@ -1149,7 +1144,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()) +
@@ -1507,8 +1501,6 @@
         m_currentItem = m_bar->currentItem();
         slotOpenURL(m_currentItem->url());
     }
-
-    m_dirtyImage = false;
 }
 
 void ShowFoto::slotUpdateItemInfo(void)
--- trunk/extragear/graphics/digikam/showfoto/showfoto.h #496057:496058
@@ -84,9 +84,6 @@
     // typicially all RAW image file formats.
     bool                             m_isReadOnly;
 
-    // 'true' if current image have been modified, else 'false'.
-    bool                             m_dirtyImage;
-
     int                              m_itemsNb;
 
     SlideShow                       *m_slideShow;
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #496057:496058
@@ -107,7 +107,6 @@
     m_fullScreen            = false;
     m_fullScreenHideToolBar = false;
     m_isReadOnly            = false;
-    m_dirtyImage            = false;
     m_view                  = 0L;
 
     m_ICCSettings           = new ICCSettingsContainer();
@@ -667,8 +666,6 @@
     {
        m_fileDelete->setEnabled(true);
     }
-    
-    m_dirtyImage = false;
 }
 
 void ImageWindow::slotLoadNext()
@@ -849,7 +846,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()) +
@@ -1051,7 +1047,6 @@
     QTimer::singleShot(0, this, SLOT(slotLoadCurrent()));
     
     kapp->restoreOverrideCursor();
-    m_dirtyImage = false;
     return true;
 }
 
@@ -1245,7 +1240,6 @@
     kapp->restoreOverrideCursor();
     QTimer::singleShot(0, this, SLOT(slotLoadCurrent()));
 
-    m_dirtyImage = false;
     return true;
 }
 
@@ -1348,7 +1342,7 @@
 
 bool ImageWindow::promptUserSave()
 {
-    if (m_dirtyImage)
+    if (m_saveAction->isEnabled())
     {
         int result = KMessageBox::warningYesNoCancel(this,
                                   i18n("The image \"%1\" has been modified.\n"
@@ -1367,6 +1361,7 @@
         }
         else if (result == KMessageBox::No)
         {
+            m_saveAction->setEnabled(false);
             return true;
         }
         else
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.h #496057:496058
@@ -90,9 +90,6 @@
     // typicially all RAW image file formats.
     bool                    m_isReadOnly;
 
-    // 'true' if current image have been modified, else 'false'.
-    bool                    m_dirtyImage;
-
     QPopupMenu             *m_contextMenu;
 
     QSplitter              *m_splitter;



More information about the Digikam-devel mailing list