Summary: | image viewer ignores read-only permission | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Gerhard <gstengel> |
Component: | ImageEditor-Save | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | 0.8.1 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.0 | |
Sentry Crash Report: |
Description
Gerhard
2006-02-20 22:07:47 UTC
Gerhard, Have you tried to reproduce this bug using current implementation: --> stable : 0.8.2-svn --> trunk : 0.9.0-svn I think that 0.8.2-svn still bugous. Image editor IO files interface have been completly re-written into 0.9.0-svn. No sure that this bug exist in this branch... Thanks in advance Gilles 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); }; |