Esempio n. 1
0
void LocationCompleter::complete(const QString &string)
{
    QString trimmedStr = string.trimmed();

    // Indicates that new completion was requested by user
    // Eg. popup was not closed yet this completion session
    m_popupClosed = false;

    emit cancelRefreshJob();

    LocationCompleterRefreshJob* job = new LocationCompleterRefreshJob(trimmedStr);
    connect(job, SIGNAL(finished()), this, SLOT(refreshJobFinished()));
    connect(this, SIGNAL(cancelRefreshJob()), job, SLOT(jobCancelled()));

    if (qzSettings->searchFromAddressBar && qzSettings->showABSearchSuggestions && trimmedStr.length() >= 2) {
        if (!m_openSearchEngine) {
            m_openSearchEngine = new OpenSearchEngine(this);
            m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());
            connect(m_openSearchEngine, &OpenSearchEngine::suggestions, this, &LocationCompleter::addSuggestions);
        }
        m_openSearchEngine->setSuggestionsUrl(LocationBar::searchEngine().suggestionsUrl);
        m_openSearchEngine->setSuggestionsParameters(LocationBar::searchEngine().suggestionsParameters);
        m_suggestionsTerm = trimmedStr;
        m_openSearchEngine->requestSuggestions(m_suggestionsTerm);
    } else {
        m_oldSuggestions.clear();
    }
}
Esempio n. 2
0
void LocationCompleter::complete(const QString &string)
{
    QString trimmedStr = string.trimmed();

    // Indicates that new completion was requested by user
    // Eg. popup was not closed yet this completion session
    m_popupClosed = false;

    LocationCompleterRefreshJob* job = new LocationCompleterRefreshJob(trimmedStr);
    connect(job, SIGNAL(finished()), this, SLOT(refreshJobFinished()));
}