X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/2e6450da1cc62c0c8ad6f868becf0fa4a1f32022..bff373d598c031cb1:/src/search/dolphinsearchbox.cpp diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index 60678eb45..9c41db9c5 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -21,34 +21,29 @@ #include "dolphin_searchsettings.h" #include "dolphinfacetswidget.h" +#include "panels/places/placesitemmodel.h" -#include - -#include -#include #include -#include #include +#include +#include +#ifdef HAVE_BALOO +#include +#include +#endif #include #include -#include +#include #include -#include +#include #include +#include #include #include #include -#include #include -#include -#ifdef HAVE_BALOO - #include - #include -#endif -#include - DolphinSearchBox::DolphinSearchBox(QWidget* parent) : QWidget(parent), m_startedSearching(false), @@ -236,10 +231,14 @@ bool DolphinSearchBox::eventFilter(QObject* obj, QEvent* event) // #379135: we get the FocusIn event when we close a tab but we don't want to emit // the activated() signal before the removeTab() call in DolphinTabWidget::closeTab() returns. // To avoid this issue, we delay the activation of the search box. - QTimer::singleShot(0, this, [this] { - setActive(true); - setFocus(); - }); + // We also don't want to schedule the activation process if we are already active, + // otherwise we can enter in a loop of FocusIn/FocusOut events with the searchbox of another tab. + if (!isActive()) { + QTimer::singleShot(0, this, [this] { + setActive(true); + setFocus(); + }); + } break; default: @@ -310,11 +309,9 @@ void DolphinSearchBox::slotSearchSaved() if (searchURL.isValid()) { PlacesItemModel model; const QString label = i18n("Search for %1 in %2", text(), searchPath().fileName()); - PlacesItem* item = model.createPlacesItem(label, - searchURL, - QStringLiteral("folder-saved-search-symbolic")); - model.appendItemToGroup(item); - model.saveBookmarks(); + model.createPlacesItem(label, + searchURL, + QStringLiteral("folder-saved-search-symbolic")); } } @@ -385,7 +382,7 @@ void DolphinSearchBox::init() // Apply layout for the search input QHBoxLayout* searchInputLayout = new QHBoxLayout(); - searchInputLayout->setMargin(0); + searchInputLayout->setContentsMargins(0, 0, 0, 0); searchInputLayout->addWidget(closeButton); searchInputLayout->addWidget(m_searchLabel); searchInputLayout->addWidget(m_searchInput); @@ -445,7 +442,7 @@ void DolphinSearchBox::init() // Apply layout for the options QHBoxLayout* optionsLayout = new QHBoxLayout(); - optionsLayout->setMargin(0); + optionsLayout->setContentsMargins(0, 0, 0, 0); optionsLayout->addWidget(m_fileNameButton); optionsLayout->addWidget(m_contentButton); optionsLayout->addWidget(m_separator); @@ -471,7 +468,7 @@ void DolphinSearchBox::init() m_optionsScrollArea->setWidgetResizable(true); m_topLayout = new QVBoxLayout(this); - m_topLayout->setMargin(0); + m_topLayout->setContentsMargins(0, 0, 0, 0); m_topLayout->addLayout(searchInputLayout); m_topLayout->addWidget(m_optionsScrollArea); m_topLayout->addWidget(m_facetsWidget);