Commit 11b4e3a3b52741478f79011e1ef4e929ffcdd4e0
Added capability to show system note dialog
| |   |
| 8 | 8 | SOURCES += qnotification.cpp |
| 9 | 9 | HEADERS += qnotification.h qnotification_p.h |
| 10 | 10 | |
| QT += dbus |
|
| 11 | 13 | CONFIG += link_pkgconfig |
| 12 | 14 | PKGCONFIG += hildon-1 |
| |   |
| 26 | 26 | priv->showBanner(text); |
| 27 | 27 | } |
| 28 | 28 | |
| void QNotifications::showNote(const QString &text) |
| { |
| MAEMO_PRIVATE(QNotifications); |
| priv->showNote(text); |
| } |
|
| 29 | 35 | } //namespace |
| |   |
| 26 | 26 | |
| 27 | 27 | public Q_SLOTS: |
| 28 | 28 | void showBanner(const QString &text); |
| void showNote(const QString &text); |
| 29 | 30 | }; |
| 30 | 31 | |
| 31 | 32 | } //namespace |
| |   |
| 6 | 6 | #ifndef QNOTIFICATIONS_P_H |
| 7 | 7 | #define QNOTIFICATIONS_P_H |
| 8 | 8 | |
| #include <QtDBus> |
|
| 9 | 11 | #define __GTK_BINDINGS_H__ //gtkbindings.h:79 has colliding symbol "signal" |
| 10 | 12 | extern "C" { |
| 11 | 13 | #include <hildon/hildon-banner.h> |
| … | … | |
| 26 | 26 | QNotificationsPrivate(); |
| 27 | 27 | ~QNotificationsPrivate(); |
| 28 | 28 | void showBanner(const QString &text); |
| void showNote(const QString &text); |
| 29 | 30 | }; |
| 30 | 31 | |
| 31 | 32 | /* begin private implementation */ |
| … | … | |
| 44 | 44 | void QNotificationsPrivate::showBanner(const QString &text) |
| 45 | 45 | { |
| 46 | 46 | hildon_banner_show_information(0, "", text.toLatin1()); |
| } |
|
| void QNotificationsPrivate::showNote(const QString &text) |
| { |
| QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.Notifications", "/org/freedesktop/Notifications", |
| "org.freedesktop.Notifications", "SystemNoteDialog"); |
|
| QList<QVariant> args; |
| args.append(text); |
| args.append(static_cast<quint32>(0)); |
| args.append("ok"); |
|
| msg.setArguments(args); |
|
| QDBusConnection::systemBus().call(msg); |
| 47 | 62 | } |
| 48 | 63 | |
| 49 | 64 | } // namespace |