[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/utilities/imageeditor/editor
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2008-01-31 21:49:03
Message-ID: 1201816143.671840.27564.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 769222 by cgilles:

digiKam from trunk : backport commit #769218 from KDE3 branch


 M  +20 -21    editorwindow.cpp  
 M  +1 -0      editorwindow.h  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #769221:769222
@@ -1043,6 +1043,19 @@
     m_nameLabel->setProgressValue((int)(progress*100.0));
 }
 
+bool EditorWindow::promptForOverWrite()
+{
+    QFileInfo fi(m_canvas->currentImageFilePath());
+    QString warnMsg(i18n("About to overwrite file \"%1\"\nAre you sure?", fi.fileName()));
+    return (KMessageBox::warningContinueCancel(this,
+                                               warnMsg, 
+                                               i18n("Warning"), 
+                                               KGuiItem(i18n("Overwrite")),
+                                               KStandardGuiItem::cancel(),
+                                               QString("editorWindowSaveOverwrite"))
+            ==  KMessageBox::Continue);
+}
+
 bool EditorWindow::promptUserSave(const KUrl& url)
 {
     if (m_saveAction->isEnabled())
@@ -1063,11 +1076,11 @@
 
         if (result == KMessageBox::Yes)
         {
-            bool saving;
+            bool saving = false;
 
-            if (m_canvas->isReadOnly())
+            if (m_canvas->isReadOnly()) 
                 saving = saveAs();
-            else
+            else if (promptForOverWrite())
                 saving = save();
 
             // save and saveAs return false if they were cancelled and did not enter saving at all
@@ -1222,25 +1235,11 @@
 void EditorWindow::slotSave()
 {
     if (m_canvas->isReadOnly())
-    {
         saveAs();
-    }
-    else
-    {
-        QFileInfo fi(m_canvas->currentImageFilePath());
-        QString warnMsg(i18n("About to overwrite file \"%1\"\nAre you sure?", fi.fileName()));
-        if (KMessageBox::warningContinueCancel(this,
-                                               warnMsg, 
-                                               i18n("Warning"), 
-                                               KGuiItem(i18n("Overwrite")),
-                                               KStandardGuiItem::cancel(),
-                                               QString("editorWindowSaveOverwrite"))
-            ==  KMessageBox::Continue)
-        {
-            save();
-        }
-    }
- }
+    else if (promptForOverWrite())
+        save();
+}
+
 void EditorWindow::slotSavingStarted(const QString& /*filename*/)
 {
     setCursor( Qt::WaitCursor );
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #769221:769222
@@ -125,6 +125,7 @@
     void unLoadImagePlugins();
     void loadImagePlugins();
 
+    bool promptForOverWrite();
     bool promptUserSave(const KUrl& url);
     bool waitForSavingToComplete();
     void startingSave(const KUrl& url);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic