mirror of https://github.com/procxx/kepka.git
Avoid usage of QDBusInterface in StatusNotifierItem to avoid crashes
This commit is contained in:
parent
3f661cc028
commit
0b5eb47b37
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#include "statusnotifieritem.h"
|
#include "statusnotifieritem.h"
|
||||||
#include "statusnotifieritemadaptor.h"
|
#include "statusnotifieritemadaptor.h"
|
||||||
#include <QDBusInterface>
|
|
||||||
#include <QDBusServiceWatcher>
|
#include <QDBusServiceWatcher>
|
||||||
|
#include <QDBusMessage>
|
||||||
#include <dbusmenuexporter.h>
|
#include <dbusmenuexporter.h>
|
||||||
|
|
||||||
int StatusNotifierItem::mServiceCounter = 0;
|
int StatusNotifierItem::mServiceCounter = 0;
|
||||||
|
@ -75,11 +75,16 @@ StatusNotifierItem::~StatusNotifierItem()
|
||||||
|
|
||||||
void StatusNotifierItem::registerToHost()
|
void StatusNotifierItem::registerToHost()
|
||||||
{
|
{
|
||||||
QDBusInterface interface(QLatin1String("org.kde.StatusNotifierWatcher"),
|
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.kde.StatusNotifierWatcher"),
|
||||||
QLatin1String("/StatusNotifierWatcher"),
|
QLatin1String("/StatusNotifierWatcher"),
|
||||||
QLatin1String("org.kde.StatusNotifierWatcher"),
|
QLatin1String("org.kde.StatusNotifierWatcher"),
|
||||||
mSessionBus);
|
QLatin1String("RegisterStatusNotifierItem"));
|
||||||
interface.asyncCall(QLatin1String("RegisterStatusNotifierItem"), mSessionBus.baseService());
|
|
||||||
|
message.setArguments({
|
||||||
|
mSessionBus.baseService()
|
||||||
|
});
|
||||||
|
|
||||||
|
mSessionBus.send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusNotifierItem::onServiceOwnerChanged(const QString& service, const QString& oldOwner,
|
void StatusNotifierItem::onServiceOwnerChanged(const QString& service, const QString& oldOwner,
|
||||||
|
@ -292,10 +297,23 @@ void StatusNotifierItem::Scroll(int delta, const QString &orientation)
|
||||||
void StatusNotifierItem::showMessage(const QString& title, const QString& msg,
|
void StatusNotifierItem::showMessage(const QString& title, const QString& msg,
|
||||||
const QString& iconName, int secs)
|
const QString& iconName, int secs)
|
||||||
{
|
{
|
||||||
QDBusInterface interface(QLatin1String("org.freedesktop.Notifications"), QLatin1String("/org/freedesktop/Notifications"),
|
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.Notifications"),
|
||||||
QLatin1String("org.freedesktop.Notifications"), mSessionBus);
|
QLatin1String("/org/freedesktop/Notifications"),
|
||||||
interface.call(QLatin1String("Notify"), mTitle, (uint) 0, iconName, title,
|
QLatin1String("org.freedesktop.Notifications"),
|
||||||
msg, QStringList(), QVariantMap(), secs);
|
QLatin1String("Notify"));
|
||||||
|
|
||||||
|
message.setArguments({
|
||||||
|
mTitle,
|
||||||
|
(uint) 0,
|
||||||
|
iconName,
|
||||||
|
title,
|
||||||
|
msg,
|
||||||
|
QStringList(),
|
||||||
|
QVariantMap(),
|
||||||
|
secs
|
||||||
|
});
|
||||||
|
|
||||||
|
mSessionBus.send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
IconPixmapList StatusNotifierItem::iconToPixmapList(const QIcon& icon)
|
IconPixmapList StatusNotifierItem::iconToPixmapList(const QIcon& icon)
|
||||||
|
|
Loading…
Reference in New Issue