Changeset View
Changeset View
Standalone View
Standalone View
dataengines/notifications/notificationaction.cpp
Show All 13 Lines | |||||
14 | * License along with this program; if not, write to the | 14 | * License along with this program; if not, write to the | ||
15 | * Free Software Foundation, Inc., | 15 | * Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "notificationaction.h" | 19 | #include "notificationaction.h" | ||
20 | #include "notificationsengine.h" | 20 | #include "notificationsengine.h" | ||
21 | 21 | | |||
22 | #include "server.h" | ||||
23 | | ||||
22 | #include <klocalizedstring.h> | 24 | #include <klocalizedstring.h> | ||
23 | 25 | | |||
24 | #include "debug.h" | 26 | #include "debug.h" | ||
25 | 27 | | |||
28 | using namespace NotificationManager; | ||||
29 | | ||||
26 | void NotificationAction::start() | 30 | void NotificationAction::start() | ||
27 | { | 31 | { | ||
28 | qCDebug(NOTIFICATIONS) << "Trying to perform the action " << operationName() << " on " << destination(); | 32 | qCDebug(NOTIFICATIONS) << "Trying to perform the action " << operationName() << " on " << destination(); | ||
29 | qCDebug(NOTIFICATIONS) << "actionId: " << parameters()["actionId"].toString(); | 33 | qCDebug(NOTIFICATIONS) << "actionId: " << parameters()["actionId"].toString(); | ||
30 | qCDebug(NOTIFICATIONS) << "params: " << parameters(); | 34 | qCDebug(NOTIFICATIONS) << "params: " << parameters(); | ||
31 | 35 | | |||
32 | if (!m_engine) { | 36 | if (!m_engine) { | ||
33 | setErrorText(i18n("The notification dataEngine is not set.")); | 37 | setErrorText(i18n("The notification dataEngine is not set.")); | ||
Show All 11 Lines | 46 | if (dest.count() > 1 && !dest[1].toInt()) { | |||
45 | emitResult(); | 49 | emitResult(); | ||
46 | return; | 50 | return; | ||
47 | } else if (dest.count() > 1) { | 51 | } else if (dest.count() > 1) { | ||
48 | id = dest[1].toUInt(); | 52 | id = dest[1].toUInt(); | ||
49 | } | 53 | } | ||
50 | 54 | | |||
51 | if (operationName() == QLatin1String("invokeAction")) { | 55 | if (operationName() == QLatin1String("invokeAction")) { | ||
52 | qCDebug(NOTIFICATIONS) << "invoking action on " << id; | 56 | qCDebug(NOTIFICATIONS) << "invoking action on " << id; | ||
53 | emit m_engine->ActionInvoked(id, parameters()[QStringLiteral("actionId")].toString()); | 57 | Server::self().invokeAction(id, parameters()[QStringLiteral("actionId")].toString()); | ||
54 | } else if (operationName() == QLatin1String("userClosed")) { | 58 | } else if (operationName() == QLatin1String("userClosed")) { | ||
55 | //userClosedNotification deletes the job, so we have to invoke it queued, in this case emitResult() can be called | 59 | //userClosedNotification deletes the job, so we have to invoke it queued, in this case emitResult() can be called | ||
56 | m_engine->metaObject()->invokeMethod(m_engine, "removeNotification", Qt::QueuedConnection, Q_ARG(uint, id), Q_ARG(uint, 2)); | 60 | m_engine->metaObject()->invokeMethod(m_engine, "removeNotification", Qt::QueuedConnection, Q_ARG(uint, id), Q_ARG(uint, 2)); | ||
57 | } else if (operationName() == QLatin1String("expireNotification")) { | 61 | } else if (operationName() == QLatin1String("expireNotification")) { | ||
58 | //expireNotification deletes the job, so we have to invoke it queued, in this case emitResult() can be called | 62 | //expireNotification deletes the job, so we have to invoke it queued, in this case emitResult() can be called | ||
59 | m_engine->metaObject()->invokeMethod(m_engine, "removeNotification", Qt::QueuedConnection, Q_ARG(uint, id), Q_ARG(uint, 1)); | 63 | m_engine->metaObject()->invokeMethod(m_engine, "removeNotification", Qt::QueuedConnection, Q_ARG(uint, id), Q_ARG(uint, 1)); | ||
60 | } else if (operationName() == QLatin1String("createNotification")) { | 64 | } else if (operationName() == QLatin1String("createNotification")) { | ||
61 | int expireTimeout = parameters().value(QStringLiteral("expireTimeout")).toInt(); | 65 | int expireTimeout = parameters().value(QStringLiteral("expireTimeout")).toInt(); | ||
Show All 32 Lines |