Web lists-archives.com

Re: Prevent app to run twice.




2016-04-24 12:12 GMT+02:00 Kai Uwe Broulik <kde@xxxxxxxxxxxxxxxxx>:
> Hi,
>
> you can use KDBusService in KDBusAddons [1] which does that for you.

Thanks a lot.

I've read the document you've send.

So it looks like I have to create:

- a desktop file with DBusActivatable set to yes
- a xml dbus file described here:

https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html

with the name org.kde.showbackup (when my app is called showbackup)
or org.bononline.showbackup (my last name is Bon, my organisationname
is bononline).

- make my app dbus aware like in the document is desctibed:

QApplication app(argc, argv);
app.setApplicationName("kuiserver");
app.setOrganizationDomain("kde.org");
// Create your dbus objects here
// ...
KDBusService service(KDBusService::Unique);
// If this point is reached, this is the only running instance
// i.e. org.kde.kuiserver has been registered
return app.exec();

Here I should set the name and domain as mentioned before I
understand. But what to do at the lines "Create your dbus objects
here?

Stef