[Bug 122374] New: image viewer ignores read-only permission

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 122374] New: image viewer ignores read-only permission

Gerhard-4-2
------- 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         
           Summary: image viewer ignores read-only permission
           Product: digikam
           Version: 0.8.1
          Platform: SuSE RPMs
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: digikam-devel kde org
        ReportedBy: gsteng02 o2online de


Version:           0.8.1 (using KDE KDE 3.5.0)
Installed from:    SuSE RPMs
OS:                Linux

I set the permissions of my photos to r--r--r-- in order to not accidentally overwrite them. If I modify such a photo in the image viewer, i.e. convert it to B&W, and click to the next photo, I'm asked if I want to save this change (OK so far). If I select "Yes", digikam actually saves the change to the read-only(!!) image which I think is a bug
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 122374] image viewer ignores read-only permission

Gilles Caulier
------- 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         




------- Additional Comments From caulier.gilles free fr  2006-04-15 09:54 -------
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
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 122374] image viewer ignores read-only permission

Marcel Wiesweg
In reply to this post by Gerhard-4-2
------- 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); };
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel