┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/contextmenu/contextmenusettingspage.h
blob: a8fae08f67e09abe0fb7fdbd117d0a3ce1acb1dc (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
/*
 * SPDX-FileCopyrightText: 2009-2010 Peter Penz <[email protected]>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */
#ifndef CONTEXTMENUSETTINGSPAGE_H
#define CONTEXTMENUSETTINGSPAGE_H

#include "settings/settingspagebase.h"

#include <KActionCollection>

#include <QString>

class QListView;
class QSortFilterProxyModel;
class ServiceModel;
class QLineEdit;

/**
 * @brief Configurations for services in the context menu.
 */
class ContextMenuSettingsPage : public SettingsPageBase
{
    Q_OBJECT

public:
    explicit ContextMenuSettingsPage(QWidget* parent,
                                     const KActionCollection* actions,
                                     const QStringList& actionIds);
    ~ContextMenuSettingsPage() override;

    /** @see SettingsPageBase::applySettings() */
    void applySettings() override;

    /** @see SettingsPageBase::restoreDefaults() */
    void restoreDefaults() override;

protected:
    void showEvent(QShowEvent* event) override;

private Q_SLOTS:
    /**
     * Loads locally installed services.
     */
    void loadServices();

private:
    /**
     * Loads installed version control systems.
     */
    void loadVersionControlSystems();

    bool isInServicesList(const QString &service) const;

    /**
     * Adds a row to the model of m_listView.
     */
    void addRow(const QString &icon,
                const QString &text,
                const QString &value,
                bool checked);
    bool entryVisible(const QString& id);
    void setEntryVisible(const QString& id, bool visible);

private:
    bool m_initialized;
    ServiceModel *m_serviceModel;
    QSortFilterProxyModel *m_sortModel;
    QListView* m_listView;
    QLineEdit *m_searchLineEdit;
    QStringList m_enabledVcsPlugins;
    const KActionCollection* m_actions;
    const QStringList m_actionIds;
};

#endif