• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  *
19  */
20 
21 #ifndef WebNotificationPresenter_h
22 #define WebNotificationPresenter_h
23 
24 #include "qwebkitplatformplugin.h"
25 #include <QtGui>
26 
27 class WebNotificationWidget : public QWidget
28 {
29     Q_OBJECT
30 public:
31     WebNotificationWidget();
32     virtual ~WebNotificationWidget();
33 
34     void showNotification(const QWebNotificationData*);
35     bool event(QEvent*);
36 
37 Q_SIGNALS:
38     void notificationClosed();
39     void notificationClicked();
40 };
41 
42 class WebNotificationPresenter : public QWebNotificationPresenter
43 {
44     Q_OBJECT
45 public:
WebNotificationPresenter()46     WebNotificationPresenter()
47         : QWebNotificationPresenter()
48     {
49         m_widget = new WebNotificationWidget();
50         connect(m_widget, SIGNAL(notificationClosed()), this, SIGNAL(notificationClosed()));
51         connect(m_widget, SIGNAL(notificationClicked()), this, SIGNAL(notificationClicked()));
52     }
~WebNotificationPresenter()53     virtual ~WebNotificationPresenter() { m_widget->close(); delete m_widget; }
54 
showNotification(const QWebNotificationData * data)55     void showNotification(const QWebNotificationData* data) { m_widget->showNotification(data); }
56 
57 private:
58     WebNotificationWidget* m_widget;
59 };
60 
61 #endif // WebNotificationsUi_h
62