1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

[LocationCompleter] Force updates of inline domain completer

Model for inline domain completion is updated asynchronously, so it is
needed to force the update of completer.

This was last regression of completer after switch to threaded searching
in history/bookmarks.
This commit is contained in:
David Rosca 2014-06-26 15:42:38 +02:00
parent 5558d32d82
commit f55dcdf63c
3 changed files with 13 additions and 1 deletions

View File

@ -87,7 +87,7 @@ void LocationCompleter::refreshJobFinished()
LocationCompleterRefreshJob* job = qobject_cast<LocationCompleterRefreshJob*>(sender()); LocationCompleterRefreshJob* job = qobject_cast<LocationCompleterRefreshJob*>(sender());
Q_ASSERT(job); Q_ASSERT(job);
// Don't show result of older jobs // Don't show results of older jobs
// Also don't open the popup again when it was already closed // Also don't open the popup again when it was already closed
if (job->timestamp() > m_lastRefreshTimestamp && !m_popupClosed) { if (job->timestamp() > m_lastRefreshTimestamp && !m_popupClosed) {
s_model->setCompletions(job->completions()); s_model->setCompletions(job->completions());

View File

@ -50,6 +50,7 @@ LocationBar::LocationBar(BrowserWindow* window)
, m_pasteAndGoAction(0) , m_pasteAndGoAction(0)
, m_clearAction(0) , m_clearAction(0)
, m_holdingAlt(false) , m_holdingAlt(false)
, m_backspacePressed(false)
, m_loadProgress(0) , m_loadProgress(0)
, m_progressVisible(false) , m_progressVisible(false)
{ {
@ -161,6 +162,11 @@ void LocationBar::clearCompletion()
void LocationBar::showDomainCompletion(const QString &completion) void LocationBar::showDomainCompletion(const QString &completion)
{ {
m_domainCompleterModel->setStringList(QStringList() << completion); m_domainCompleterModel->setStringList(QStringList() << completion);
// We need to manually force the completion because model is updated asynchronously
// But don't force the completion when backspace was pressed!
if (!m_backspacePressed)
completer()->complete();
} }
LoadRequest LocationBar::createLoadRequest() const LoadRequest LocationBar::createLoadRequest() const
@ -473,6 +479,10 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
m_holdingAlt = true; m_holdingAlt = true;
break; break;
case Qt::Key_Backspace:
m_backspacePressed = true;
break;
case Qt::Key_Return: case Qt::Key_Return:
case Qt::Key_Enter: case Qt::Key_Enter:
switch (event->modifiers()) { switch (event->modifiers()) {
@ -514,6 +524,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
default: default:
m_holdingAlt = false; m_holdingAlt = false;
m_backspacePressed = false;
} }
LineEdit::keyPressEvent(event); LineEdit::keyPressEvent(event);

View File

@ -108,6 +108,7 @@ private:
bool m_rssIconVisible; bool m_rssIconVisible;
bool m_holdingAlt; bool m_holdingAlt;
bool m_backspacePressed;
int m_loadProgress; int m_loadProgress;
bool m_progressVisible; bool m_progressVisible;