mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
plasma: remove redundant virtual NotificationsEngine::init() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
14223a1863
commit
771aa0ae06
2 changed files with 38 additions and 38 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue