]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/contextmenu/contextmenusettingspage.h
Share actions with main window to avoid duplicating icon name and text
[dolphin.git] / src / settings / contextmenu / contextmenusettingspage.h
1 /*
2 * SPDX-FileCopyrightText: 2009-2010 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 #ifndef CONTEXTMENUSETTINGSPAGE_H
7 #define CONTEXTMENUSETTINGSPAGE_H
8
9 #include "settings/settingspagebase.h"
10
11 #include <KActionCollection>
12
13 #include <QString>
14
15 class QListView;
16 class QSortFilterProxyModel;
17 class ServiceModel;
18 class QLineEdit;
19
20 /**
21 * @brief Configurations for services in the context menu.
22 */
23 class ContextMenuSettingsPage : public SettingsPageBase
24 {
25 Q_OBJECT
26
27 public:
28 explicit ContextMenuSettingsPage(QWidget* parent, KActionCollection* actions, QStringList actionIds);
29 ~ContextMenuSettingsPage() override;
30
31 /** @see SettingsPageBase::applySettings() */
32 void applySettings() override;
33
34 /** @see SettingsPageBase::restoreDefaults() */
35 void restoreDefaults() override;
36
37 protected:
38 void showEvent(QShowEvent* event) override;
39
40 private slots:
41 /**
42 * Loads locally installed services.
43 */
44 void loadServices();
45
46 private:
47 /**
48 * Loads installed version control systems.
49 */
50 void loadVersionControlSystems();
51
52 bool isInServicesList(const QString &service) const;
53
54 /**
55 * Adds a row to the model of m_listView.
56 */
57 void addRow(const QString &icon,
58 const QString &text,
59 const QString &value,
60 bool checked);
61 bool entryVisible(const QString& id);
62 void setEntryVisible(const QString& id, bool visible);
63
64 private:
65 bool m_initialized;
66 ServiceModel *m_serviceModel;
67 QSortFilterProxyModel *m_sortModel;
68 QListView* m_listView;
69 QLineEdit *m_searchLineEdit;
70 QStringList m_enabledVcsPlugins;
71 KActionCollection* m_actions;
72 QStringList m_actionIds;
73 };
74
75 #endif