| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#ifndef DBUS_H |
| 13 |
#define DBUS_H |
| 14 |
|
| 15 |
#include "qtermparam.h" |
| 16 |
|
| 17 |
#include <QtCore/QMutex> |
| 18 |
#include <QtCore/QString> |
| 19 |
#include <QtCore/QMap> |
| 20 |
#include <QtCore/QObject> |
| 21 |
#include <QtGui/QImage> |
| 22 |
|
| 23 |
|
| 24 |
namespace QTerm |
| 25 |
{ |
| 26 |
class DBus: public QObject |
| 27 |
{ |
| 28 |
Q_OBJECT |
| 29 |
public: |
| 30 |
enum Action { |
| 31 |
Show_QTerm |
| 32 |
}; |
| 33 |
static DBus * instance(); |
| 34 |
bool notificationAvailable() const; |
| 35 |
bool sendNotification(const QString & summary, const QString & body, const QImage & image=QImage(), QList<DBus::Action> actions = QList<DBus::Action>() ); |
| 36 |
signals: |
| 37 |
void showQTerm(); |
| 38 |
private slots: |
| 39 |
void slotServiceOwnerChanged(const QString & serviceName, const QString & oldOwner, const QString & newOwner); |
| 40 |
void slotNotificationActionInvoked(uint id, const QString action); |
| 41 |
void slotNotificationClosed(uint id, uint reason); |
| 42 |
private: |
| 43 |
DBus(); |
| 44 |
void createConnection(); |
| 45 |
void closeNotification(uint id); |
| 46 |
void checkCapabilities(); |
| 47 |
static DBus * m_instance; |
| 48 |
bool m_notificationAvailable; |
| 49 |
QList<uint> m_idList; |
| 50 |
QStringList m_serverCapabilities; |
| 51 |
}; |
| 52 |
|
| 53 |
} |
| 54 |
#endif |