blob: 5ebcc51a33687be1919fa027f94392c7af2ffa0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/*
This file is part of the KDE project
SPDX-FileCopyrightText: 2024 Felix Ernst <[email protected]>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#ifndef POPUP_H
#define POPUP_H
#include "dolphinquery.h"
#include "updatablestateinterface.h"
#include "widgetmenu.h"
#include <KMessageWidget>
#include <QUrl>
class KContextualHelpButton;
class QRadioButton;
class QToolButton;
namespace Search
{
class DateSelector;
class FileTypeSelector;
class MinimumRatingSelector;
class TagsSelector;
/** @returns the localized name for the Filenamesearch search tool for use in user interfaces. */
QString filenamesearchUiName();
/** @returns the localized name for the Baloo search tool for use in user interfaces. */
QString balooUiName();
/**
* This object contains most of the UI to set the search configuration.
*/
class Popup : public WidgetMenu, public UpdatableStateInterface
{
Q_OBJECT
public:
explicit Popup(std::shared_ptr<const DolphinQuery> dolphinQuery, QWidget *parent = nullptr);
Q_SIGNALS:
/** Is emitted whenever settings have changed and a new search might be necessary. */
void configurationChanged(const Search::DolphinQuery &dolphinQuery);
/**
* Requests for @p message with the given @p messageType to be shown to the user in a non-modal way.
*/
void showMessage(const QString &message, KMessageWidget::MessageType messageType);
/**
* Requests for a progress update to be shown to the user in a non-modal way.
* @param currentlyRunningTaskTitle The task that is currently progressing.
* @param installationProgressPercent The current percentage of completion.
*/
void showInstallationProgress(const QString ¤tlyRunningTaskTitle, int installationProgressPercent);
private:
QWidget *init() override;
void updateState(const std::shared_ptr<const DolphinQuery> &dolphinQuery) override;
private Q_SLOTS:
/**
* Opens KFind if KFind is installed.
* If KFind is not installed, this method asynchronously starts a Filelight installation using DolphinPackageInstaller. @see DolphinPackageInstaller.
* Installation success or failure is reported through showMessage(). @see Popup::showMessage().
* Installation progress is reported through showInstallationProgress(). @see Popup::showInstallationProgress().
*/
void slotKFindButtonClicked();
private:
QRadioButton *m_searchInFileNamesRadioButton = nullptr;
QRadioButton *m_searchInFileContentsRadioButton = nullptr;
QRadioButton *m_filenamesearchRadioButton = nullptr;
KContextualHelpButton *m_filenamesearchContextualHelpButton = nullptr;
QRadioButton *m_balooRadioButton = nullptr;
KContextualHelpButton *m_balooContextualHelpButton = nullptr;
/** A container widget for easy showing/hiding of all selectors. */
QWidget *m_selectorsLayoutWidget = nullptr;
/** Allows to set the file type each search result is expected to have. */
FileTypeSelector *m_typeSelector = nullptr;
/** Allows to set a date since when each search result needs to have been modified. */
DateSelector *m_dateSelector = nullptr;
/** Allows selecting the minimum rating search results are expected to have. */
MinimumRatingSelector *m_ratingSelector = nullptr;
/** Allows to set tags which each search result is required to have. */
TagsSelector *m_tagsSelector = nullptr;
/** A button that allows installing or opening KFind. */
QToolButton *m_kFindButton = nullptr;
};
}
#endif // POPUP_H
|