Fix a bug where the global search popup would never be shown on the first search

This commit is contained in:
David Sansome 2011-11-08 22:29:52 +00:00
parent ec5f9be27b
commit c1230f7b0a
3 changed files with 12 additions and 9 deletions

View File

@ -318,7 +318,7 @@ void GlobalSearchWidget::AddResults(int id, const SearchProvider::ResultList& re
void GlobalSearchWidget::RepositionPopup() {
if (front_model_->rowCount() == 0) {
HidePopup();
HidePopup(false);
return;
}
@ -434,7 +434,7 @@ bool GlobalSearchWidget::EventFilterPopup(QObject*, QEvent* e) {
if (e->isAccepted() || !view_->isVisible()) {
// widget lost focus, hide the popup
if (!ui_->search->hasFocus())
HidePopup();
HidePopup(true);
if (e->isAccepted())
return true;
}
@ -458,12 +458,12 @@ bool GlobalSearchWidget::EventFilterPopup(QObject*, QEvent* e) {
case Qt::Key_F4:
if (ke->modifiers() & Qt::AltModifier)
HidePopup();
HidePopup(true);
break;
case Qt::Key_Backtab:
case Qt::Key_Escape:
HidePopup();
HidePopup(true);
break;
default:
@ -475,7 +475,7 @@ bool GlobalSearchWidget::EventFilterPopup(QObject*, QEvent* e) {
case QEvent::MouseButtonPress:
if (!view_->underMouse()) {
HidePopup();
HidePopup(true);
return true;
}
return false;
@ -664,8 +664,11 @@ void GlobalSearchWidget::CombineResults(const QModelIndex& superior, const QMode
current_model_->invisibleRootItem()->removeRow(inferior_item->row());
}
void GlobalSearchWidget::HidePopup() {
closed_since_search_began_ = true;
void GlobalSearchWidget::HidePopup(bool manual) {
if (manual) {
closed_since_search_began_ = true;
}
if (tooltip_)
tooltip_->hide();
view_->hide();

View File

@ -97,7 +97,7 @@ private slots:
void ReplaceAndPlayCurrent();
void SettingsClicked();
void HidePopup();
void HidePopup(bool manual);
void UpdateTooltip();
void UpdateTooltipPosition();

View File

@ -4542,7 +4542,7 @@ msgstr ""
msgid "does not contain"
msgstr ""
#: globalsearch/globalsearchwidget.cpp:726
#: globalsearch/globalsearchwidget.cpp:729
msgid "e.g."
msgstr ""