We have moved to a new Sailfish OS Forum. Please start new discussions there.
5

How to manage app's own version and display name?

asked 2016-06-14 10:32:37 +0300

Fiery gravatar image

I'm about to finish my first Sailfish OS app, and bumped into an issue that works quite smoothly on other platforms (green robot, Tizen, etc) I need to show my app's own display name and version number on the About page, and also use them in case the user wants to send an email via my app. I've tried to use QGuiApplication.applicationName, applicationDisplayName and applicationVersion, but they don't contain the expected information. applicationName and applicationDisplayName both contains the same string "harbour-MY_APP_NAME", instead of the display name I've specified in the .desktop file. And applicationVersion is empty.

As far as I can tell, I can specify the display name in the .desktop file, but how can I parse the .desktop file from my app? And I can put the version number in the .spec file, but how to parse it from the app?

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
3

answered 2016-06-14 11:17:31 +0300

tortoisedoc gravatar image

See MLite package which has MDesktopEntry class, which contains interfaces to interact with .desktop files. But true, you would expect the app to return info from the .desktop file directly. Perhaps it could be added as a configuration option (somewhere in the Qt Layer?)

edit flag offensive delete publish link more

Comments

Thank you! Parsing .desktop file sadly doesn't give me the version number of the app :-( Is there a trick up your sleeve for that too? ;-)

Fiery ( 2016-06-14 12:40:12 +0300 )edit
2

@Fiery, you could add

DEFINES += APP_VERSION=\\"$$VERSION\\"

in your .pro, register it in root context as a property [ setContextProperty("APP_VERSION", APP_VERSION) ] and use it QML .

Edit: Also give VERSION as a qmake option in yaml file.

You could see the working example at https://github.com/custodian/harbour-systemmonitor

rinigus ( 2016-06-14 12:58:21 +0300 )edit

That works great, thanks a lot! :-)

Fiery ( 2016-06-14 14:55:56 +0300 )edit

Forget about YAML, focus on specs. AFAIK yaml is on the way out?

tortoisedoc ( 2016-06-14 19:24:25 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2016-06-14 10:32:37 +0300

Seen: 204 times

Last updated: Jun 14 '16