示例#1
0
void LocationBar::urlEnter()
{
    const QUrl url = createUrl();
    const QString urlString = convertUrlToText(url);

    m_completer.closePopup();
    m_webView->setFocus();

    if (urlString != text()) {
        setText(convertUrlToText(url));
    }

    emit loadUrl(url);
}
示例#2
0
void LocationBar::showUrl(const QUrl &url)
{
    if (hasFocus() || url.isEmpty()) {
        return;
    }

    const QString stringUrl = convertUrlToText(url);

    if (text() == stringUrl) {
        home(false);
        return;
    }

    // Set converted url as text
    setText(convertUrlToText(url));

    // Move cursor to the start
    home(false);

    m_bookmarkIcon->checkBookmark(url);
}
示例#3
0
void LocationBar::focusInEvent(QFocusEvent* event)
{
    if (m_webView) {
        const QString stringUrl = convertUrlToText(m_webView->url());

        // Text has been edited, let's show go button
        if (stringUrl != text()) {
            setGoIconVisible(true);
        }
    }

    clearTextFormat();
    LineEdit::focusInEvent(event);
}
示例#4
0
void LocationBar::requestLoadUrl()
{
    const LoadRequest req = createLoadRequest();
    const QString urlString = convertUrlToText(req.url());

    m_completer->closePopup();
    m_webView->setFocus();

    if (urlString != text()) {
        setText(urlString);
    }

    m_webView->userLoadAction(req);
}
示例#5
0
void LocationBar::showUrl(const QUrl &url)
{
    if (hasFocus() || url.isEmpty()) {
        return;
    }

    const QString &stringUrl = convertUrlToText(url);

    if (stringUrl == text()) {
        return;
    }

    setText(stringUrl);

    hideGoButton();
    m_bookmarkIcon->checkBookmark(url);
}
示例#6
0
void LocationBar::loadRequest(const LoadRequest &request)
{
    if (!m_webView->webTab()->isRestored()) {
        return;
    }

    const QString urlString = convertUrlToText(request.url());

    m_completer->closePopup();
    m_webView->setFocus();

    if (urlString != text()) {
        setText(urlString);
    }

    m_webView->userLoadAction(request);
}
示例#7
0
void LocationBar::focusInEvent(QFocusEvent* event)
{
    if (m_webView) {
        const QString stringUrl = convertUrlToText(m_webView->url());

        // Text has been edited, let's show go button
        if (stringUrl != text()) {
            setGoIconVisible(true);
        }
    }

    clearTextFormat();
    LineEdit::focusInEvent(event);

    if (Settings().value("Browser-View-Settings/instantBookmarksToolbar").toBool()) {
        m_window->bookmarksToolbar()->show();
    }
}