| 1 | /* |
| 2 | * Copyright (C) 2014 Canonical Ltd. |
| 3 | * |
| 4 | * Contact: Alberto Mardegan <[email protected]> |
| 5 | * |
| 6 | * This file is part of lomiri-online-accounts-service |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 3, as published |
| 10 | * by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include <online-accounts-common/debug.h>cxx . . $ `<file>/online-accounts-common/debug.h`/ |
| 22 | #include "notification.h"cxx . . $ `<file>/online-accounts-service/src/notification.h`/ |
| 23 | |
| 24 | #include <QByteArray> |
| 25 | #include <QCoreApplication> |
| 26 | #include <QString> |
| 27 | #include <libnotify/notification.h> |
| 28 | #include <libnotify/notify.h> |
| 29 | |
| 30 | using namespace OnlineAccountsUi; |
| 31 | |
| 32 | namespace OnlineAccountsUicxx . . $ OnlineAccountsUi/ { |
| 33 | |
| 34 | class NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#: public QObjectcxx . . $ QObject# |
| 35 | { |
| 36 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 37 | Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(Notification) |
| 38 | |
| 39 | public: |
| 40 | NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#NotificationPrivate(78c4f73eeb64829).(const QStringcxx . . $ QString# &summary, |
| 41 | const QStringcxx . . $ QString# &body, |
| 42 | Notificationcxx . . $ OnlineAccountsUi/Notification# *notification); |
| 43 | ~cxx . . $ OnlineAccountsUi/NotificationPrivate#`~NotificationPrivate`(ced63f7c635d850d).NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#(); |
| 44 | |
| 45 | static void actionCallbackcxx . . $ OnlineAccountsUi/NotificationPrivate#actionCallback(1aa5df9074335c1b).(NotifyNotification *, char *action, |
| 46 | Notificationcxx . . $ OnlineAccountsUi/Notification# *q); |
| 47 | |
| 48 | private: |
| 49 | NotifyNotification *m_notificationcxx . . $ OnlineAccountsUi/NotificationPrivate#m_notification.; |
| 50 | mutable Notificationcxx . . $ OnlineAccountsUi/Notification# *q_ptrcxx . . $ OnlineAccountsUi/NotificationPrivate#q_ptr.; |
| 51 | }; |
| 52 | |
| 53 | } // namespace |
| 54 | |
| 55 | static void onNotificationClosedcxx . . $ onNotificationClosed(c50e0b8c90630d0).(Notificationcxx . . $ OnlineAccountsUi/Notification# *notification) { |
| 56 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! notification->closedcxx . . $ OnlineAccountsUi/Notification#closed(49f6e7a06ebc5aa8).(); |
| 57 | } |
| 58 | |
| 59 | NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#::NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#NotificationPrivate(78c4f73eeb64829).(const QStringcxx . . $ QString# &summary, |
| 60 | const QStringcxx . . $ QString# &body, |
| 61 | Notificationcxx . . $ OnlineAccountsUi/Notification# *notification): |
| 62 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(notification), |
| 63 | m_notificationcxx . . $ OnlineAccountsUi/NotificationPrivate#m_notification.(0), |
| 64 | q_ptrcxx . . $ OnlineAccountsUi/NotificationPrivate#q_ptr.(notification) |
| 65 | { |
| 66 | if (!notify_is_initted()) { |
| 67 | QByteArraycxx . . $ QByteArray# name = QCoreApplicationcxx . . $ QCoreApplication#::applicationNamecxx . . $ QCoreApplication#applicationName(4365c3963150523e).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).(); |
| 68 | notify_init(name.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 69 | } |
| 70 | |
| 71 | QByteArraycxx . . $ QByteArray# summaryUtf8 = summary.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).(); |
| 72 | QByteArraycxx . . $ QByteArray# bodyUtf8 = body.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).(); |
| 73 | m_notificationcxx . . $ OnlineAccountsUi/NotificationPrivate#m_notification. = notify_notification_new(summaryUtf8.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(), |
| 74 | bodyUtf8.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(), |
| 75 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 76 | g_signal_connect_swappedcxx . . $ `<external>/15952772511652638895/gsignal.h:617:9`!(m_notification, "closed", |
| 77 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`!(onNotificationClosed), notification); |
| 78 | } |
| 79 | |
| 80 | NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#::~cxx . . $ OnlineAccountsUi/NotificationPrivate#`~NotificationPrivate`(ced63f7c635d850d).NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#() |
| 81 | { |
| 82 | g_object_unref(m_notificationcxx . . $ OnlineAccountsUi/NotificationPrivate#m_notification.); |
| 83 | } |
| 84 | |
| 85 | void NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#::actionCallbackcxx . . $ OnlineAccountsUi/NotificationPrivate#actionCallback(1aa5df9074335c1b).(NotifyNotification *, char *action, |
| 86 | Notificationcxx . . $ OnlineAccountsUi/Notification# *q) |
| 87 | { |
| 88 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! q->actionInvokedcxx . . $ OnlineAccountsUi/Notification#actionInvoked(3520e46b33348bf6).(QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(5ac70cc0fa2a874e).(action)); |
| 89 | } |
| 90 | |
| 91 | Notificationcxx . . $ OnlineAccountsUi/Notification#::Notificationcxx . . $ OnlineAccountsUi/Notification#Notification(b05324713c9ab95e).(const QStringcxx . . $ QString# &summary, |
| 92 | const QStringcxx . . $ QString# &body, |
| 93 | QObjectcxx . . $ QObject# *parent): |
| 94 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent), |
| 95 | d_ptrcxx . . $ OnlineAccountsUi/Notification#d_ptr.(new NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#NotificationPrivate(78c4f73eeb64829).(summary, body, this)) |
| 96 | { |
| 97 | } |
| 98 | |
| 99 | Notificationcxx . . $ OnlineAccountsUi/Notification#::~cxx . . $ OnlineAccountsUi/Notification#`~Notification`(ced63f7c635d850d).Notificationcxx . . $ OnlineAccountsUi/Notification#() |
| 100 | { |
| 101 | } |
| 102 | |
| 103 | void Notificationcxx . . $ OnlineAccountsUi/Notification#::addActioncxx . . $ OnlineAccountsUi/Notification#addAction(c1427772cd1877b0).(const QStringcxx . . $ QString# &action, const QStringcxx . . $ QString# &label) |
| 104 | { |
| 105 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Notification); |
| 106 | QByteArraycxx . . $ QByteArray# actionUtf8 = action.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).(); |
| 107 | QByteArraycxx . . $ QByteArray# labelUtf8 = label.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).(); |
| 108 | notify_notification_add_action(d->m_notificationcxx . . $ OnlineAccountsUi/NotificationPrivate#m_notification., |
| 109 | actionUtf8, labelUtf8, |
| 110 | NotifyActionCallback( |
| 111 | &NotificationPrivatecxx . . $ OnlineAccountsUi/NotificationPrivate#::actionCallbackcxx . . $ OnlineAccountsUi/NotificationPrivate#actionCallback(1aa5df9074335c1b).), |
| 112 | this, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 113 | } |
| 114 | |
| 115 | void Notificationcxx . . $ OnlineAccountsUi/Notification#::setSnapDecisioncxx . . $ OnlineAccountsUi/Notification#setSnapDecision(b45ddcbc8423892c).(bool snapDecision) |
| 116 | { |
| 117 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Notification); |
| 118 | notify_notification_set_hint(d->m_notificationcxx . . $ OnlineAccountsUi/NotificationPrivate#m_notification., |
| 119 | "x-lomiri-snap-decisions", |
| 120 | g_variant_new_boolean(snapDecision)); |
| 121 | } |
| 122 | |
| 123 | void Notificationcxx . . $ OnlineAccountsUi/Notification#::showcxx . . $ OnlineAccountsUi/Notification#show(49f6e7a06ebc5aa8).() |
| 124 | { |
| 125 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Notification); |
| 126 | GError *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 127 | if (!notify_notification_show(d->m_notificationcxx . . $ OnlineAccountsUi/NotificationPrivate#m_notification., &error)) { |
| 128 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Couldn't show notification:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). error->messagecxx . . $ _GError#message.; |
| 129 | g_clear_error(&error); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | #include "notification.moc"cxx . . $ `<file>/build/online-accounts-service/src/lomiri-online-accounts-service_autogen/include/notification.moc`/ |