From 5f85571d52e9f82486a379d017eb36eda2a9f30e Mon Sep 17 00:00:00 2001 From: Fabien Proriol Date: Sun, 25 May 2025 17:02:01 +0200 Subject: Change module to org.kazoe.xdg --- src/lib/xdgnotificationmanager.cpp | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/lib/xdgnotificationmanager.cpp') diff --git a/src/lib/xdgnotificationmanager.cpp b/src/lib/xdgnotificationmanager.cpp index 06e8594..bd70ed1 100644 --- a/src/lib/xdgnotificationmanager.cpp +++ b/src/lib/xdgnotificationmanager.cpp @@ -3,60 +3,60 @@ #include "xdgnotificationmessage.h" #include "notificationsadaptor.h" -uint xdg::serverNotify(QObject *obj, 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 KaZoe::serverNotify(QObject *obj, 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) { - xdg::NotificationManager *manager = qobject_cast(obj); + KaZoe::NotificationManager *manager = qobject_cast(obj); if(replaces_id != 0 && manager->m_pending.contains(replaces_id)) { - xdg::NotificationMessage *message = manager->m_pending[replaces_id]; + KaZoe::NotificationMessage *message = manager->m_pending[replaces_id]; message->update(app_name, app_icon, summary, body, actions, hints, timeout); } else { - xdg::NotificationMessage *message = new xdg::NotificationMessage(app_name, app_icon, summary, body, actions, hints, timeout, manager); + KaZoe::NotificationMessage *message = new KaZoe::NotificationMessage(app_name, app_icon, summary, body, actions, hints, timeout, manager); - QObject::connect(message, &xdg::NotificationMessage::appNameChanged, [manager, replaces_id](){ - const QVector roles = {xdg::NotificationManager::AppNameRole}; + QObject::connect(message, &KaZoe::NotificationMessage::appNameChanged, [manager, replaces_id](){ + const QVector roles = {KaZoe::NotificationManager::AppNameRole}; emit manager->dataChanged( manager->index(replaces_id), manager->index(replaces_id), roles); }); - QObject::connect(message, &xdg::NotificationMessage::appIconChanged, [manager, replaces_id](){ - const QVector roles = {xdg::NotificationManager::AppIconRole}; + QObject::connect(message, &KaZoe::NotificationMessage::appIconChanged, [manager, replaces_id](){ + const QVector roles = {KaZoe::NotificationManager::AppIconRole}; emit manager->dataChanged( manager->index(replaces_id), manager->index(replaces_id), roles); }); - QObject::connect(message, &xdg::NotificationMessage::summaryChanged, [manager, replaces_id](){ - const QVector roles = {xdg::NotificationManager::SummaryRole}; + QObject::connect(message, &KaZoe::NotificationMessage::summaryChanged, [manager, replaces_id](){ + const QVector roles = {KaZoe::NotificationManager::SummaryRole}; emit manager->dataChanged( manager->index(replaces_id), manager->index(replaces_id), roles); }); - QObject::connect(message, &xdg::NotificationMessage::bodyChanged, [manager, replaces_id](){ - const QVector roles = {xdg::NotificationManager::BodyRole}; + QObject::connect(message, &KaZoe::NotificationMessage::bodyChanged, [manager, replaces_id](){ + const QVector roles = {KaZoe::NotificationManager::BodyRole}; emit manager->dataChanged( manager->index(replaces_id), manager->index(replaces_id), roles); }); - QObject::connect(message, &xdg::NotificationMessage::actionsChanged, [manager, replaces_id](){ - const QVector roles = {xdg::NotificationManager::ActionsRole}; + QObject::connect(message, &KaZoe::NotificationMessage::actionsChanged, [manager, replaces_id](){ + const QVector roles = {KaZoe::NotificationManager::ActionsRole}; emit manager->dataChanged( manager->index(replaces_id), manager->index(replaces_id), roles); }); - QObject::connect(message, &xdg::NotificationMessage::hintsChanged, [manager, replaces_id](){ - const QVector roles = {xdg::NotificationManager::HintsRole}; + QObject::connect(message, &KaZoe::NotificationMessage::hintsChanged, [manager, replaces_id](){ + const QVector roles = {KaZoe::NotificationManager::HintsRole}; emit manager->dataChanged( manager->index(replaces_id), manager->index(replaces_id), @@ -64,8 +64,8 @@ uint xdg::serverNotify(QObject *obj, const QString &app_name, uint replaces_id, }); - QObject::connect(message, &xdg::NotificationMessage::expired, [manager](QObject *obj){ - xdg::NotificationMessage *msg = qobject_cast(obj); + QObject::connect(message, &KaZoe::NotificationMessage::expired, [manager](QObject *obj){ + KaZoe::NotificationMessage *msg = qobject_cast(obj); if(msg) { manager->close(manager->m_pending.key(msg), 1); @@ -82,7 +82,7 @@ uint xdg::serverNotify(QObject *obj, const QString &app_name, uint replaces_id, } -xdg::NotificationManager::NotificationManager(QObject *parent) +KaZoe::NotificationManager::NotificationManager(QObject *parent) : QAbstractListModel(parent) { m_server = new XdgNotificationServer(this); @@ -94,12 +94,12 @@ xdg::NotificationManager::NotificationManager(QObject *parent) XdgNotificationServer::RegisterServerToDbus(*m_server); } -int xdg::NotificationManager::rowCount(const QModelIndex &parent) const +int KaZoe::NotificationManager::rowCount(const QModelIndex &parent) const { return m_ids.count(); } -QVariant xdg::NotificationManager::data(const QModelIndex &index, int role) const +QVariant KaZoe::NotificationManager::data(const QModelIndex &index, int role) const { if(index.row() > m_ids.count()) return QVariant(); @@ -128,7 +128,7 @@ QVariant xdg::NotificationManager::data(const QModelIndex &index, int role) cons return QVariant(); } -QHash xdg::NotificationManager::roleNames() const +QHash KaZoe::NotificationManager::roleNames() const { QHash roles = QAbstractItemModel::roleNames(); roles[AppNameRole] = "appName"; @@ -142,12 +142,12 @@ QHash xdg::NotificationManager::roleNames() const } -int xdg::NotificationManager::nbNotifications() +int KaZoe::NotificationManager::nbNotifications() { return rowCount(); } -void xdg::NotificationManager::close(unsigned int id, unsigned int reason) +void KaZoe::NotificationManager::close(unsigned int id, unsigned int reason) { unsigned int index = m_ids.indexOf(id); beginRemoveRows(QModelIndex(), index, index); @@ -161,13 +161,13 @@ void xdg::NotificationManager::close(unsigned int id, unsigned int reason) m_server->sendNotificationClosed(id, reason); } -void xdg::NotificationManager::returnAction(unsigned int appid, const QString &key) +void KaZoe::NotificationManager::returnAction(unsigned int appid, const QString &key) { m_server->sendActionInvoked(appid, key); close(appid, 2); } -void xdg::NotificationManager::_closeNotification(unsigned int id) +void KaZoe::NotificationManager::_closeNotification(unsigned int id) { close(id, 3); } -- cgit v1.2.3