- // Create "Filter" button
- m_filterButton = new QToolButton(this);
- m_filterButton->setIcon(KIcon("view-filter"));
- m_filterButton->setAutoRaise(true);
- m_filterButton->setCheckable(true);
- m_filterButton->hide();
- connect(m_filterButton, SIGNAL(toggled(bool)), this, SLOT(setFilterWidgetsVisible(bool)));
+ m_separator = new KSeparator(Qt::Vertical, this);
+
+ // Create "From Here" and "Your files" buttons
+ m_fromHereButton = new QToolButton(this);
+ m_fromHereButton->setText(i18nc("action:button", "From Here"));
+ initButton(m_fromHereButton);
+
+ m_everywhereButton = new QToolButton(this);
+ m_everywhereButton->setText(i18nc("action:button", "Your files"));
+ m_everywhereButton->setToolTip(i18nc("action:button", "Search in your home directory"));
+ m_everywhereButton->setIcon(QIcon::fromTheme(QStringLiteral("user-home")));
+ m_everywhereButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ initButton(m_everywhereButton);
+
+ QButtonGroup* searchLocationGroup = new QButtonGroup(this);
+ searchLocationGroup->addButton(m_fromHereButton);
+ searchLocationGroup->addButton(m_everywhereButton);
+
+ auto moreSearchToolsButton = new QToolButton(this);
+ moreSearchToolsButton->setAutoRaise(true);
+ moreSearchToolsButton->setPopupMode(QToolButton::InstantPopup);
+ moreSearchToolsButton->setIcon(QIcon::fromTheme("arrow-down-double"));
+ moreSearchToolsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ moreSearchToolsButton->setText(i18n("More Search Tools"));
+ moreSearchToolsButton->setMenu(new QMenu(this));
+ connect(moreSearchToolsButton->menu(), &QMenu::aboutToShow, moreSearchToolsButton->menu(), [this, moreSearchToolsButton]()
+ {
+ m_menuFactory.reset(new KMoreToolsMenuFactory("dolphin/search-tools"));
+ moreSearchToolsButton->menu()->clear();
+ m_menuFactory->fillMenuFromGroupingNames(moreSearchToolsButton->menu(), { "files-find" }, this->m_searchPath);
+ } );
+
+ // Create "Facets" widget
+ m_facetsWidget = new DolphinFacetsWidget(this);
+ m_facetsWidget->installEventFilter(this);
+ m_facetsWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
+ m_facetsWidget->layout()->setSpacing(Dolphin::LAYOUT_SPACING_SMALL);
+ connect(m_facetsWidget, &DolphinFacetsWidget::facetChanged, this, &DolphinSearchBox::slotFacetChanged);
+
+ // Put the options into a QScrollArea. This prevents increasing the view width
+ // in case that not enough width for the options is available.
+ QWidget* optionsContainer = new QWidget(this);