FileManager1 wrapper in KIO/KRun (re-sent)

David Faure faure at kde.org
Sat Feb 6 12:28:04 UTC 2016


On Friday 05 February 2016 15:54:00 Kai Uwe Broulik wrote:
> (seems BlackBerry 10 doesn't think anyone would want to send plain-text Emails, sorry for the previous html screw-up)
> 
> Hi everyone, ‎
> 
> There's a FDO DBus interface [1] to tell a file manager to highlight a given file in a directory. This is interface is provided by Nautilus and Dolphin and probably others and used by some third party applications like Firefox, Gimp iirc.
> 
> We have many places where we want to show the parent folder of a file but usually just open the containing folder and the user has to search for the file manually.‎ Given this, I think we should have a method for this in KIO or KRun or similar that invokes this and/or falls back to the traditional way of just opening the folder if unavailable. 
> 
> Suggestions on where to put it or how to expand on this idea?

The best place for this would actually be QDesktopServices, API wise ;)
Just like KToolInvocation::invokeMailer was deprecated in favour of QDesktopServices.
But this might require implementation on a number of different OSes, so if you're not planning
on doing that, we can think of a KF5 API instead.

Within KF5, I have two idea:

1) This could be a static method in KRun, even though it doesn't need the actual KRun class, but we have a number of similar things in there indeed.
2) KToolInvocation (kservice.git, lower in the stack) actually has more specialized API (like invokeTerminal), so API-wise it would be
a good place for something like openFileManagerWindow. But KToolInvocation is mostly a client for kdeinit/klauncher, so implementation
wise it might be a bit out of place.

What's your plan for the implementation btw? Make dbus call (which might autostart the service), and if that fails...
KRun::runUrl(directoryUrl, "inode/directory"), I guess? Then it can't be in kservice.git, it has to be in kio.
So yeah, KRun::openFileManagerWindow, I suppose. Unless you use an async dbus call to avoid
blocking the caller, then it's more of a job like API. If dolphin/nautilus isn't running yet and has to start up,
then indeed it might take some time for the call to succeed, so an async call is actually not a bad idea.
What do you think about a KIO::OpenFileManagerWindowJob : public KJob, encapsulating an async dbus call?

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list