2011-04-27 09:05:54 +02:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
2011-04-27 09:05:54 +02:00
|
|
|
*
|
|
|
|
* This program 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 3 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
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-04-22 16:03:38 +02:00
|
|
|
#ifndef DESKTOPNOTIFICATIONSFACTORY_H
|
|
|
|
#define DESKTOPNOTIFICATIONSFACTORY_H
|
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
#include "qz_namespace.h"
|
|
|
|
|
2011-04-22 16:03:38 +02:00
|
|
|
#include <QObject>
|
2011-04-23 22:33:25 +02:00
|
|
|
#include <QPoint>
|
2012-12-20 14:45:35 +01:00
|
|
|
#include <QPointer>
|
2012-02-29 18:33:50 +01:00
|
|
|
|
|
|
|
class QPixmap;
|
2013-07-25 11:37:54 +02:00
|
|
|
class QDBusMessage;
|
|
|
|
class QDBusError;
|
2011-04-22 16:03:38 +02:00
|
|
|
|
2011-04-23 22:33:25 +02:00
|
|
|
class DesktopNotification;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2014-02-19 22:12:32 +01:00
|
|
|
class QUPZILLA_EXPORT DesktopNotificationsFactory : public QObject
|
2011-04-22 16:03:38 +02:00
|
|
|
{
|
2013-07-25 11:37:54 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2011-04-22 16:03:38 +02:00
|
|
|
public:
|
2011-04-23 22:33:25 +02:00
|
|
|
enum Type { DesktopNative, PopupWidget };
|
2012-01-13 15:28:30 +01:00
|
|
|
|
2011-04-23 22:33:25 +02:00
|
|
|
explicit DesktopNotificationsFactory(QObject* parent = 0);
|
2011-04-22 16:03:38 +02:00
|
|
|
|
2012-01-21 20:27:45 +01:00
|
|
|
void loadSettings();
|
|
|
|
|
2012-07-10 11:56:24 +02:00
|
|
|
bool supportsNativeNotifications() const;
|
|
|
|
|
2012-07-08 14:03:50 +02:00
|
|
|
void showNotification(const QPixmap &icon, const QString &heading, const QString &text);
|
2011-11-19 18:21:22 +01:00
|
|
|
void nativeNotificationPreview();
|
|
|
|
|
2013-07-25 11:37:54 +02:00
|
|
|
private slots:
|
2013-08-01 21:51:56 +02:00
|
|
|
#if defined(QZ_WS_X11) && !defined(DISABLE_DBUS)
|
2013-07-25 11:37:54 +02:00
|
|
|
void updateLastId(const QDBusMessage &msg);
|
|
|
|
void error(const QDBusError &error);
|
2013-08-01 21:51:56 +02:00
|
|
|
#endif
|
2013-07-25 11:37:54 +02:00
|
|
|
|
2011-04-23 22:33:25 +02:00
|
|
|
private:
|
|
|
|
bool m_enabled;
|
|
|
|
int m_timeout;
|
|
|
|
Type m_notifType;
|
|
|
|
QPoint m_position;
|
|
|
|
|
2012-12-20 14:45:35 +01:00
|
|
|
QPointer<DesktopNotification> m_desktopNotif;
|
2012-04-12 15:41:28 +02:00
|
|
|
quint32 m_uint;
|
2011-04-22 16:03:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DESKTOPNOTIFICATIONSFACTORY_H
|