1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 02:52:12 +01:00

LocationCompleter: Fix popup opening with suggestions after it was closed

This commit is contained in:
David Rosca 2018-01-26 12:46:18 +01:00
parent b9294e02bb
commit 5ee0623d32
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -68,7 +68,6 @@ bool LocationCompleter::isVisible() const
void LocationCompleter::closePopup() void LocationCompleter::closePopup()
{ {
m_popupClosed = true;
s_view->close(); s_view->close();
} }
@ -140,6 +139,7 @@ void LocationCompleter::refreshJobFinished()
void LocationCompleter::slotPopupClosed() void LocationCompleter::slotPopupClosed()
{ {
m_popupClosed = true;
m_oldSuggestions.clear(); m_oldSuggestions.clear();
disconnect(s_view, SIGNAL(closed()), this, SLOT(slotPopupClosed())); disconnect(s_view, SIGNAL(closed()), this, SLOT(slotPopupClosed()));
@ -179,7 +179,9 @@ void LocationCompleter::addSuggestions(const QStringList &suggestions)
s_model->addCompletions(items); s_model->addCompletions(items);
m_oldSuggestions = suggestions; m_oldSuggestions = suggestions;
showPopup(); if (!m_popupClosed) {
showPopup();
}
} }
void LocationCompleter::currentChanged(const QModelIndex &index) void LocationCompleter::currentChanged(const QModelIndex &index)
@ -275,13 +277,7 @@ void LocationCompleter::indexDeleteRequested(const QModelIndex &index)
s_model->removeRow(index.row(), index.parent()); s_model->removeRow(index.row(), index.parent());
s_view->setUpdatesEnabled(true); s_view->setUpdatesEnabled(true);
// Close popup when removing last item showPopup();
if (s_model->rowCount() == 0) {
closePopup();
}
else {
showPopup();
}
} }
LoadRequest LocationCompleter::createLoadRequest(const QModelIndex &index) LoadRequest LocationCompleter::createLoadRequest(const QModelIndex &index)