* Quasselfied 2010 by Manuel Nickschas <sputnick@quassel-irc.org> *
* *
* This file is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
+ * it under the terms of the GNU Library General Public License (LGPL) *
+ * as published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef STATUSNOTIFIERITEMDBUS_H_
#define STATUSNOTIFIERITEMDBUS_H_
-#include <QObject>
-#include <QString>
#include <QDBusArgument>
#include <QDBusConnection>
+#include <QObject>
#include <QPixmap>
+#include <QString>
-//Custom message type for DBus
-struct DBusImageStruct {
+// Custom message type for DBus
+struct DBusImageStruct
+{
int width;
int height;
QByteArray data;
};
-typedef QVector<DBusImageStruct> DBusImageVector;
+using DBusImageVector = QVector<DBusImageStruct>;
-struct DBusToolTipStruct {
+struct DBusToolTipStruct
+{
QString icon;
DBusImageVector image;
QString title;
Q_PROPERTY(DBusImageVector AttentionIconPixmap READ AttentionIconPixmap)
Q_PROPERTY(QString AttentionMovieName READ AttentionMovieName)
Q_PROPERTY(DBusToolTipStruct ToolTip READ ToolTip)
+ Q_PROPERTY(QString IconThemePath READ IconThemePath)
+ Q_PROPERTY(QDBusObjectPath Menu READ Menu)
friend class StatusNotifierItem;
+
public:
- StatusNotifierItemDBus(StatusNotifierItem *parent);
- ~StatusNotifierItemDBus();
+ StatusNotifierItemDBus(StatusNotifierItem* parent);
+ ~StatusNotifierItemDBus() override;
+
+ /**
+ * @return the dbus connection used by this object
+ */
+ QDBusConnection dbusConnection() const;
+
+ /**
+ * Register the StatusNotifierItem to DBus
+ */
+ void registerTrayIcon();
+
+ /**
+ * Unregister the StatusNotifierItem from DBus
+ */
+ void unregisterTrayIcon();
/**
* @return the service this object is registered on the bus under
*/
DBusToolTipStruct ToolTip() const;
+ /**
+ * @return path to extra icon theme, to load application specific icons
+ */
+ QString IconThemePath() const;
-public Q_SLOTS:
- //interaction
+ /**
+ * @return object path to the dbusmenu object
+ */
+ QDBusObjectPath Menu() const;
+
+public slots:
+ // interaction
/**
* Shows the context menu associated to this item
* at the desired screen position
/**
* Inform this item that the mouse wheel was used on its representation
*/
- void Scroll(int delta, const QString &orientation);
+ void Scroll(int delta, const QString& orientation);
-Q_SIGNALS:
+signals:
/**
* Inform the systemtray that the own main icon has been changed,
* so should be reloaded
* Signal the new status when it has been changed
* @see Status
*/
- void NewStatus(const QString &status);
+ void NewStatus(const QString& status);
private:
- StatusNotifierItem *m_statusNotifierItem;
- QString m_service;
+ StatusNotifierItem* m_statusNotifierItem;
QDBusConnection m_dbus;
static int s_serviceCount;
};
-
-const QDBusArgument &operator<<(QDBusArgument &argument, const DBusImageStruct &icon);
-const QDBusArgument &operator>>(const QDBusArgument &argument, DBusImageStruct &icon);
+const QDBusArgument& operator<<(QDBusArgument& argument, const DBusImageStruct& icon);
+const QDBusArgument& operator>>(const QDBusArgument& argument, DBusImageStruct& icon);
Q_DECLARE_METATYPE(DBusImageStruct)
-const QDBusArgument &operator<<(QDBusArgument &argument, const DBusImageVector &iconVector);
-const QDBusArgument &operator>>(const QDBusArgument &argument, DBusImageVector &iconVector);
+const QDBusArgument& operator<<(QDBusArgument& argument, const DBusImageVector& iconVector);
+const QDBusArgument& operator>>(const QDBusArgument& argument, DBusImageVector& iconVector);
Q_DECLARE_METATYPE(DBusImageVector)
-const QDBusArgument &operator<<(QDBusArgument &argument, const DBusToolTipStruct &toolTip);
-const QDBusArgument &operator>>(const QDBusArgument &argument, DBusToolTipStruct &toolTip);
+const QDBusArgument& operator<<(QDBusArgument& argument, const DBusToolTipStruct& toolTip);
+const QDBusArgument& operator>>(const QDBusArgument& argument, DBusToolTipStruct& toolTip);
Q_DECLARE_METATYPE(DBusToolTipStruct)