[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor
From: Arnd Baecker <arnd.baecker () web ! de>
Date: 2008-01-31 21:27:53
Message-ID: 1201814873.483251.26868.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 769218 by abaecker:
When leaving the image editor without saving, but pressing save in the
following dialogue, ensure that the original image is not silently overwritten.
CCBUGS: 103350
TODO:KDE4PORT
M +20 -20 editorwindow.cpp
M +1 -0 editorwindow.h
--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #769217:769218
@@ -1124,6 +1124,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?")
+ .arg(fi.fileName()));
+ return (KMessageBox::warningContinueCancel(this,
+ warnMsg,
+ i18n("Warning"),
+ i18n("Overwrite"),
+ "editorWindowSaveOverwrite")
+ == KMessageBox::Continue);
+}
+
bool EditorWindow::promptUserSave(const KURL& url)
{
if (m_saveAction->isEnabled())
@@ -1144,13 +1157,14 @@
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
// In this case, do not call enter_loop because exit_loop will not be called.
if (saving)
@@ -1316,25 +1330,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?")
- .arg(fi.fileName()));
- if (KMessageBox::warningContinueCancel(this,
- warnMsg,
- i18n("Warning"),
- i18n("Overwrite"),
- "editorWindowSaveOverwrite")
- == KMessageBox::Continue)
- {
- save();
- }
- }
+ else if (promptForOverWrite())
+ save();
}
+
void EditorWindow::slotSavingStarted(const QString& /*filename*/)
{
setCursor( KCursor::waitCursor() );
--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #769217:769218
@@ -131,6 +131,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