#include "dolphin_searchsettings.h"
#include "dolphinfacetswidget.h"
+#include "panels/places/placesitemmodel.h"
-#include <panels/places/placesitemmodel.h>
-
-#include <QIcon>
-#include <QLineEdit>
#include <KLocalizedString>
-#include <KSeparator>
#include <KNS3/KMoreToolsMenuFactory>
+#include <KSeparator>
+#include <config-baloo.h>
+#ifdef HAVE_BALOO
+#include <Baloo/Query>
+#include <Baloo/IndexerConfig>
+#endif
#include <QButtonGroup>
#include <QDir>
-#include <QEvent>
+#include <QFontDatabase>
#include <QHBoxLayout>
-#include <QKeyEvent>
+#include <QIcon>
#include <QLabel>
+#include <QLineEdit>
#include <QScrollArea>
#include <QTimer>
#include <QToolButton>
-#include <QVBoxLayout>
#include <QUrlQuery>
-#include <config-baloo.h>
-#ifdef HAVE_BALOO
- #include <Baloo/Query>
- #include <Baloo/IndexerConfig>
-#endif
-#include <QFontDatabase>
-
DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
QWidget(parent),
m_startedSearching(false),
// #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:
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"));
}
}