[Digikam-devel] [Bug 122374] image viewer ignores read-only permission
Marcel Wiesweg
marcel.wiesweg at gmx.de
Mon Apr 24 21:48:12 BST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=122374
marcel.wiesweg gmx de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From marcel.wiesweg gmx de 2006-04-24 22:48 -------
SVN commit 533453 by mwiesweg:
Check for write permissions before saving a file in IE.
Ask again (KMessageBox) if permissions are not available.
TODO: We might want to check that the permissions can actually
be changed (file can be written) if the user wants to.
BUG: 122374
M +1 -0 NEWS
M +0 -1 TODO
M +36 -0 utilities/imageeditor/editor/editorwindow.cpp
M +3 -2 utilities/imageeditor/editor/editorwindow.h
--- trunk/extragear/graphics/digikam/NEWS #533452:533453
@ -122,5 +122,6 @
==> 115423 (thumbnails view jumps to top when new photos are added)
==> 125732 (ICC settings get reset when disabled and re-enabled)
==> 119741 (Image Editor: restore image editor if already open)
+==> 122374 (Image Editor: ignores read-only permission during saving)
----------------------------------------------------------------------------------------------------
--- trunk/extragear/graphics/digikam/TODO #533452:533453
@ -56,7 +56,6 @
==> 118501 (Image Editor: Exif lost when modifying the images)
==> 116148 (Image Editor: auto-scrolling when selecting large area)
==> 111446 (Image Editor: bad behaviour when out of disk space)
-==> 122374 (Image Editor: ignores read-only permission during saving)
==> 121242 (Showfoto: mimelnk/x-image-raw.desktop conflicts with kdegraphics-3.5.x)
LATER 0.9.0 TODO LIST
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #533452:533453
@ -1283,6 +1283,9 @
if (m_savingContext->savingState != SavingContextContainer::SavingStateNone)
return;
+ if (!checkPermissions(url))
+ return;
+
m_savingContext->srcURL = url;
m_savingContext->destinationURL = m_savingContext->srcURL;
m_savingContext->savingState = SavingContextContainer::SavingStateSave;
@ -1403,6 +1406,11 @
if (result != KMessageBox::Yes)
return false;
+
+ // There will be two message boxes if the file is not writable.
+ // This may be controversial, and it may be changed, but it was a deliberate decision.
+ if (!checkPermissions(newURL))
+ return false;
}
// Now do the actual saving -----------------------------------------------------
@ -1418,6 +1426,34 @
return true;
}
+bool EditorWindow::checkPermissions(const KURL& url)
+{
+ //TODO: Check that the permissions can actually be changed
+ // if write permissions are not available.
+
+ QFileInfo fi(url.path());
+
+ if (fi.exists() && !fi.isWritable())
+ {
+ int result =
+
+ KMessageBox::warningYesNo( this, i18n("You do not have write permissions "
+ "for the file named \"%1\". "
+ "Are you sure you want "
+ "to overwrite it?")
+ .arg(url.filename()),
+ i18n("Overwrite File?"),
+ i18n("Overwrite"),
+ KStdGuiItem::cancel() );
+
+ if (result != KMessageBox::Yes)
+ return false;
+ }
+
+ return true;
+}
+
+
} // namespace Digikam
#include "editorwindow.moc"
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #533452:533453
@ -127,9 +127,10 @
bool promptUserSave(const KURL& url);
void startingSave(const KURL& url);
bool startingSaveAs(const KURL& url);
-
- virtual void finishSaving(bool success);
+ bool checkPermissions(const KURL& url);
+ virtual void finishSaving(bool success);
+
virtual void readSettings() { readStandardSettings(); };
virtual void saveSettings() { saveStandardSettings(); };
virtual void toggleActions(bool val) { toggleStandardActions(val); };
More information about the Digikam-devel
mailing list