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#ifndef QtMaemoWebPopup_h
21#define QtMaemoWebPopup_h
22
23#include "qwebkitplatformplugin.h"
24
25#include <QDialog>
26
27class QListWidgetItem;
28class QListWidget;
29
30
31namespace WebCore {
32
33class Maemo5Popup : public QDialog {
34    Q_OBJECT
35public:
36    Maemo5Popup(const QWebSelectData& data) : m_data(data) {}
37
38signals:
39    void itemClicked(int idx);
40
41protected slots:
42    void onItemSelected(QListWidgetItem* item);
43
44protected:
45    void populateList();
46
47    const QWebSelectData& m_data;
48    QListWidget* m_list;
49};
50
51
52class QtMaemoWebPopup : public QWebSelectMethod {
53    Q_OBJECT
54public:
55    QtMaemoWebPopup();
56    ~QtMaemoWebPopup();
57
58    virtual void show(const QWebSelectData& data);
59    virtual void hide();
60
61private slots:
62    void popupClosed();
63    void itemClicked(int idx);
64
65private:
66    Maemo5Popup* m_popup;
67
68    Maemo5Popup* createPopup(const QWebSelectData& data);
69    Maemo5Popup* createSingleSelectionPopup(const QWebSelectData& data);
70    Maemo5Popup* createMultipleSelectionPopup(const QWebSelectData& data);
71};
72
73
74class Maemo5SingleSelectionPopup : public Maemo5Popup {
75    Q_OBJECT
76public:
77    Maemo5SingleSelectionPopup(const QWebSelectData& data);
78};
79
80
81class Maemo5MultipleSelectionPopup : public Maemo5Popup {
82    Q_OBJECT
83public:
84    Maemo5MultipleSelectionPopup(const QWebSelectData& data);
85};
86
87}
88
89#endif // QtMaemoWebPopup_h
90