1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
/*
SPDX-FileCopyrightText: 2011 Lionel Chauvin <megabigbug@yahoo.fr>
SPDX-FileCopyrightText: 2011, 2012 Cédric Bellegarde <gnumdk@gmail.com>
SPDX-License-Identifier: MIT
*/
#include "appmenu_dbus.h"
#include "appmenuadaptor.h"
#include "kdbusimporter.h"
#include <QApplication>
#include <QDBusMessage>
#include <QDBusServiceWatcher>
static const char *DBUS_SERVICE = "org.kde.kappmenu";
static const char *DBUS_OBJECT_PATH = "/KAppMenu";
AppmenuDBus::AppmenuDBus(QObject *parent)
: QObject(parent)
{
}
AppmenuDBus::~AppmenuDBus()
{
}
bool AppmenuDBus::connectToBus(const QString &service, const QString &path)
{
m_service = service.isEmpty() ? DBUS_SERVICE : service;
const QString newPath = path.isEmpty() ? DBUS_OBJECT_PATH : path;
if (!QDBusConnection::sessionBus().registerService(m_service)) {
return false;
}
new AppmenuAdaptor(this);
QDBusConnection::sessionBus().registerObject(newPath, this);
return true;
}
void AppmenuDBus::showMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
{
Q_EMIT appShowMenu(x, y, serviceName, menuObjectPath, actionId);
}
void AppmenuDBus::reconfigure()
{
Q_EMIT reconfigured();
}
|