2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2024 Felix Ernst <felixernst@kde.org>
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
11 #include "dolphinquery.h"
12 #include "updatablestateinterface.h"
13 #include "widgetmenu.h"
15 #include <KMessageWidget>
19 class KContextualHelpButton
;
26 class FileTypeSelector
;
27 class MinimumRatingSelector
;
30 /** @returns the localized name for the Filenamesearch search tool for use in user interfaces. */
31 QString
filenamesearchUiName();
33 /** @returns the localized name for the Baloo search tool for use in user interfaces. */
34 QString
balooUiName();
37 * This object contains most of the UI to set the search configuration.
39 class Popup
: public WidgetMenu
, public UpdatableStateInterface
44 explicit Popup(std::shared_ptr
<const DolphinQuery
> dolphinQuery
, QWidget
*parent
= nullptr);
47 /** Is emitted whenever settings have changed and a new search might be necessary. */
48 void configurationChanged(const Search::DolphinQuery
&dolphinQuery
);
51 * Requests for @p message with the given @p messageType to be shown to the user in a non-modal way.
53 void showMessage(const QString
&message
, KMessageWidget::MessageType messageType
);
56 * Requests for a progress update to be shown to the user in a non-modal way.
57 * @param currentlyRunningTaskTitle The task that is currently progressing.
58 * @param installationProgressPercent The current percentage of completion.
60 void showInstallationProgress(const QString
¤tlyRunningTaskTitle
, int installationProgressPercent
);
63 QWidget
*init() override
;
65 void updateState(const std::shared_ptr
<const DolphinQuery
> &dolphinQuery
) override
;
69 * Opens KFind if KFind is installed.
70 * If KFind is not installed, this method asynchronously starts a Filelight installation using DolphinPackageInstaller. @see DolphinPackageInstaller.
71 * Installation success or failure is reported through showMessage(). @see Popup::showMessage().
72 * Installation progress is reported through showInstallationProgress(). @see Popup::showInstallationProgress().
74 void slotKFindButtonClicked();
77 QRadioButton
*m_searchInFileNamesRadioButton
= nullptr;
78 QRadioButton
*m_searchInFileContentsRadioButton
= nullptr;
79 QRadioButton
*m_filenamesearchRadioButton
= nullptr;
80 KContextualHelpButton
*m_filenamesearchContextualHelpButton
= nullptr;
81 QRadioButton
*m_balooRadioButton
= nullptr;
82 KContextualHelpButton
*m_balooContextualHelpButton
= nullptr;
83 /** A container widget for easy showing/hiding of all selectors. */
84 QWidget
*m_selectorsLayoutWidget
= nullptr;
85 /** Allows to set the file type each search result is expected to have. */
86 FileTypeSelector
*m_typeSelector
= nullptr;
87 /** Allows to set a date since when each search result needs to have been modified. */
88 DateSelector
*m_dateSelector
= nullptr;
89 /** Allows selecting the minimum rating search results are expected to have. */
90 MinimumRatingSelector
*m_ratingSelector
= nullptr;
91 /** Allows to set tags which each search result is required to have. */
92 TagsSelector
*m_tagsSelector
= nullptr;
93 /** A button that allows installing or opening KFind. */
94 QToolButton
*m_kFindButton
= nullptr;