diff options
| author | Felix Ernst <[email protected]> | 2025-04-07 21:09:00 +0000 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2025-04-07 21:09:00 +0000 |
| commit | 4102ccb80457eea44ea280f0ace2a419602bc34b (patch) | |
| tree | 841e039cf9864276c968a397a2ae75c363199342 /src/search/dolphinfacetswidget.h | |
| parent | bfc177d3d1bc5a4a241e35d59086e4824e7c0bd3 (diff) | |
Rewrite search integration
This huge commit is a nearly complete rewrite of the Dolphin search
code. It implements most of the improved Dolphin search UI/UX as
designed and discussed in a collaborative effort by Kristen McWilliam,
Jin Liu, Andy Betts, Tagwerk, a few others and me.
See https://invent.kde.org/system/dolphin/-/issues/46.
# Notable changes
- A toggle to change the search tool is provided as most contributors
deemed that useful in
https://invent.kde.org/system/dolphin/-/merge_requests/642#note_985112.
- The default search is changed to filenamesearch for maximum
reliability.
- Removing all search parameters will take users back to the view state
prior to starting a search instead of keeping the search results open.
- The UI for choosing file types or modification dates has been made
more powerful with more granularity and more options.
- Most search parameters can be configured from a popup menu which
gives us extra space for extra clarity.
- Labels and help buttons as well as hyperlinks to settings makes sure
the user always knows why some search parameters are unavailable in
some contexts.
- Chips show important search parameters while the popup is closed.
They allow quickly removing filters.
- The titles of the search and the input field placeholder message
change to make clear whether file names or file contents are searched.
- When the user actively switches the search tool, whether content
should be searched, or whether to search everywhere, this is preserved
for the initial state of the search bar when the user opens it the next
time after restarting Dolphin.
# Architecture
- The new DolphinQuery class is independent of the UI and contains all
search parameters modifiable in Dolphin as easy setters and getters.
- DolphinQuery objects are also used to update the states of every
component in the search UI. There is now a clear separation of UI and
search configuration/DolphinQuery.
- DolphinQuery is responsible for exporting to and importing from
search URLs.
- The search UI always reflects the currently configured DolphinQuery
no matter if the user changed the UI to change the DolphinQuery or
loaded a DolphinQuery/older search URL which then is reflected in the
UI.
- I tried to simplify all classes and their interaction between each
other as much as possible.
- I added some tests
BUG: 386754
CCBUG: 435119
CCBUG: 458761
BUG: 446387
BUG: 470136
CCBUG: 471556
CCBUG: 475439
CCBUG: 477969
BUG: 480001
BUG: 483578
BUG: 488047
BUG: 488845
BUG: 500103
FIXED-IN: 25.08
Diffstat (limited to 'src/search/dolphinfacetswidget.h')
| -rw-r--r-- | src/search/dolphinfacetswidget.h | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/search/dolphinfacetswidget.h b/src/search/dolphinfacetswidget.h deleted file mode 100644 index c7358e212..000000000 --- a/src/search/dolphinfacetswidget.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef DOLPHINFACETSWIDGET_H -#define DOLPHINFACETSWIDGET_H - -#include <KCoreDirLister> -#include <QWidget> - -class QComboBox; -class QDate; -class QEvent; -class QToolButton; - -/** - * @brief Allows to filter search-queries by facets. - * - * TODO: The current implementation is a temporary - * workaround for the 4.9 release and represents no - * real facets-implementation yet: There have been - * some Dolphin specific user-interface and interaction - * issues since 4.6 by embedding the Nepomuk facet-widget - * into a QDockWidget (this is unrelated to the - * Nepomuk facet-widget itself). Now in combination - * with the search-shortcuts in the Places Panel some - * existing issues turned into real showstoppers. - * - * So the longterm plan is to use the Nepomuk facets - * again as soon as possible. - */ -class DolphinFacetsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit DolphinFacetsWidget(QWidget *parent = nullptr); - ~DolphinFacetsWidget() override; - - QStringList searchTerms() const; - QString facetType() const; - - bool isSearchTerm(const QString &term) const; - void setSearchTerm(const QString &term); - void resetSearchTerms(); - - void setFacetType(const QString &type); - - QSize minimumSizeHint() const override; - -Q_SIGNALS: - void facetChanged(); - -protected: - void changeEvent(QEvent *event) override; - -private Q_SLOTS: - void updateTagsMenu(); - void updateTagsMenuItems(const QUrl &, const KFileItemList &items); - -private: - void setRating(const int stars); - void setTimespan(const QDate &date); - void addSearchTag(const QString &tag); - void removeSearchTag(const QString &tag); - void resetSearchTags(); - - void initComboBox(QComboBox *combo); - void updateTagsSelector(); - -private: - QComboBox *m_typeSelector; - QComboBox *m_dateSelector; - QComboBox *m_ratingSelector; - QToolButton *m_tagsSelector; - - QStringList m_searchTags; - KCoreDirLister m_tagsLister; - QAction *m_clearTagsAction; -}; - -#endif |
