ColorChooserPopupUIController::~ColorChooserPopupUIController()
{
#if !ENABLE(OILPAN)
    closePopup();
#endif
    // ~ColorChooserUIController ends the ColorChooser.
}
예제 #2
0
void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue)
{
    ASSERT(m_element);

    static const char* cancelValue = "-1";
    if (stringValue == cancelValue) {
        closePopup();
        return;
    }

    if (m_size > 0) {
        bool selecteds[m_size];
        for (unsigned i = 0; i < m_size; i++)
            selecteds[i] = stringValue[i] - '0';

        const Vector<HTMLElement*>& items = m_element->listItems();

        if (items.size() != static_cast<unsigned int>(m_size))
            return;

        HTMLOptionElement* option;
        for (unsigned i = 0; i < m_size; i++) {
            if (items[i]->hasTagName(HTMLNames::optionTag)) {
                option = static_cast<HTMLOptionElement*>(items[i]);
                option->setSelectedState(selecteds[i]);
            }
        }
    }
    // Force repaint because we do not send mouse events to the select element
    // and the element doesn't automatically repaint itself.
    if (m_element->renderer())
        m_element->renderer()->repaint();

    m_notifyChangeTimer.startOneShot(0);
}
void ColorChooserPopupUIController::endChooser()
{
    if (m_chooser)
        m_chooser->endChooser();

    closePopup();
}
예제 #4
0
void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue)
{

    ASSERT(m_size == stringValue.length());

    if (m_size > 0) {
        bool selecteds[m_size];
        for (unsigned i = 0; i < m_size; i++)
            selecteds[i] = stringValue[i] - '0';

        const WTF::Vector<HTMLElement*>& items = m_element->listItems();

        if (items.size() != static_cast<unsigned int>(m_size))
            return;

        HTMLOptionElement* option;
        for (unsigned i = 0; i < m_size; i++) {
            if (items[i]->hasTagName(HTMLNames::optionTag)) {
                option = static_cast<HTMLOptionElement*>(items[i]);
                option->setSelectedState(selecteds[i]);
            }
        }
    }
    // Force repaint because we do not send mouse events to the select element
    // and the element doesn't automatically repaint itself.
    m_element->dispatchFormControlChangeEvent();
    m_element->renderer()->repaint();
    closePopup();
}
예제 #5
0
void ConfirmDialog::clickCloseCallback(cocos2d::CCObject *sender) {
    if (_closeCallback && _closeTarget) {
        (_closeTarget->*_closeCallback)(sender);
    }
    
    closePopup();
}
예제 #6
0
bool PreferencesForm::handleControlSelected(const EventType& event)
{
    switch (event.data.ctlSelect.controlID)
    {
        case modulesButton:
            if (pageModules == displayPage_)
                break;
            setDisplayPage(pageModules);
            update();
            break;
            
        case displayButton:
            if (pageDisplay == displayPage_)
                break;
            setDisplayPage(pageDisplay);
            update();
            break;

        case okButton:
            handleOkButton();
            break;

        case cancelButton:
            closePopup();
            break;

        case layoutPopupTrigger:
            return false;
    
        default:
            assert(false);
    }
    return true;
}
예제 #7
0
void LocationCompleter::indexShiftActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        bookmark->updateVisitCount();
    }

    const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
    const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();

    // Load url (instead of switching to tab) with shift activation
    if (tabPos > -1) {
        loadUrl(url);
        return;
    }

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    // Open new window
    mApp->createWindow(Qz::BW_NewWindow, url);
}
예제 #8
0
void LocationCompleter::indexDeleteRequested(const QModelIndex &index)
{
    if (!index.isValid()) {
        return;
    }

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        mApp->bookmarks()->removeBookmark(bookmark);
    }
    else {
        int id = index.data(LocationCompleterModel::IdRole).toInt();
        mApp->history()->deleteHistoryEntry(id);
    }

    s_view->setUpdatesEnabled(false);
    s_model->removeRow(index.row(), index.parent());
    s_view->setUpdatesEnabled(true);

    // Close popup when removing last item
    if (s_model->rowCount() == 0) {
        closePopup();
    }
    else {
        adjustPopupSize();
    }
}
예제 #9
0
QvisScreenPositionEdit::QvisScreenPositionEdit(QWidget *parent) : 
    QWidget(parent)
{
    QHBoxLayout *hLayout = new QHBoxLayout(this);
    hLayout->setMargin(0);
    hLayout->setSpacing(0);
    lineEdit = new QLineEdit(this);
    connect(lineEdit, SIGNAL(returnPressed()),
            this, SLOT(returnPressed()));
    hLayout->addWidget(lineEdit);

    turnDown = new QvisTurnDownButton(this);
    connect(turnDown, SIGNAL(pressed()),
            this, SLOT(popup()));
    hLayout->addWidget(turnDown);

    lineEdit->setMinimumHeight(turnDown->height());

    screenPositionPopup = new QvisScreenPositioner(this, Qt::Popup);
    screenPositionPopup->setFixedSize(QSize(150,150));
    connect(screenPositionPopup,
            SIGNAL(intermediateScreenPositionChanged(double,double)),
            this, SLOT(updateText(double, double)));
    connect(screenPositionPopup,
            SIGNAL(screenPositionChanged(double,double)),
            this, SLOT(newScreenPosition(double, double)));

    popupTimer = new QTimer(this);
    connect(popupTimer, SIGNAL(timeout()),
            this, SLOT(closePopup()));

    setPosition(0.5f, 0.5f);
}
예제 #10
0
void ColorChooserUIController::endChooser()
{
    if (m_chooser)
        m_chooser->endChooser();
    if (m_popup)
        closePopup();
}
예제 #11
0
void DatePickerClient::setValueAndClosePopup(int, const String& value)
{
    // Return -1 if user cancel the selection.
    ASSERT(m_element);

    if (value != "-1")
        m_element->setValue(value);
    closePopup();
}
예제 #12
0
void LocationCompleter::loadUrl(const QUrl &url)
{
    closePopup();

    // Show url in locationbar
    emit showCompletion(url.toEncoded());

    // Load url
    emit loadCompletion();
}
예제 #13
0
void
QvisScreenPositionEdit::newScreenPosition(double x, double y)
{
    screenX = x;
    screenY = y;
    updateText(screenX, screenY);
    closePopup();

    emit screenPositionChanged(screenX, screenY);
}
예제 #14
0
void LocationCompleter::loadRequest(const LoadRequest &request)
{
    closePopup();

    // Show url in locationbar
    emit showCompletion(request.url().toString(), false);

    // Load request
    emit loadRequested(request);
}
예제 #15
0
void ColorChooserUIController::setValueAndClosePopup(int numValue, const String& stringValue)
{
    ASSERT(m_popup);
    ASSERT(m_client);
    if (numValue == ColorPickerPopupActionSetValue)
        m_client->didChooseColor(WebCore::Color(stringValue));
    if (numValue == ColorPickerPopupActionChooseOtherColor)
        openColorChooser();
    closePopup();
}
예제 #16
0
void DatePickerClient::setValueAndClosePopup(int, const String& value)
{
    // Return -1 if user cancel the selection.
    ASSERT(m_element);

    // We hide caret when we select date input field, restore it when we close date picker.
    m_element->document()->frame()->selection()->setCaretVisible(true);

    if (value != "-1")
        m_element->setValue(value);
    closePopup();
}
예제 #17
0
KoContextHelpAction::KoContextHelpAction( KActionCollection* parent, QWidget* /*popupParent*/ )
    : KToggleAction( KIcon(BarIcon("help-contents")), i18n("Context Help"), parent)
{
    Q_ASSERT(parent);
    setShortcut(KShortcut("CTRL+Qt::SHIFT+F1"));

	m_popup = new KoContextHelpPopup( 0L );
	connect( m_popup, SIGNAL( wantsToBeClosed() ), this, SLOT( closePopup() ) );
	connect( this, SIGNAL( toggled( bool ) ), m_popup, SLOT( setShown( bool ) ) );
	connect( m_popup, SIGNAL( linkClicked( const QString& ) ), this, SIGNAL( linkClicked( const QString& ) ) );
    parent->addAction("help_context", this );
}
예제 #18
0
void LocationCompleter::indexCtrlActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());
    Q_ASSERT(m_window);

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    // Load request in new tab
    m_window->tabWidget()->addView(createLoadRequest(index), Qz::NT_CleanSelectedTab);
}
예제 #19
0
void BookmarksWidget::toggleSpeedDial()
{
    const SpeedDial::Page page = m_speedDial->pageForUrl(m_view->url());

    if (page.url.isEmpty()) {
        QString title = m_view->title();
        m_speedDial->addPage(m_view->url(), title);
    }
    else {
        m_speedDial->removePage(page);
    }

    closePopup();
}
예제 #20
0
void LocationCompleter::indexShiftActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    // Load request
    if (index.data(LocationCompleterModel::VisitSearchItemRole).toBool()) {
        loadRequest(LoadRequest(QUrl(m_originalText)));
    } else {
        loadRequest(createLoadRequest(index));
    }
}
예제 #21
0
void PreferencesForm::handleOkButton()
{
    bool changed = false;
    MoriartyModule* modules = application().modules();
    for (uint_t i = 0; i<MORIARTY_MODULES_COUNT; ++i)
    {
        bool moduleDisabled = !bool(modulesTable_.itemInt(i, tableItemCheckbox));
        changed = changed || (moduleDisabled != modules[i].disabledByUser);
        modules[i].disabledByUser = moduleDisabled;
    }

    Preferences* prefs = &application().preferences();
    if (prefs->mainFormView != layoutPopupIndex_)
    {
        prefs->mainFormView = layoutPopupIndex_;
        changed = true;    
    }
    closePopup();
    if (changed)
        sendEvent(MoriartyApplication::appActiveModulesCountChangedEvent);    
}
예제 #22
0
void LocationCompleter::indexCtrlActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());
    Q_ASSERT(m_window);

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        bookmark->updateVisitCount();
    }

    const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
    const QString title = index.data(LocationCompleterModel::TitleRole).toString();

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    // Open url in new tab
    m_window->tabWidget()->addView(url, title, Qz::NT_CleanSelectedTab);
}
예제 #23
0
void LocationCompleter::indexActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    bool ok;
    const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt(&ok);

    // Switch to tab with simple index activation
    if (ok && tabPos > -1) {
        BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>());
        Q_ASSERT(window);
        switchToTab(window, tabPos);
        return;
    }

    loadRequest(createLoadRequest(index));
}
예제 #24
0
bool StringSelectForm::handleEvent(EventType& event)
{
    int selection = noListSelection;
    switch (event.eType)
    {
        case lstSelectEvent:
            okButton_.hit();
            return true;
            
        case ctlSelectEvent: 
            if (okButton == event.data.ctlSelect.controlID)
                selection = choicesList_.selection();
            if (noListSelection != selection || cancelButton == event.data.ctlSelect.controlID)
            {
                closePopup();
                StringSelectNotifyData notifyData(selection);
                sendEvent(notifyEvent_, notifyData);
            }
            return true;
        
        case keyDownEvent:
        {
            int option = ExtendedList::optionScrollPagesWithLeftRight;
            if (application().runningOnTreo600())
                option = 0;
            if (choicesList_.handleKeyDownEvent(event, option | ExtendedList::optionFireListSelectOnCenter))
                return true;
            if (chrCarriageReturn == event.data.keyDown.chr || chrLineFeed == event.data.keyDown.chr)
            {
                okButton_.hit();
                return true;
            }
            // intentional fall-through
        }
        
        default:
            return MoriartyForm::handleEvent(event);
    }
}
예제 #25
0
void LocationCompleter::switchToTab(BrowserWindow* window, int tab)
{
    Q_ASSERT(window);
    Q_ASSERT(tab >= 0);

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    TabWidget* tabWidget = window->tabWidget();

    if (window->isActiveWindow() || tabWidget->currentIndex() != tab) {
        tabWidget->setCurrentIndex(tab);
        window->show();
        window->activateWindow();
        window->raise();
    }
    else {
        window->weView()->setFocus();
    }
}
예제 #26
0
void BookmarksWidget::toggleBookmark()
{
    if (m_bookmark) {
        if (m_edited) {
            // Change folder
            m_bookmarks->removeBookmark(m_bookmark);
            m_bookmarks->addBookmark(ui->folderButton->selectedFolder(), m_bookmark);
        }
        else {
            // Remove
            m_bookmarks->removeBookmark(m_bookmark);
        }
    }
    else {
        // Save bookmark
        BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
        bookmark->setTitle(m_view->title());
        bookmark->setUrl(m_view->url());
        m_bookmarks->addBookmark(ui->folderButton->selectedFolder(), bookmark);
    }

    closePopup();
}
void ColorChooserPopupUIController::dispose()
{
    // Finalized earlier so as to access m_chromeClient while alive.
    closePopup();
}
예제 #28
0
void ColorToolButton::selectColor(QColor c)
{
    m_color = c;
    emit colorChanged(c);
    QTimer::singleShot(0, this, SLOT(closePopup()));
}
예제 #29
0
void SelectPopupClient::notifySelectionChange(WebCore::Timer<SelectPopupClient>*)
{
    if (m_element)
        m_element->dispatchFormControlChangeEvent();
    closePopup();
}
예제 #30
0
void ChangeLocationForm::handleControlSelect(const EventType& event)
{
    bool pretendCancelPressed = true;
    char_t * newLocation = NULL;

    if (okButton == event.data.ctlSelect.controlID)
    {
        newLocation = locationField_.textCopy();
        if (NULL == newLocation)
            goto ClosePopup;

        StrStrip(newLocation);
        if (StrEmpty(newLocation))
            goto ClosePopup;

        LookupManager* lookupManager = application().lookupManager;
        Preferences& prefs = application().preferences();
        switch (whenOk_)
        {
            case moviesMode:
            {
                const String& curLocation = prefs.moviesLocation;
                // TODO: now that there's a chance, that the text we use is
                //   different than the string user gave, maybe it's a good idea
                //   to popup a confirmation dialog box with "Get movies for location $FOO"
                //   and "OK", "Cancel" so that the user has a chance to preview
                //   location he gave. Changing locations shouldn't be frequent so
                //   we can annoy users like that.
                //   "Cancel" would get us back to entering location form

                // change only if different than previous
                if (!equalsIgnoreCase(newLocation, curLocation))
                    lookupManager->fetchMovies(newLocation);
                break;
            }
            case weatherMode:
            {
                const String& curLocation = prefs.weatherPreferences.weatherLocation;
                // change only if different than previous
                if (!equalsIgnoreCase(curLocation, newLocation))
                    lookupManager->fetchWeather(newLocation, newLocation);
                break;
            }    
        }
        pretendCancelPressed = false;
    }

ClosePopup:
    if( NULL != newLocation)
        free(newLocation);
    closePopup();

    if (cancelButton == event.data.ctlSelect.controlID || pretendCancelPressed)
    {
        Preferences& prefs = application().preferences();
        switch (whenOk_)
        {
            case moviesMode:
                if (prefs.moviesLocation.empty())
                    application().runMainForm();
                break;
            case weatherMode:
                if (prefs.weatherPreferences.weatherLocationToServer.empty())
                    application().runMainForm();
                break;
        }
    }
}