Пример #1
0
Window::Window(QWidget *parent)
    : QMainWindow(parent),
        ui(new Ui::MainWindow)
{
    setAttribute(Qt::WA_Maemo5StackedWindow);
    setAttribute(Qt::WA_Maemo5AutoOrientation, true); // currently not working since libqt4-maemo5 is broken. Will work in PR1.2

    ui->setupUi(this);

    lastPath = QDir::homePath() + "/MyDocs/.documents";

    ui->searchDockWidget->hide();

    scaleFactors << 0.25 << 0.5 << 0.75 << 1. << 1.25 << 1.5 << 2. << 3. << 4.;

    //addDockWidget(Qt::BottomDockWidgetArea, selectionDockWidget);

    documentWidget = new DocumentWidget();
    ui->scrollArea->setWidget(documentWidget);

    connect(ui->exitAction, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->openAction, SIGNAL(triggered()), this, SLOT(openFile()));

//    connect(documentControlsAction, SIGNAL(toggled(bool)),
//            controlsDockWidget, SLOT(setVisible(bool)));
//    connect(selectedTextAction, SIGNAL(toggled(bool)),
//            selectionDockWidget, SLOT(setVisible(bool)));
//    connect(controlsDockWidget, SIGNAL(visibilityChanged(bool)),
//            documentControlsAction, SLOT(setChecked(bool)));
//    connect(selectionDockWidget, SIGNAL(visibilityChanged(bool)),
//            selectedTextAction, SLOT(setChecked(bool)));

    connect(ui->pageSpinBox, SIGNAL(valueChanged(int)),
            documentWidget, SLOT(setPage(int)));
    connect(documentWidget, SIGNAL(pageChanged(int)),
            ui->pageSpinBox, SLOT(setValue(int)));
    connect(ui->scaleComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(scaleDocument(int)));
    connect(documentWidget, SIGNAL(textSelected(const QString &)),
            this, SLOT(showSelectedText(const QString &)));

    connect(ui->searchLineEdit, SIGNAL(returnPressed()), this, SLOT(searchDocument()));
    connect(ui->findButton, SIGNAL(clicked()), this, SLOT(searchDocument()));
    connect(ui->searchLineEdit, SIGNAL(textChanged(const QString &)),
            this, SLOT(checkSearchText(const QString &)));

    ui->selectedTextAction->setChecked(false);
}
Пример #2
0
void WebAutofill::formFieldFocused(WebCore::HTMLFormControlElement* formFieldElement)
{
    if (!enabled()) {
        // In case that we've just been disabled and the last time we got autofill
        // suggestions we told Java about them, clear that bit Java side now
        // we're disabled.
        mWebViewCore->setWebTextViewAutoFillable(FORM_NOT_AUTOFILLABLE, string16());
        return;
    }

    ASSERT(formFieldElement);

    Document* doc = formFieldElement->document();
    Frame* frame = doc->frame();

    // FIXME: Autofill only works in main frame for now. Should consider
    // child frames.
    if (frame != frame->page()->mainFrame())
        return;

    unsigned domVersion = doc->domTreeVersion();
    ASSERT(domVersion > 0);

    if (mLastSearchDomVersion != domVersion) {
        // Need to extract forms as DOM version has changed since the last time
        // we searched.
        searchDocument(formFieldElement->document()->frame());
        mLastSearchDomVersion = domVersion;
    }

    ASSERT(mFormManager);

    // Get the FormField from the Node.
    webkit_glue::FormField* formField = new webkit_glue::FormField;
    FormManager::HTMLFormControlElementToFormField(formFieldElement, FormManager::EXTRACT_NONE, formField);
    formField->label = FormManager::LabelForElement(*formFieldElement);

    webkit_glue::FormData* form = new webkit_glue::FormData;
    mFormManager->FindFormWithFormControlElement(formFieldElement, FormManager::REQUIRE_AUTOCOMPLETE, form);
    mQueryMap[mQueryId] = new FormDataAndField(form, formField);

    bool suggestions = mAutofillManager->OnQueryFormFieldAutoFillWrapper(*form, *formField);

    mQueryId++;
    if (!suggestions) {
        ASSERT(mWebViewCore);
        // Tell Java no autofill suggestions for this form.
        mWebViewCore->setWebTextViewAutoFillable(FORM_NOT_AUTOFILLABLE, string16());
        return;
    }
}
Пример #3
0
void TailView::searchFile(bool isForward)
{
    const SearchCriteria & sc = SearchInfo::instance().search();
    m_documentSearch->setSearchCriteria(sc.expression, sc.isRegex, sc.isCaseSensitive);
    bool matchFound = searchDocument(isForward);
    if(matchFound) {
        scrollToIfNecessary(documentSearch()->cursor());
    } else {
        matchFound = m_layoutStrategy->searchFile(isForward);
    }

    if(!matchFound) {
        QString message;
        QTextStream(&message)
            << QObject::tr("Pattern \"")
            << documentSearch()->lastSearchString()
            << QObject::tr("\" not found");
        QMessageBox::information(this, YApplication::displayAppName(), message);
        m_document->clearSelection();
    }

    viewport()->update();
}