[SOLVED] Open folder explorer with pre-selected file
-
Hello,
I'm developing a desktop application that incudes a QWebView component that will be used to display some web pages from my website.
Once the use left-clicks on a link that points to a .pdf, .zip or whatever, the desktop application dowloads the file via QNetworkAccessManager and then, promt the user to choose the location where he wants to save the document.After the file is saved, I currently open a window exploer instance, to the path where the file is, using the command "QDesktopServices::openUrl(<path>)".
I'd like to pre-select the new file so that the user can easily find it, witout having to scroll or make anything else.
Like what happens from the download manager built in Firefox or Chrome.I'd like this to be cross-platform.
Is there any way to do that?
Thank you
Michele -
There is no way to do that cross platform. There is no (common) API for file managers that I'm aware of, and certainly no Qt support for any such API.
-
Although this might not be very convenient since there are tons of different file managers in use (especially on linux), you could build in support for the most common file managers.
For Windows Explorer for example, have a look at the \select parameter http://support.microsoft.com/kb/152457
-
Of course :-) Good link on how to do this with windows explorer!
I'm sure there is similar API for mac, KDE and Gnome. The latter two you can probably do through DBus, if they don't have a command line parameter for it.
-
[quote author="marsupial" date="1341909697"]Although this might not be very convenient since there are tons of different file managers in use (especially on linux), you could build in support for the most common file managers.
For Windows Explorer for example, have a look at the \select parameter http://support.microsoft.com/kb/152457[/quote]
Thank you for your help.
This pointed me to the right solution, thak you very much!
At least on Windows it's perfect.Michele