Changeset 64829 in webkit


Ignore:
Timestamp:
Aug 6, 2010 4:15:40 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-06 Luiz Agostini <luiz.agostini@openbossa.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
https://bugs.webkit.org/show_bug.cgi?id=43427

After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.

PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
to WebKit/qt/WebCoreSupport as well.

All classes that previously inherited from QtAbstractWebPopup now inherit from
QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
instance of class QWebSelectMethod instead of QtAbstractWebPopup.

  • WebCore.pro:
  • platform/qt/PopupMenuQt.cpp: Removed.
  • platform/qt/PopupMenuQt.h: Removed.
  • platform/qt/QtAbstractWebPopup.cpp: Removed.
  • platform/qt/QtAbstractWebPopup.h: Removed.
  • platform/qt/SearchPopupMenuQt.cpp: Removed.
  • platform/qt/SearchPopupMenuQt.h: Removed.

2010-08-06 Luiz Agostini <luiz.agostini@openbossa.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
https://bugs.webkit.org/show_bug.cgi?id=43427

After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.

PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
to WebKit/qt/WebCoreSupport as well.

All classes that previously inherited from QtAbstractWebPopup now inherit from
QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
instance of class QWebSelectMethod instead of QtAbstractWebPopup.

  • WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::createSelectPopup): (WebCore::ChromeClientQt::createPopupMenu): (WebCore::ChromeClientQt::createSearchPopupMenu):
  • WebCoreSupport/ChromeClientQt.h:
  • WebCoreSupport/PopupMenuQt.cpp: Added. (SelectData::SelectData): (SelectData::itemText): (SelectData::itemToolTip): (SelectData::itemIsEnabled): (SelectData::itemCount): (SelectData::itemIsSelected): (SelectData::multiple): (SelectData::itemType): (WebCore::PopupMenuQt::PopupMenuQt): (WebCore::PopupMenuQt::~PopupMenuQt): (WebCore::PopupMenuQt::disconnectClient): (WebCore::PopupMenuQt::show): (WebCore::PopupMenuQt::didHide): (WebCore::PopupMenuQt::hide): (WebCore::PopupMenuQt::updateFromElement): (WebCore::PopupMenuQt::selectItem):
  • WebCoreSupport/PopupMenuQt.h: Added.
  • WebCoreSupport/QtFallbackWebPopup.cpp: (WebCore::QtFallbackWebPopupCombo::hidePopup): (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): (WebCore::QtFallbackWebPopup::show): (WebCore::QtFallbackWebPopup::populate): (WebCore::QtFallbackWebPopup::activeChanged): (WebCore::QtFallbackWebPopup::pageClient):
  • WebCoreSupport/QtFallbackWebPopup.h: (WebCore::QtFallbackWebPopup::setGeometry): (WebCore::QtFallbackWebPopup::geometry): (WebCore::QtFallbackWebPopup::setFont): (WebCore::QtFallbackWebPopup::font):
  • WebCoreSupport/QtMaemoWebPopup.cpp: (WebCore::Maemo5Popup::populateList): (WebCore::QtMaemoWebPopup::QtMaemoWebPopup): (WebCore::QtMaemoWebPopup::createSingleSelectionPopup): (WebCore::QtMaemoWebPopup::createMultipleSelectionPopup): (WebCore::QtMaemoWebPopup::createPopup): (WebCore::QtMaemoWebPopup::show): (WebCore::QtMaemoWebPopup::popupClosed): (WebCore::QtMaemoWebPopup::itemClicked): (WebCore::Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup): (WebCore::Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup):
  • WebCoreSupport/QtMaemoWebPopup.h: (WebCore::Maemo5Popup::Maemo5Popup):
  • WebCoreSupport/QtPlatformPlugin.cpp: (WebCore::QtPlatformPlugin::createSelectInputMethod):
  • WebCoreSupport/QtPlatformPlugin.h:
  • WebCoreSupport/SearchPopupMenuQt.cpp: Added. (WebCore::SearchPopupMenuQt::SearchPopupMenuQt): (WebCore::SearchPopupMenuQt::popupMenu): (WebCore::SearchPopupMenuQt::saveRecentSearches): (WebCore::SearchPopupMenuQt::loadRecentSearches): (WebCore::SearchPopupMenuQt::enabled):
  • WebCoreSupport/SearchPopupMenuQt.h: Added.
Location:
trunk
Files:
1 added
3 deleted
11 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64828 r64829  
     12010-08-06  Luiz Agostini  <luiz.agostini@openbossa.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
     6        https://bugs.webkit.org/show_bug.cgi?id=43427
     7
     8        After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
     9        there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.
     10
     11        PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
     12        assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
     13        to WebKit/qt/WebCoreSupport as well.
     14
     15        All classes that previously inherited from QtAbstractWebPopup now inherit from
     16        QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
     17        instance of class QWebSelectMethod instead of QtAbstractWebPopup.
     18
     19        * WebCore.pro:
     20        * platform/qt/PopupMenuQt.cpp: Removed.
     21        * platform/qt/PopupMenuQt.h: Removed.
     22        * platform/qt/QtAbstractWebPopup.cpp: Removed.
     23        * platform/qt/QtAbstractWebPopup.h: Removed.
     24        * platform/qt/SearchPopupMenuQt.cpp: Removed.
     25        * platform/qt/SearchPopupMenuQt.h: Removed.
     26
    1272010-08-05  Marcus Bulach  <bulach@chromium.org>
    228
  • trunk/WebCore/WebCore.pro

    r64828 r64829  
    17141714    platform/qt/ClipboardQt.h \
    17151715    platform/qt/QWebPageClient.h \
    1716     platform/qt/QtAbstractWebPopup.h \
    17171716    platform/qt/QtStyleOptionWebComboBox.h \
    17181717    platform/qt/RenderThemeQt.h \
     
    21512150    $$PWD/../WebKit/qt/WebCoreSupport/PageClientQt.h \
    21522151    $$PWD/../WebKit/qt/WebCoreSupport/QtPlatformPlugin.h \
     2152    $$PWD/../WebKit/qt/WebCoreSupport/PopupMenuQt.h \
     2153    $$PWD/../WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h \
    21532154    $$PWD/platform/network/qt/DnsPrefetchHelper.h
    21542155
     
    22132214    platform/qt/PlatformTouchEventQt.cpp \
    22142215    platform/qt/PlatformTouchPointQt.cpp \
    2215     platform/qt/PopupMenuQt.cpp \
    2216     platform/qt/QtAbstractWebPopup.cpp \
    22172216    platform/qt/RenderThemeQt.cpp \
    22182217    platform/qt/ScrollbarQt.cpp \
    22192218    platform/qt/ScrollbarThemeQt.cpp \
    22202219    platform/qt/ScrollViewQt.cpp \
    2221     platform/qt/SearchPopupMenuQt.cpp \
    22222220    platform/qt/SharedTimerQt.cpp \
    22232221    platform/qt/SoundQt.cpp \
     
    22412239    ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \
    22422240    ../WebKit/qt/WebCoreSupport/PageClientQt.cpp \
     2241    ../WebKit/qt/WebCoreSupport/PopupMenuQt.cpp \
    22432242    ../WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp \
     2243    ../WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp \
    22442244    ../WebKit/qt/Api/qwebframe.cpp \
    22452245    ../WebKit/qt/Api/qgraphicswebview.cpp \
  • trunk/WebKit/qt/ChangeLog

    r64825 r64829  
     12010-08-06  Luiz Agostini  <luiz.agostini@openbossa.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
     6        https://bugs.webkit.org/show_bug.cgi?id=43427
     7
     8        After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
     9        there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.
     10
     11        PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
     12        assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
     13        to WebKit/qt/WebCoreSupport as well.
     14
     15        All classes that previously inherited from QtAbstractWebPopup now inherit from
     16        QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
     17        instance of class QWebSelectMethod instead of QtAbstractWebPopup.
     18
     19        * WebCoreSupport/ChromeClientQt.cpp:
     20        (WebCore::ChromeClientQt::createSelectPopup):
     21        (WebCore::ChromeClientQt::createPopupMenu):
     22        (WebCore::ChromeClientQt::createSearchPopupMenu):
     23        * WebCoreSupport/ChromeClientQt.h:
     24        * WebCoreSupport/PopupMenuQt.cpp: Added.
     25        (SelectData::SelectData):
     26        (SelectData::itemText):
     27        (SelectData::itemToolTip):
     28        (SelectData::itemIsEnabled):
     29        (SelectData::itemCount):
     30        (SelectData::itemIsSelected):
     31        (SelectData::multiple):
     32        (SelectData::itemType):
     33        (WebCore::PopupMenuQt::PopupMenuQt):
     34        (WebCore::PopupMenuQt::~PopupMenuQt):
     35        (WebCore::PopupMenuQt::disconnectClient):
     36        (WebCore::PopupMenuQt::show):
     37        (WebCore::PopupMenuQt::didHide):
     38        (WebCore::PopupMenuQt::hide):
     39        (WebCore::PopupMenuQt::updateFromElement):
     40        (WebCore::PopupMenuQt::selectItem):
     41        * WebCoreSupport/PopupMenuQt.h: Added.
     42        * WebCoreSupport/QtFallbackWebPopup.cpp:
     43        (WebCore::QtFallbackWebPopupCombo::hidePopup):
     44        (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
     45        (WebCore::QtFallbackWebPopup::show):
     46        (WebCore::QtFallbackWebPopup::populate):
     47        (WebCore::QtFallbackWebPopup::activeChanged):
     48        (WebCore::QtFallbackWebPopup::pageClient):
     49        * WebCoreSupport/QtFallbackWebPopup.h:
     50        (WebCore::QtFallbackWebPopup::setGeometry):
     51        (WebCore::QtFallbackWebPopup::geometry):
     52        (WebCore::QtFallbackWebPopup::setFont):
     53        (WebCore::QtFallbackWebPopup::font):
     54        * WebCoreSupport/QtMaemoWebPopup.cpp:
     55        (WebCore::Maemo5Popup::populateList):
     56        (WebCore::QtMaemoWebPopup::QtMaemoWebPopup):
     57        (WebCore::QtMaemoWebPopup::createSingleSelectionPopup):
     58        (WebCore::QtMaemoWebPopup::createMultipleSelectionPopup):
     59        (WebCore::QtMaemoWebPopup::createPopup):
     60        (WebCore::QtMaemoWebPopup::show):
     61        (WebCore::QtMaemoWebPopup::popupClosed):
     62        (WebCore::QtMaemoWebPopup::itemClicked):
     63        (WebCore::Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup):
     64        (WebCore::Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup):
     65        * WebCoreSupport/QtMaemoWebPopup.h:
     66        (WebCore::Maemo5Popup::Maemo5Popup):
     67        * WebCoreSupport/QtPlatformPlugin.cpp:
     68        (WebCore::QtPlatformPlugin::createSelectInputMethod):
     69        * WebCoreSupport/QtPlatformPlugin.h:
     70        * WebCoreSupport/SearchPopupMenuQt.cpp: Added.
     71        (WebCore::SearchPopupMenuQt::SearchPopupMenuQt):
     72        (WebCore::SearchPopupMenuQt::popupMenu):
     73        (WebCore::SearchPopupMenuQt::saveRecentSearches):
     74        (WebCore::SearchPopupMenuQt::loadRecentSearches):
     75        (WebCore::SearchPopupMenuQt::enabled):
     76        * WebCoreSupport/SearchPopupMenuQt.h: Added.
     77
    1782010-08-06  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    279
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r64825 r64829  
    592592#endif
    593593
    594 QtAbstractWebPopup* ChromeClientQt::createSelectPopup()
    595 {
    596     QtAbstractWebPopup* result = m_platformPlugin.createSelectInputMethod();
     594QWebSelectMethod* ChromeClientQt::createSelectPopup() const
     595{
     596    QWebSelectMethod* result = m_platformPlugin.createSelectInputMethod();
    597597    if (result)
    598598        return result;
     
    601601    return new QtMaemoWebPopup;
    602602#elif !defined(QT_NO_COMBOBOX)
    603     return new QtFallbackWebPopup;
     603    return new QtFallbackWebPopup(this);
    604604#else
    605605    return 0;
     
    634634PassRefPtr<PopupMenu> ChromeClientQt::createPopupMenu(PopupMenuClient* client) const
    635635{
    636     return adoptRef(new PopupMenuQt(client));
     636    return adoptRef(new PopupMenuQt(client, this));
    637637}
    638638
    639639PassRefPtr<SearchPopupMenu> ChromeClientQt::createSearchPopupMenu(PopupMenuClient* client) const
    640640{
    641     return adoptRef(new SearchPopupMenuQt(client));
     641    return adoptRef(new SearchPopupMenuQt(createPopupMenu(client)));
    642642}
    643643
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r64513 r64829  
    175175        virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
    176176
    177         QtAbstractWebPopup* createSelectPopup();
     177        QWebSelectMethod* createSelectPopup() const;
    178178
    179179        virtual void didReceiveViewportArguments(Frame*, const ViewportArguments&) const;
     
    189189        QEventLoop* m_eventLoop;
    190190
    191         QtPlatformPlugin m_platformPlugin;
     191        mutable QtPlatformPlugin m_platformPlugin;
    192192    };
    193193}
  • trunk/WebKit/qt/WebCoreSupport/PopupMenuQt.h

    r64828 r64829  
    2222
    2323#include "PopupMenu.h"
     24#include <QObject>
     25
     26class QWebSelectData;
     27class QWebSelectMethod;
    2428
    2529namespace WebCore {
    2630
     31class ChromeClientQt;
    2732class FrameView;
    28 class QtAbstractWebPopup;
    29 class Scrollbar;
    3033class PopupMenuClient;
    3134
    32 class PopupMenuQt : public PopupMenu {
     35class PopupMenuQt : public QObject, public PopupMenu {
     36    Q_OBJECT
    3337public:
    34     PopupMenuQt(PopupMenuClient*);
     38    PopupMenuQt(PopupMenuClient*, const ChromeClientQt*);
    3539    ~PopupMenuQt();
    3640
     
    4044    virtual void disconnectClient();
    4145
     46private slots:
     47    void didHide();
     48    void selectItem(int index, bool ctrl, bool shift);
     49
    4250private:
    4351    PopupMenuClient* m_popupClient;
    44     QtAbstractWebPopup* m_popup;
     52    QWebSelectMethod* m_popup;
     53    QWebSelectData* m_selectData;
     54    const ChromeClientQt* m_chromeClient;
    4555};
    4656
  • trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp

    r62251 r64829  
    2424#ifndef QT_NO_COMBOBOX
    2525
    26 #include "HostWindow.h"
    27 #include "PopupMenuClient.h"
     26#include "ChromeClientQt.h"
    2827#include "QWebPageClient.h"
    2928#include "qgraphicswebview.h"
     
    8079
    8180    m_ownerPopup.m_popupVisible = false;
    82     m_ownerPopup.popupDidHide();
     81    emit m_ownerPopup.didHide();
    8382    m_ownerPopup.destroyPopup();
    8483}
     
    9897// QtFallbackWebPopup
    9998
    100 QtFallbackWebPopup::QtFallbackWebPopup()
    101     : QtAbstractWebPopup()
    102     , m_popupVisible(false)
     99QtFallbackWebPopup::QtFallbackWebPopup(const ChromeClientQt* chromeClient)
     100    : m_popupVisible(false)
    103101    , m_combo(0)
     102    , m_chromeClient(chromeClient)
    104103{
    105104}
     
    110109}
    111110
    112 void QtFallbackWebPopup::show()
     111void QtFallbackWebPopup::show(const QWebSelectData& data)
    113112{
    114113    if (!pageClient())
     
    124123            SLOT(activeChanged(int)), Qt::QueuedConnection);
    125124
    126     populate();
    127     m_combo->setCurrentIndex(currentIndex());
     125    populate(data);
    128126
    129127    QRect rect = geometry();
     
    213211}
    214212
    215 void QtFallbackWebPopup::populate()
     213void QtFallbackWebPopup::populate(const QWebSelectData& data)
    216214{
    217215    QStandardItemModel* model = qobject_cast<QStandardItemModel*>(m_combo->model());
     
    221219    m_combo->setFont(font());
    222220#endif
    223     for (int i = 0; i < itemCount(); ++i) {
    224         switch (itemType(i)) {
    225         case Separator:
     221
     222    int currentIndex = -1;
     223    for (int i = 0; i < data.itemCount(); ++i) {
     224        switch (data.itemType(i)) {
     225        case QWebSelectData::Separator:
    226226            m_combo->insertSeparator(i);
    227227            break;
    228         case Group:
    229             m_combo->insertItem(i, itemText(i));
     228        case QWebSelectData::Group:
     229            m_combo->insertItem(i, data.itemText(i));
    230230            model->item(i)->setEnabled(false);
    231231            break;
    232         case Option:
    233             m_combo->insertItem(i, itemText(i));
    234             model->item(i)->setEnabled(itemIsEnabled(i));
     232        case QWebSelectData::Option:
     233            m_combo->insertItem(i, data.itemText(i));
     234            model->item(i)->setEnabled(data.itemIsEnabled(i));
     235            if (data.itemIsSelected(i))
     236                currentIndex = i;
    235237            break;
    236238        }
    237239    }
     240
     241    if (currentIndex >= 0)
     242        m_combo->setCurrentIndex(currentIndex);
    238243}
    239244
     
    243248        return;
    244249
    245     valueChanged(index);
     250    emit selectItem(index, false, false);
     251}
     252
     253QWebPageClient* QtFallbackWebPopup::pageClient() const
     254{
     255    return m_chromeClient->platformPageClient();
    246256}
    247257
  • trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h

    r62251 r64829  
    2121#define QtFallbackWebPopup_h
    2222
    23 #include "QtAbstractWebPopup.h"
     23#include "Platform.h"
     24#include "qwebkitplatformplugin.h"
     25
    2426#include <QComboBox>
    2527
     
    3032QT_END_NAMESPACE
    3133
     34class QWebPageClient;
     35
    3236namespace WebCore {
    3337
     38class ChromeClientQt;
    3439class QtFallbackWebPopupCombo;
    3540
    36 class QtFallbackWebPopup : public QObject, public QtAbstractWebPopup {
     41class QtFallbackWebPopup : public QWebSelectMethod {
    3742    Q_OBJECT
    3843public:
    39     QtFallbackWebPopup();
     44    QtFallbackWebPopup(const ChromeClientQt*);
    4045    ~QtFallbackWebPopup();
    4146
    42     virtual void show();
     47    virtual void show(const QWebSelectData&);
    4348    virtual void hide();
    4449
    4550    void destroyPopup();
     51
     52    void setGeometry(const QRect& rect) { m_geometry = rect; }
     53    QRect geometry() const { return m_geometry; }
     54
     55    void setFont(const QFont& font) { m_font = font; }
     56    QFont font() const { return m_font; }
    4657
    4758private slots:
     
    5263    bool m_popupVisible;
    5364    QtFallbackWebPopupCombo* m_combo;
     65    const ChromeClientQt* m_chromeClient;
     66    QRect m_geometry;
     67    QFont m_font;
    5468
    55     void populate();
     69    QWebPageClient* pageClient() const;
     70
     71    void populate(const QWebSelectData&);
    5672#if ENABLE(SYMBIAN_DIALOG_PROVIDERS)
    5773    void showS60BrowserDialog();
  • trunk/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp

    r56929 r64829  
    4242    QListWidgetItem* listItem;
    4343    for (int i = 0; i < m_data.itemCount(); ++i) {
    44         if (m_data.itemType(i) == QtAbstractWebPopup::Option) {
     44        if (m_data.itemType(i) == QWebSelectData::Option) {
    4545            listItem = new QListWidgetItem(m_data.itemText(i));
    4646            m_list->addItem(listItem);
    4747            listItem->setSelected(m_data.itemIsSelected(i));
    48         } else if (m_data.itemType(i) == QtAbstractWebPopup::Group) {
     48        } else if (m_data.itemType(i) == QWebSelectData::Group) {
    4949            listItem = new QListWidgetItem(m_data.itemText(i));
    5050            m_list->addItem(listItem);
     
    6363
    6464QtMaemoWebPopup::QtMaemoWebPopup()
    65     : QtAbstractWebPopup()
    66     , m_popup(0)
     65    : m_popup(0)
    6766{
    6867}
     
    7473}
    7574
    76 Maemo5Popup* QtMaemoWebPopup::createSingleSelectionPopup()
    77 {
    78     return new Maemo5SingleSelectionPopup(*this);
    79 }
    80 
    81 Maemo5Popup* QtMaemoWebPopup::createMultipleSelectionPopup()
    82 {
    83     return new Maemo5MultipleSelectionPopup(*this);
    84 }
    85 
    86 Maemo5Popup* QtMaemoWebPopup::createPopup()
    87 {
    88     Maemo5Popup* result = multiple() ? createMultipleSelectionPopup() : createSingleSelectionPopup();
     75Maemo5Popup* QtMaemoWebPopup::createSingleSelectionPopup(const QWebSelectData& data)
     76{
     77    return new Maemo5SingleSelectionPopup(data);
     78}
     79
     80Maemo5Popup* QtMaemoWebPopup::createMultipleSelectionPopup(const QWebSelectData& data)
     81{
     82    return new Maemo5MultipleSelectionPopup(data);
     83}
     84
     85Maemo5Popup* QtMaemoWebPopup::createPopup(const QWebSelectData& data)
     86{
     87    Maemo5Popup* result = data.multiple() ? createMultipleSelectionPopup(data) : createSingleSelectionPopup(data);
    8988    connect(result, SIGNAL(finished(int)), this, SLOT(popupClosed()));
    9089    connect(result, SIGNAL(itemClicked(int)), this, SLOT(itemClicked(int)));
     
    9291}
    9392
    94 void QtMaemoWebPopup::show()
    95 {
    96     if (!pageClient() || m_popup)
     93void QtMaemoWebPopup::show(const QWebSelectData& data)
     94{
     95    if (m_popup)
    9796        return;
    9897
    99     m_popup = createPopup();
     98    m_popup = createPopup(data);
    10099    m_popup->show();
    101100}
     
    116115    m_popup->deleteLater();
    117116    m_popup = 0;
    118     popupDidHide();
     117    emit didHide();
    119118}
    120119
    121120void QtMaemoWebPopup::itemClicked(int idx)
    122121{
    123     selectItem(idx, true, false);
    124 }
    125 
    126 Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup(QtAbstractWebPopup& data)
     122    emit selectItem(idx, true, false);
     123}
     124
     125Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup(const QWebSelectData& data)
    127126    : Maemo5Popup(data)
    128127{
     
    171170};
    172171
    173 Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup(QtAbstractWebPopup& data)
     172Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup(const QWebSelectData& data)
    174173    : Maemo5Popup(data)
    175174{
  • trunk/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h

    r56929 r64829  
    2121#define QtMaemoWebPopup_h
    2222
    23 #include "QtAbstractWebPopup.h"
     23#include "qwebkitplatformplugin.h"
    2424
    2525#include <QDialog>
     
    3434    Q_OBJECT
    3535public:
    36     Maemo5Popup(QtAbstractWebPopup& data) : m_data(data) {}
     36    Maemo5Popup(const QWebSelectData& data) : m_data(data) {}
    3737
    3838signals:
     
    4545    void populateList();
    4646
    47     QtAbstractWebPopup& m_data;
     47    const QWebSelectData& m_data;
    4848    QListWidget* m_list;
    4949};
    5050
    5151
    52 class QtMaemoWebPopup : public QObject, public QtAbstractWebPopup {
     52class QtMaemoWebPopup : public QWebSelectMethod {
    5353    Q_OBJECT
    5454public:
     
    5656    ~QtMaemoWebPopup();
    5757
    58     virtual void show();
     58    virtual void show(const QWebSelectData& data);
    5959    virtual void hide();
    6060
     
    6666    Maemo5Popup* m_popup;
    6767
    68     Maemo5Popup* createPopup();
    69     Maemo5Popup* createSingleSelectionPopup();
    70     Maemo5Popup* createMultipleSelectionPopup();
     68    Maemo5Popup* createPopup(const QWebSelectData& data);
     69    Maemo5Popup* createSingleSelectionPopup(const QWebSelectData& data);
     70    Maemo5Popup* createMultipleSelectionPopup(const QWebSelectData& data);
    7171};
    7272
     
    7575    Q_OBJECT
    7676public:
    77     Maemo5SingleSelectionPopup(QtAbstractWebPopup& data);
     77    Maemo5SingleSelectionPopup(const QWebSelectData& data);
    7878};
    7979
     
    8282    Q_OBJECT
    8383public:
    84     Maemo5MultipleSelectionPopup(QtAbstractWebPopup& data);
     84    Maemo5MultipleSelectionPopup(const QWebSelectData& data);
    8585};
    8686
  • trunk/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp

    r61487 r64829  
    2929
    3030namespace WebCore {
    31 
    32 class SelectData : public QWebSelectData {
    33 public:
    34     SelectData(QtAbstractWebPopup* data) : d(data) {}
    35 
    36     virtual ItemType itemType(int) const;
    37     virtual QString itemText(int index) const { return d->itemText(index); }
    38     virtual QString itemToolTip(int index) const { return d->itemToolTip(index); }
    39     virtual bool itemIsEnabled(int index) const { return d->itemIsEnabled(index); }
    40     virtual int itemCount() const { return d->itemCount(); }
    41     virtual bool itemIsSelected(int index) const { return d->itemIsSelected(index); }
    42     virtual bool multiple() const { return d->multiple(); }
    43 
    44 private:
    45     QtAbstractWebPopup* d;
    46 };
    47 
    48 QWebSelectData::ItemType SelectData::itemType(int index) const
    49 {
    50     switch (d->itemType(index)) {
    51     case QtAbstractWebPopup::Separator: return Separator;
    52     case QtAbstractWebPopup::Group: return Group;
    53     default: return Option;
    54     }
    55 }
    56 
    57 SelectInputMethodWrapper::SelectInputMethodWrapper(QWebSelectMethod* plugin)
    58     : m_plugin(plugin)
    59     , m_selectData(0)
    60 {
    61     m_plugin->setParent(this);
    62     connect(m_plugin, SIGNAL(didHide()), this, SLOT(didHide()));
    63     connect(m_plugin, SIGNAL(selectItem(int, bool, bool)), this, SLOT(selectItem(int, bool, bool)));
    64 }
    65 
    66 SelectInputMethodWrapper::~SelectInputMethodWrapper()
    67 {
    68     delete m_selectData;
    69 }
    70 
    71 void SelectInputMethodWrapper::show()
    72 {
    73     if (m_selectData)
    74         delete m_selectData;
    75     m_selectData = new SelectData(this);
    76     m_plugin->show(*m_selectData);
    77 }
    78 
    79 void SelectInputMethodWrapper::hide()
    80 {
    81     m_plugin->hide();
    82 }
    83 
    84 void SelectInputMethodWrapper::selectItem(int index, bool allowMultiplySelections, bool shift)
    85 {
    86     QtAbstractWebPopup::selectItem(index, allowMultiplySelections, shift);
    87 }
    88 
    89 void SelectInputMethodWrapper::didHide()
    90 {
    91     QtAbstractWebPopup::popupDidHide();
    92 }
    93 
    94 // QtPlatformPlugin
    9531
    9632bool QtPlatformPlugin::load(const QString& file)
     
    15389}
    15490
    155 QtAbstractWebPopup* QtPlatformPlugin::createSelectInputMethod()
     91QWebSelectMethod* QtPlatformPlugin::createSelectInputMethod()
    15692{
    15793    QWebKitPlatformPlugin* p = plugin();
    158     if (!p)
    159         return 0;
    160 
    161     QWebSelectMethod* selector = p->createSelectInputMethod();
    162     if (!selector)
    163         return 0;
    164 
    165     return new SelectInputMethodWrapper(selector);
     94    return p ? p->createSelectInputMethod() : 0;
    16695}
    16796
  • trunk/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h

    r61487 r64829  
    2222#define QtPlatformPlugin_h
    2323
    24 #include "QtAbstractWebPopup.h"
    25 #include <QObject>
    2624#include <QPluginLoader>
    2725
     
    3331namespace WebCore {
    3432
    35 class SelectInputMethodWrapper : public QObject, public QtAbstractWebPopup {
    36     Q_OBJECT
    37 public:
    38     SelectInputMethodWrapper(QWebSelectMethod* plugin);
    39     ~SelectInputMethodWrapper();
    40 
    41     virtual void show();
    42     virtual void hide();
    43 
    44 private Q_SLOTS:
    45     void selectItem(int index, bool allowMultiplySelections, bool shift);
    46     void didHide();
    47 
    48 private:
    49     QWebSelectMethod* m_plugin;
    50     QWebSelectData* m_selectData;
    51 };
    52 
    5333class QtPlatformPlugin {
    5434public:
     
    5636    ~QtPlatformPlugin();
    5737
    58     QtAbstractWebPopup* createSelectInputMethod();
     38    QWebSelectMethod* createSelectInputMethod();
    5939    QWebNotificationPresenter* createNotificationPresenter();
    6040
  • trunk/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp

    r64828 r64829  
    2424namespace WebCore {
    2525
    26 SearchPopupMenuQt::SearchPopupMenuQt(PopupMenuClient* client)
    27     : m_popup(adoptRef(new PopupMenuQt(client)))
     26SearchPopupMenuQt::SearchPopupMenuQt(PassRefPtr<PopupMenu> popup)
     27    : m_popup(popup)
    2828{
    2929}
  • trunk/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h

    r64828 r64829  
    2222#define SearchPopupMenuQt_h
    2323
    24 #include "PopupMenuQt.h"
    2524#include "SearchPopupMenu.h"
    2625
     
    2928class SearchPopupMenuQt : public SearchPopupMenu {
    3029public:
    31     SearchPopupMenuQt(PopupMenuClient*);
     30    SearchPopupMenuQt(PassRefPtr<PopupMenu> popup);
    3231
    3332    virtual PopupMenu* popupMenu();
     
    3736
    3837private:
    39     RefPtr<PopupMenuQt> m_popup;
     38    RefPtr<PopupMenu> m_popup;
    4039};
    4140
Note: See TracChangeset for help on using the changeset viewer.