From 771aa0ae066f28d75874a626c8683f5ec79492ca Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 19 Sep 2023 20:52:40 +0300 Subject: [PATCH] plasma: remove redundant virtual NotificationsEngine::init() method Signed-off-by: Ivailo Monev --- .../notifications/notificationsengine.cpp | 55 +++++++++---------- .../notifications/notificationsengine.h | 21 +++---- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/plasma/dataengines/notifications/notificationsengine.cpp b/plasma/dataengines/notifications/notificationsengine.cpp index 055bcefd..a9a1e271 100644 --- a/plasma/dataengines/notifications/notificationsengine.cpp +++ b/plasma/dataengines/notifications/notificationsengine.cpp @@ -37,27 +37,7 @@ // for reference: // https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html -NotificationsEngine::NotificationsEngine( QObject* parent, const QVariantList& args ) - : Plasma::DataEngine( parent, args ), m_nextId( 1 ) -{ - new NotificationsAdaptor(this); - - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerService( "org.freedesktop.Notifications" ); - dbus.registerObject( "/org/freedesktop/Notifications", this ); -} - -NotificationsEngine::~NotificationsEngine() -{ - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.unregisterService( "org.freedesktop.Notifications" ); -} - -void NotificationsEngine::init() -{ -} - -inline void copyLineRGB32(QRgb* dst, const char* src, int width) +static void copyLineRGB32(QRgb* dst, const char* src, int width) { const char* end = src + width * 3; for (; src != end; ++dst, src+=3) { @@ -65,7 +45,7 @@ inline void copyLineRGB32(QRgb* dst, const char* src, int width) } } -inline void copyLineARGB32(QRgb* dst, const char* src, int width) +static void copyLineARGB32(QRgb* dst, const char* src, int width) { const char* end = src + width * 4; for (; src != end; ++dst, src+=4) { @@ -139,8 +119,27 @@ static QString findImageForSpecImagePath(const QString &_path) KUrl url(path); path = url.toLocalFile(); } - return KIconLoader::global()->iconPath(path, -KIconLoader::SizeHuge, - true /* canReturnNull */); + return KIconLoader::global()->iconPath( + path, -KIconLoader::SizeHuge, + true /* canReturnNull */ + ); +} + +NotificationsEngine::NotificationsEngine(QObject *parent, const QVariantList &args) + : Plasma::DataEngine(parent, args), + m_nextId(1) +{ + new NotificationsAdaptor(this); + + QDBusConnection dbus = QDBusConnection::sessionBus(); + dbus.registerService( "org.freedesktop.Notifications" ); + dbus.registerObject( "/org/freedesktop/Notifications", this ); +} + +NotificationsEngine::~NotificationsEngine() +{ + QDBusConnection dbus = QDBusConnection::sessionBus(); + dbus.unregisterService("org.freedesktop.Notifications"); } uint NotificationsEngine::Notify(const QString &app_name, uint replaces_id, @@ -273,12 +272,11 @@ QStringList NotificationsEngine::GetCapabilities() << "body-hyperlinks" << "body-markup" << "icon-static" - << "actions" - ; + << "actions"; } // FIXME: Signature is ugly -QString NotificationsEngine::GetServerInformation(QString& vendor, QString& version, QString& specVersion) +QString NotificationsEngine::GetServerInformation(QString &vendor, QString &version, QString &specVersion) { vendor = "KDE"; version = KDE_VERSION_STRING; @@ -286,7 +284,8 @@ QString NotificationsEngine::GetServerInformation(QString& vendor, QString& vers return "Plasma"; } -int NotificationsEngine::createNotification(const QString &appName, const QString &appIcon, const QString &summary, const QString &body, int timeout, bool configurable, const QString &appRealName) +int NotificationsEngine::createNotification(const QString &appName, const QString &appIcon, const QString &summary, + const QString &body, int timeout, bool configurable, const QString &appRealName) { const QString source = QString("notification %1").arg(++m_nextId); Plasma::DataEngine::Data notificationData; diff --git a/plasma/dataengines/notifications/notificationsengine.h b/plasma/dataengines/notifications/notificationsengine.h index f2a19fa7..32661c9b 100644 --- a/plasma/dataengines/notifications/notificationsengine.h +++ b/plasma/dataengines/notifications/notificationsengine.h @@ -34,26 +34,27 @@ class NotificationsEngine : public Plasma::DataEngine Q_OBJECT public: - NotificationsEngine( QObject* parent, const QVariantList& args ); + NotificationsEngine(QObject* parent, const QVariantList &args); ~NotificationsEngine(); - virtual void init(); - /** * This function implements part of Notifications DBus interface. * Once called, will add notification source to the engine */ - uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout); + uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, + const QString &summary, const QString &body, const QStringList &actions, + const QVariantMap &hints, int timeout); - void CloseNotification( uint id ); + void CloseNotification(uint id); - Plasma::Service* serviceForSource(const QString& source); + Plasma::Service* serviceForSource(const QString &source); QStringList GetCapabilities(); - QString GetServerInformation(QString& vendor, QString& version, QString& specVersion); + QString GetServerInformation(QString &vendor, QString &version, QString &specVersion); - int createNotification(const QString &appName, const QString &appIcon, const QString &summary, const QString &body, int timeout, bool configurable, const QString &appRealName); + int createNotification(const QString &appName, const QString &appIcon, const QString &summary, + const QString &body, int timeout, bool configurable, const QString &appRealName); void configureNotification(const QString &appName); @@ -61,8 +62,8 @@ public Q_SLOTS: void userClosedNotification(uint id); signals: - void NotificationClosed( uint id, uint reason ); - void ActionInvoked( uint id, const QString& actionKey ); + void NotificationClosed(uint id, uint reason); + void ActionInvoked(uint id, const QString &actionKey); protected: void timerEvent(QTimerEvent *event);