Bug 186230

Summary: extend kfiledialog: syntax to make it more useful for saving
Product: [Applications] kfile Reporter: Jonathan Marten <jjm>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: aacid
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch to KFileWidget
Updated patch

Description Jonathan Marten 2009-03-05 16:29:06 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

The ability to use the "kfiledialog:///keyword" syntax in KFileDialog::getSaveUrl() and the other static functions is not particularly useful for saving.  Typically in this case the application will want to specify both a "start directory" and a "suggested file name", but it is not possible to specify both a "recent keyword" (using the "kfiledialog:" syntax) and a file name.  Applications wishing to do this need to either handle the location history themselves, or use the KFileDialog constructor, in both cases introducing unnecessary complexity and duplication.

Suggest extending the syntax to be able to specify both the keyword and filename, with an URL of the form "kfiledialog:///keyword/filename".  This should be compatible with any existing uses, but would allow applications to take advantage if required.

As a measure of their current usefulness, the static getSave* methods are used nowhere in kdebase, and a total of 10 times in kdeedu, kdepim, kdeutils and extragear together.

See discussion thread at http://lists.kde.org/?l=kde-devel&m=123565715426002&w=2
Comment 1 Jonathan Marten 2009-03-05 16:32:14 UTC
Created attachment 31800 [details]
Patch to KFileWidget

Proposed patch.  Tested against current trunk with both modified and unmodified applications.
Comment 2 Jonathan Marten 2009-03-10 14:21:26 UTC
Created attachment 31989 [details]
Updated patch

Patch updated in accordance with comments at
http://lists.kde.org/?l=kde-core-devel&m=123655642309183&w=2

API documentation updated for KFileDialog and KFileWidget.

Test cases added in kio/kfile/tests.
Comment 3 Albert Astals Cid 2009-03-29 23:59:29 UTC
Jonathan you don't seem to have commited the code yet, right? dfaure gave you a green light
Comment 4 Jonathan Marten 2009-04-08 19:04:09 UTC
@aacid: Sorry, have been away on holiday.  Will commit as soon as my copy of trunk is up-to-date...
Comment 5 Jonathan Marten 2009-04-09 15:05:01 UTC
SVN commit 951469 by marten:

Extend the file selector's "kfiledialog:" URL syntax to allow both a starting
directory keyword and a suggested file name to be specified, in the form
"kfiledialog:///keyword/filename" or "kfiledialog:///keyword/filename?global".

Useful for saving, as otherwise there was no way to specify both using the
static get Save*() functions.

Updated API documentation for KFileDialog and KFileWidget to reflect this.

Patch reviewed by aacid and David Faure.

BUG:186230


 M  +70 -18    kfile/kfilewidget.cpp  
 M  +54 -16    kfile/kfilewidget.h  
 M  +1 -1      kio/kfile/kfiledialog.cpp  
 M  +62 -115   kio/kfile/kfiledialog.h  
 M  +11 -1     kio/kfile/tests/kfiledialogtest.cpp  


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