Bug 132079 - Support for editing non-local files
Summary: Support for editing non-local files
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Showfoto-Load (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-08 20:14 UTC by Dik Takken
Modified: 2022-02-04 22:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0


Attachments
patch to enable remote saving of raw files (12.11 KB, patch)
2009-11-06 00:25 UTC, Johannes Wienke
Details
also allows opening and later saving of remote files (12.55 KB, patch)
2009-11-06 12:56 UTC, Johannes Wienke
Details
Now also with removed request for overwriting the temp file (16.54 KB, patch)
2009-11-06 16:57 UTC, Johannes Wienke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dik Takken 2006-08-08 20:14:18 UTC
Version:           0.4.0 (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages
OS:                Linux

It is currently not possible to edit files through KIO slaves like sftp. This feature is needed for using ShowFoto as an allround image viewer/editor.
Comment 1 caulier.gilles 2007-04-19 11:21:44 UTC
*** Bug 142112 has been marked as a duplicate of this bug. ***
Comment 3 caulier.gilles 2009-10-26 13:53:30 UTC
Johannes,

This file is fixed now. right ?

Gilles Caulier
Comment 4 Andi Clemens 2009-10-26 14:07:01 UTC
I don't think so, you can only open an image, but not edit.
Saving will not work (just tested it with FTP and SSH).
Comment 5 caulier.gilles 2009-10-26 14:12:12 UTC
Andi,

well, this commit from Johannes :

https://bugs.kde.org/show_bug.cgi?id=132745#c12

... do what exactly ?

Gilles
Comment 6 Johannes Wienke 2009-10-26 14:14:09 UTC
Saving works via kio, if that is the only thing that has to be done for this bug... or I don't understand why it is not marked as a duplicate of the other bug I closed. ;)
Comment 7 Andi Clemens 2009-10-26 14:20:35 UTC
(In reply to comment #5)
> Andi,
> 
> well, this commit from Johannes :
> 
> https://bugs.kde.org/show_bug.cgi?id=132745#c12
> 
> ... do what exactly ?
> 
> Gilles


For me it does nothing... in dolphin it works...
Comment 8 Johannes Wienke 2009-10-26 14:24:00 UTC
Ok there must be a regression, when I closed the other bug it worked.
Comment 9 Johannes Wienke 2009-11-05 18:09:18 UTC
Andi, did you try saving only with an imported raw file? For normal files it works for me. Raw doesn't work because for some strange reason the thread receives RAW as image format to save instead of the format selected in the saving dialog.
Comment 10 caulier.gilles 2009-11-05 21:54:23 UTC
Johannes,

RAW loaded in DImg has read only property. This can be the problem...

Gilles
Comment 11 Johannes Wienke 2009-11-05 22:30:19 UTC
Yes, but it shouldn't have selected raw at all. I found out that there are some errors in how the KFileDialog is used (reading mime but using filters etc.) and currently try to fix it.
Comment 12 Johannes Wienke 2009-11-06 00:25:03 UTC
Created attachment 38127 [details]
patch to enable remote saving of raw files

Gilles, Andi

This patch enables remote saving also for raw files. To fix this I refactored a big part of the saving method. Could you please check that I didn't break anything?

Some things to notice:
- The file dialog was initialized with filters and afterwards it was tried to read mime information. This isn't possible as the api documentation said and never worked. So there was a fall back to the other variants for determining the target file format.
- Remote saving didn't succeed for raw files, because the first fall back method tried to get the extension of the target url to determine the format and used QFileInfo for that purpose. However this only works for local files. So I added string manipulation for local files to extract the extension
- Because the above check didn't work for remote methods, the format of the source file was taken (which could be raw). Unfortunately this wasn't checked against the writeable formats. So I added this check to avoid writing RAW format.
- I've removed the KImageIO filter "all image types" from the dialog, because this doesn't clearly allow to determine the desired format from the filter, which also means that special format options could not be displayed.
Comment 13 Andi Clemens 2009-11-06 08:40:26 UTC
(In reply to comment #9)
> Andi, did you try saving only with an imported raw file? For normal files it
> works for me. Raw doesn't work because for some strange reason the thread
> receives RAW as image format to save instead of the format selected in the
> saving dialog.

No, normal JPGs. Maybe we are misunderstanding each other, but I opened a JPG via FTP, edited it, but when I want to save it, it is saved in /tmp/xjjdhsdjhsdjsdhsj (some strange temp name).
It is not uploaded directly as for example Kate does when I edit files remotely on my XBOX.
Comment 14 Johannes Wienke 2009-11-06 10:48:09 UTC
(In reply to comment #13)
> No, normal JPGs. Maybe we are misunderstanding each other, but I opened a JPG
> via FTP, edited it, but when I want to save it, it is saved in
> /tmp/xjjdhsdjhsdjsdhsj (some strange temp name).
> It is not uploaded directly as for example Kate does when I edit files remotely
> on my XBOX.

Ok, that's a use case I did not think of. I will have to check that.
Comment 15 Andi Clemens 2009-11-06 11:05:36 UTC
Well this is my understanding of "editing non-local files" :-)
Comment 16 Johannes Wienke 2009-11-06 12:56:45 UTC
Created attachment 38132 [details]
also allows opening and later saving of remote files

This enables opening of remote files and saving them later. There's still on thing I don't know how to fix: If you save the remote file you are first asked if the local temp file should be overwritten. I can't remove this question for remote files because it is invoked before the template method save() tells the real destination url via startSaving(). Only with this url one can decide if the file is a remote on or not.

Any ideas how to fix this?
Comment 17 Marcel Wiesweg 2009-11-06 15:29:44 UTC
You mean that promptForOverWrite() is invoked from slotSave() using m_canvas->currentImageFilePath()?
You could solve that by adding a virtual method returning the current URL (documented to return non-local URLs as well). Or make prompForOverwrite as a whole virtual. Or move the calls to m_canvas->load() including KIO::NetAccess downloading to EditorWindow and store the "true" current URL there.
Comment 18 Johannes Wienke 2009-11-06 16:57:19 UTC
Created attachment 38140 [details]
Now also with removed request for overwriting the temp file

Patch includes now Marcel's proposed solution with a virtual hook method that returns the destination url.

To my mind everything is solved now. Should we apply it before beta6?
Comment 19 Marcel Wiesweg 2009-11-07 16:08:42 UTC
If you have done some basic testing, apply it now so it goes into beta6 tomorrow.
Comment 20 Johannes Wienke 2009-11-08 00:16:37 UTC
SVN commit 1046235 by jwienke:

 * Allow editing remote files with showfoto
 * fix handling of raw files for remote saving
 
BUG: 132079

 M  +2 -1      NEWS  
 M  +14 -5     showfoto/showfoto.cpp  
 M  +1 -0      showfoto/showfoto.h  
 M  +211 -67   utilities/imageeditor/editor/editorwindow.cpp  
 M  +48 -0     utilities/imageeditor/editor/editorwindow.h  
 M  +5 -0      utilities/imageeditor/editor/imagewindow.cpp  
 M  +1 -0      utilities/imageeditor/editor/imagewindow.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1046235