File indexing completed on 2024-05-05 17:53:45
0001 /* 0002 * SPDX-FileCopyrightText: 2009-2010 Peter Penz <peter.penz19@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef CONTEXTMENUSETTINGSPAGE_H 0007 #define CONTEXTMENUSETTINGSPAGE_H 0008 0009 #include "settings/settingspagebase.h" 0010 0011 #include <KActionCollection> 0012 0013 #include <QString> 0014 0015 class QListView; 0016 class QSortFilterProxyModel; 0017 class ServiceModel; 0018 class QLineEdit; 0019 0020 /** 0021 * @brief Configurations for services in the context menu. 0022 */ 0023 class ContextMenuSettingsPage : public SettingsPageBase 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 explicit ContextMenuSettingsPage(QWidget *parent, const KActionCollection *actions, const QStringList &actionIds); 0029 ~ContextMenuSettingsPage() override; 0030 0031 /** @see SettingsPageBase::applySettings() */ 0032 void applySettings() override; 0033 0034 /** @see SettingsPageBase::restoreDefaults() */ 0035 void restoreDefaults() override; 0036 0037 protected: 0038 void showEvent(QShowEvent *event) override; 0039 0040 private Q_SLOTS: 0041 /** 0042 * Loads locally installed services. 0043 */ 0044 void loadServices(); 0045 0046 private: 0047 /** 0048 * Loads installed version control systems. 0049 */ 0050 void loadVersionControlSystems(); 0051 0052 bool isInServicesList(const QString &service) const; 0053 0054 /** 0055 * Adds a row to the model of m_listView. 0056 */ 0057 void addRow(const QString &icon, const QString &text, const QString &value, bool checked); 0058 bool entryVisible(const QString &id); 0059 void setEntryVisible(const QString &id, bool visible); 0060 0061 private: 0062 bool m_initialized; 0063 ServiceModel *m_serviceModel; 0064 QSortFilterProxyModel *m_sortModel; 0065 QListView *m_listView; 0066 QLineEdit *m_searchLineEdit; 0067 QStringList m_enabledVcsPlugins; 0068 const KActionCollection *m_actions; 0069 const QStringList m_actionIds; 0070 }; 0071 0072 #endif