From a512176b4bdbf0f0471a9b9089f4a936c14e2732 Mon Sep 17 00:00:00 2001 From: Duong Do Minh Chau Date: Thu, 12 Nov 2020 16:38:44 +0700 Subject: Add options to hide some context menu entries This commit add options to hide the following context menu entries: - Add to Places - Copy Location - Duplicate Here - Open in New Tab and Open in New Tabs - Open in New Window - Sort By - View Mode The Services settings page is renamed to Context Menu ShowCopyMoveMenu option is moved from GeneralSettings to ContextMenuSettings BUG: 314594 --- src/settings/contextmenu/contextmenusettingspage.h | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/settings/contextmenu/contextmenusettingspage.h (limited to 'src/settings/contextmenu/contextmenusettingspage.h') diff --git a/src/settings/contextmenu/contextmenusettingspage.h b/src/settings/contextmenu/contextmenusettingspage.h new file mode 100644 index 000000000..3825e6f86 --- /dev/null +++ b/src/settings/contextmenu/contextmenusettingspage.h @@ -0,0 +1,69 @@ +/* + * SPDX-FileCopyrightText: 2009-2010 Peter Penz + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef CONTEXTMENUSETTINGSPAGE_H +#define CONTEXTMENUSETTINGSPAGE_H + +#include "settings/settingspagebase.h" + +#include + +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); + ~ContextMenuSettingsPage() override; + + /** @see SettingsPageBase::applySettings() */ + void applySettings() override; + + /** @see SettingsPageBase::restoreDefaults() */ + void restoreDefaults() override; + +protected: + void showEvent(QShowEvent* event) override; + +private 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); + +private: + bool m_initialized; + ServiceModel *m_serviceModel; + QSortFilterProxyModel *m_sortModel; + QListView* m_listView; + QLineEdit *m_searchLineEdit; + QStringList m_enabledVcsPlugins; +}; + +#endif -- cgit v1.3