mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-23 10:22:50 +00:00
kupdatenotifier: start the service if it is not registered
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
31845025f2
commit
3edfb79f33
3 changed files with 12 additions and 4 deletions
|
@ -27,9 +27,6 @@
|
|||
|
||||
// for reference:
|
||||
// https://www.freedesktop.org/software/PackageKit/gtk-doc/PackageKit.html
|
||||
#define PACKAGEKIT_SERVICE "org.freedesktop.PackageKit"
|
||||
#define PACKAGEKIT_PATH "/org/freedesktop/PackageKit"
|
||||
#define PACKAGEKIT_IFACE "org.freedesktop.PackageKit"
|
||||
|
||||
KUpdateNotifier::KUpdateNotifier(QObject* parent)
|
||||
: KStatusNotifierItem(parent),
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include <kmenu.h>
|
||||
#include <khelpmenu.h>
|
||||
|
||||
#define PACKAGEKIT_SERVICE "org.freedesktop.PackageKit"
|
||||
#define PACKAGEKIT_PATH "/org/freedesktop/PackageKit"
|
||||
#define PACKAGEKIT_IFACE "org.freedesktop.PackageKit"
|
||||
|
||||
class KUpdateNotifier : public KStatusNotifierItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <QDBusConnectionInterface>
|
||||
#include <kuniqueapplication.h>
|
||||
#include <klocale.h>
|
||||
#include <kcmdlineargs.h>
|
||||
|
@ -48,10 +49,16 @@ int main(int argc, char** argv)
|
|||
KUniqueApplication kupdatenotifierapp;
|
||||
kupdatenotifierapp.setQuitOnLastWindowClosed(false);
|
||||
if (!KUniqueApplication::start()) {
|
||||
kWarning() << "kupdatenotifier is already running!";
|
||||
kDebug() << "kupdatenotifier is already running!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
QDBusConnectionInterface* systembusiface = QDBusConnection::systemBus().interface();
|
||||
if (!systembusiface->isServiceRegistered(PACKAGEKIT_SERVICE)) {
|
||||
kDebug() << "activating" << PACKAGEKIT_SERVICE;
|
||||
systembusiface->startService(PACKAGEKIT_SERVICE);
|
||||
}
|
||||
|
||||
KUpdateNotifier kupdatenotifier(&kupdatenotifierapp);
|
||||
|
||||
return kupdatenotifierapp.exec();
|
||||
|
|
Loading…
Add table
Reference in a new issue