Show/hide (start/stop) application via DBus (Harmattan)
Hello!
I bumped into a problem launching native Nokia Gallery (N950/N9 phone) via DBus.
I used such code:
[CODE]QProcess::execute("/usr/bin/dbus-send --type=method_call --dest=com.nokia.Gallery /com/nokia/Gallery com.nokia.Gallery.[B]LaunchApplication[/B]");[/CODE]
It works fine on the first run. But if Gallery is already running nothing is happening. I expected that Gallery will come to top and my application will minimize.
I tried to use trick from N900 (Maemo5), I called [B]top_application[/B] instead [B]LaunchApplication[/B], but attempt is failed, behavior isn't changed...
Question: how to move Nokia Gallery to top from my application if Gallery is already running?
Re: Show/hide (start/stop) application via DBus (Harmattan)
Why don't you use Qt.openUrlExternally(file.jpg) [FOR QML] or QDesktopServices::setUrlHandler (..) [FOR C++] instead of using QProcess+DBus.
You solution looks quite weird to me.
Re: Show/hide (start/stop) application via DBus (Harmattan)
My goal isn't to open some file but just to run Gallery application. For that reason I use DBus instead QDesktopServices.
Or QDesktopServices may run executable files? I tried to use it like this:
[CODE]QDesktopServices::openUrl(QUrl("/usr/bin/gallery"));[/CODE]
and like this too:
[CODE]QDesktopServices::openUrl(QUrl("file://usr/bin/gallery"));[/CODE]
But both attempts ended with debug message:
[QUOTE]no default action for the given PARAMS[/QUOTE]
Re: Show/hide (start/stop) application via DBus (Harmattan)
[URL="http://www.developer.nokia.com/Community/Wiki/How_to_launch_other_applications_in_Qt"]QProcess::start()[/URL] may do your job.
Re: Show/hide (start/stop) application via DBus (Harmattan)
[QUOTE=savaj;867472][URL="http://www.developer.nokia.com/Community/Wiki/How_to_launch_other_applications_in_Qt"]QProcess::start()[/URL] may do your job.[/QUOTE]
It works not exactly as I need. To open already open gallery I have to close process and start it again - it's not fast operation.
[CODE]if(process.isOpen())
process.close();
process.start("/usr/bin/gallery");[/CODE]
Maybe there exist more flexible solution?
Anyway, thanks for your hint!
Re: Show/hide (start/stop) application via DBus (Harmattan)
[QUOTE=Habolog;867288]Hello!
I bumped into a problem launching native Nokia Gallery (N950/N9 phone) via DBus.
I used such code:
[CODE]QProcess::execute("/usr/bin/dbus-send --type=method_call --dest=com.nokia.Gallery /com/nokia/Gallery com.nokia.Gallery.[B]LaunchApplication[/B]");[/CODE]
It works fine on the first run. But if Gallery is already running nothing is happening. I expected that Gallery will come to top and my application will minimize.
Question: how to move Nokia Gallery to top from my application if Gallery is already running?[/QUOTE]
I faced the same problem and solved it using [URL="http://harmattan-dev.nokia.com/docs/platform-api-reference/showdoc.php?pkn=libcontentaction&wb=daily-docs&url=Li94bWwvZGFpbHktZG9jcy9saWJjb250ZW50YWN0aW9u"]libcontentaction[/URL]. I wrote a [URL="http://blogs.igalia.com/xrcalvar/2012/03/23/invoking-meego-1-2-harmattan-gallery/"]blog post about how I solved it.[/URL]