Commit a512176b authored by Chau Duong's avatar Chau Duong Committed by Elvis Angelaccio
Browse files

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
parent b339ac1b
......@@ -134,6 +134,7 @@ kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS GENERATE_MOC
settings/dolphin_detailsmodesettings.kcfgc
settings/dolphin_iconsmodesettings.kcfgc
settings/dolphin_generalsettings.kcfgc
settings/dolphin_contextmenusettings.kcfgc
settings/dolphin_versioncontrolsettings.kcfgc
)
......@@ -238,7 +239,7 @@ set(dolphinstatic_SRCS
settings/general/statusbarsettingspage.cpp
settings/dolphinsettingsdialog.cpp
settings/navigation/navigationsettingspage.cpp
settings/services/servicessettingspage.cpp
settings/contextmenu/contextmenusettingspage.cpp
settings/settingspagebase.cpp
settings/serviceitemdelegate.cpp
settings/servicemodel.cpp
......@@ -285,6 +286,7 @@ kconfig_add_kcfg_files(dolphinstatic_SRCS GENERATE_MOC
settings/dolphin_compactmodesettings.kcfgc
settings/dolphin_detailsmodesettings.kcfgc
settings/dolphin_generalsettings.kcfgc
settings/dolphin_contextmenusettings.kcfgc
settings/dolphin_iconsmodesettings.kcfgc
search/dolphin_searchsettings.kcfgc
settings/dolphin_versioncontrolsettings.kcfgc
......@@ -369,9 +371,9 @@ set(kcm_dolphinnavigation_PART_SRCS
settings/navigation/navigationsettingspage.cpp
settings/settingspagebase.cpp)
set(kcm_dolphinservices_PART_SRCS
settings/kcm/kcmdolphinservices.cpp
settings/services/servicessettingspage.cpp
set(kcm_dolphincontextmenu_PART_SRCS
settings/kcm/kcmdolphincontextmenu.cpp
settings/contextmenu/contextmenusettingspage.cpp
settings/settingspagebase.cpp
settings/serviceitemdelegate.cpp
settings/servicemodel.cpp)
......@@ -398,8 +400,9 @@ kconfig_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS
kconfig_add_kcfg_files(kcm_dolphinnavigation_PART_SRCS
settings/dolphin_generalsettings.kcfgc)
kconfig_add_kcfg_files(kcm_dolphinservices_PART_SRCS
kconfig_add_kcfg_files(kcm_dolphincontextmenu_PART_SRCS
settings/dolphin_generalsettings.kcfgc
settings/dolphin_contextmenusettings.kcfgc
settings/dolphin_versioncontrolsettings.kcfgc)
kconfig_add_kcfg_files(kcm_dolphingeneral_PART_SRCS
......@@ -410,29 +413,29 @@ if(NOT WIN32)
# The settings are still accessible from the hamburger menu
add_library(kcm_dolphinviewmodes MODULE ${kcm_dolphinviewmodes_PART_SRCS})
add_library(kcm_dolphinnavigation MODULE ${kcm_dolphinnavigation_PART_SRCS})
add_library(kcm_dolphinservices MODULE ${kcm_dolphinservices_PART_SRCS})
add_library(kcm_dolphincontextmenu MODULE ${kcm_dolphincontextmenu_PART_SRCS})
add_library(kcm_dolphingeneral MODULE ${kcm_dolphingeneral_PART_SRCS})
target_link_libraries(kcm_dolphinviewmodes dolphinprivate)
target_link_libraries(kcm_dolphinnavigation dolphinprivate)
target_link_libraries(kcm_dolphinservices dolphinprivate)
target_link_libraries(kcm_dolphincontextmenu dolphinprivate)
target_link_libraries(kcm_dolphingeneral dolphinprivate)
install( FILES org.kde.dolphin.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
install( FILES settings/kcm/kcmdolphinviewmodes.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install( FILES settings/kcm/kcmdolphinnavigation.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install( FILES settings/kcm/kcmdolphinservices.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install( FILES settings/kcm/kcmdolphincontextmenu.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install( FILES settings/kcm/kcmdolphingeneral.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install(TARGETS kcm_dolphinviewmodes DESTINATION ${KDE_INSTALL_PLUGINDIR} )
install(TARGETS kcm_dolphinnavigation DESTINATION ${KDE_INSTALL_PLUGINDIR} )
install(TARGETS kcm_dolphinservices DESTINATION ${KDE_INSTALL_PLUGINDIR} )
install(TARGETS kcm_dolphincontextmenu DESTINATION ${KDE_INSTALL_PLUGINDIR} )
install(TARGETS kcm_dolphingeneral DESTINATION ${KDE_INSTALL_PLUGINDIR} )
endif()
if(NOT WIN32)
add_subdirectory(settings/services/servicemenuinstaller)
install( FILES settings/services/servicemenu.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR} )
add_subdirectory(settings/contextmenu/servicemenuinstaller)
install( FILES settings/contextmenu/servicemenu.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR} )
endif()
########### install files ###############
......@@ -447,6 +450,7 @@ install(
install( FILES settings/dolphin_directoryviewpropertysettings.kcfg
settings/dolphin_generalsettings.kcfg
settings/dolphin_contextmenusettings.kcfg
settings/dolphin_compactmodesettings.kcfg
settings/dolphin_iconsmodesettings.kcfg
settings/dolphin_detailsmodesettings.kcfg
......
......@@ -7,6 +7,7 @@
#include "dolphincontextmenu.h"
#include "dolphin_generalsettings.h"
#include "dolphin_contextmenusettings.h"
#include "dolphinmainwindow.h"
#include "dolphinnewfilemenu.h"
#include "dolphinplacesmodelsingleton.h"
......@@ -185,32 +186,33 @@ void DolphinContextMenu::openTrashItemContextMenu()
void DolphinContextMenu::addDirectoryItemContextMenu(KFileItemActions &fileItemActions)
{
// insert 'Open in new window' and 'Open in new tab' entries
const KFileItemListProperties& selectedItemsProps = selectedItemsProperties();
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tab")));
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window")));
if (ContextMenuSettings::showOpenInNewTab()) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tab")));
}
if (ContextMenuSettings::showOpenInNewWindow()) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window")));
}
// Insert 'Open With' entries
addOpenWithActions(fileItemActions);
// set up 'Create New' menu
DolphinNewFileMenu* newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection(), m_mainWindow);
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
newFileMenu->setViewShowsHiddenFiles(view->hiddenFilesShown());
newFileMenu->checkUpToDate();
newFileMenu->setPopupFiles(QList<QUrl>() << m_fileInfo.url());
newFileMenu->setEnabled(selectedItemsProps.supportsWriting());
connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
QMenu* menu = newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
menu->setParent(this, Qt::Popup);
addMenu(menu);
addSeparator();
DolphinNewFileMenu* newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection(), m_mainWindow);
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
newFileMenu->setViewShowsHiddenFiles(view->hiddenFilesShown());
newFileMenu->checkUpToDate();
newFileMenu->setPopupFiles(QList<QUrl>() << m_fileInfo.url());
newFileMenu->setEnabled(selectedItemsProps.supportsWriting());
connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
QMenu* menu = newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
addMenu(menu);
addSeparator();
}
void DolphinContextMenu::openItemContextMenu()
......@@ -271,7 +273,7 @@ void DolphinContextMenu::openItemContextMenu()
}
}
if (selectionHasOnlyDirs) {
if (selectionHasOnlyDirs && ContextMenuSettings::showOpenInNewTab()) {
// insert 'Open in new tab' entry
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tabs")));
}
......@@ -284,7 +286,7 @@ void DolphinContextMenu::openItemContextMenu()
addAdditionalActions(fileItemActions, selectedItemsProps);
// insert 'Copy To' and 'Move To' sub menus
if (GeneralSettings::showCopyMoveMenu()) {
if (ContextMenuSettings::showCopyMoveMenu()) {
m_copyToMenu.setUrls(m_selectedItems.urlList());
m_copyToMenu.setReadOnly(!selectedItemsProps.supportsWriting());
m_copyToMenu.setAutoErrorHandlingEnabled(true);
......@@ -334,14 +336,22 @@ void DolphinContextMenu::openViewportContextMenu()
}
// Insert 'Add to Places' entry if it's not already in the places panel
if (!placeExists(m_mainWindow->activeViewContainer()->url())) {
if (ContextMenuSettings::showAddToPlaces() &&
!placeExists(m_mainWindow->activeViewContainer()->url())) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("add_to_places")));
}
addSeparator();
// Insert 'Sort By' and 'View Mode'
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("sort")));
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("view_mode")));
if (ContextMenuSettings::showSortBy()) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("sort")));
}
if (ContextMenuSettings::showViewMode()) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("view_mode")));
}
if (ContextMenuSettings::showSortBy() || ContextMenuSettings::showViewMode()) {
addSeparator();
}
addAdditionalActions(fileItemActions, baseUrlProperties);
addCustomActions();
......@@ -363,25 +373,30 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties&
// Insert 'Cut', 'Copy', 'Copy Location' and 'Paste'
addAction(collection->action(KStandardAction::name(KStandardAction::Cut)));
addAction(collection->action(KStandardAction::name(KStandardAction::Copy)));
QAction* copyPathAction = collection->action(QString("copy_location"));
copyPathAction->setEnabled(m_selectedItems.size() == 1);
addAction(copyPathAction);
if (ContextMenuSettings::showCopyLocation()) {
QAction* copyPathAction = collection->action(QString("copy_location"));
copyPathAction->setEnabled(m_selectedItems.size() == 1);
addAction(copyPathAction);
}
QAction* pasteAction = createPasteAction();
if (pasteAction) {
addAction(pasteAction);
}
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("duplicate")));
// Insert 'Duplicate Here'
if (ContextMenuSettings::showDuplicateHere()) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("duplicate")));
}
// Insert 'Rename'
addAction(collection->action(KStandardAction::name(KStandardAction::RenameFile)));
// insert 'Add to Places' entry if appropriate
if (m_selectedItems.count() == 1) {
if (m_fileInfo.isDir()) {
if (!placeExists(m_fileInfo.url())) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("add_to_places")));
}
}
// Insert 'Add to Places' entry if appropriate
if (ContextMenuSettings::showAddToPlaces() &&
m_selectedItems.count() == 1 &&
m_fileInfo.isDir() &&
!placeExists(m_fileInfo.url())) {
addAction(m_mainWindow->actionCollection()->action(QStringLiteral("add_to_places")));
}
addSeparator();
......
......@@ -4,10 +4,11 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "servicessettingspage.h"
#include "contextmenusettingspage.h"
#include "dolphin_generalsettings.h"
#include "dolphin_versioncontrolsettings.h"
#include "dolphin_contextmenusettings.h"
#include "settings/serviceitemdelegate.h"
#include "settings/servicemodel.h"
......@@ -34,9 +35,16 @@ namespace
const char VersionControlServicePrefix[] = "_version_control_";
const char DeleteService[] = "_delete";
const char CopyToMoveToService[] ="_copy_to_move_to";
const char AddToPlacesService[] = "_add_to_places";
const char SortByService[] = "_sort_by";
const char ViewModeService[] = "_view_mode";
const char OpenInNewTabService[] = "_open_in_new_tab";
const char OpenInNewWindowService[] = "_open_in_new_window";
const char CopyLocationService[] = "_copy_location";
const char DuplicateHereService[] = "_duplicate_here";
}
ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_initialized(false),
m_serviceModel(nullptr),
......@@ -70,7 +78,7 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
m_listView->setModel(m_sortModel);
m_listView->setItemDelegate(delegate);
m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);
connect(m_listView, &QListView::clicked, this, &ServicesSettingsPage::changed);
connect(m_listView, &QListView::clicked, this, &ContextMenuSettingsPage::changed);
#ifndef Q_OS_WIN
auto *downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."),
......@@ -96,9 +104,10 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
std::sort(m_enabledVcsPlugins.begin(), m_enabledVcsPlugins.end());
}
ServicesSettingsPage::~ServicesSettingsPage() = default;
ContextMenuSettingsPage::~ContextMenuSettingsPage() {
}
void ServicesSettingsPage::applySettings()
void ContextMenuSettingsPage::applySettings()
{
if (!m_initialized) {
return;
......@@ -125,8 +134,29 @@ void ServicesSettingsPage::applySettings()
configGroup.writeEntry("ShowDeleteCommand", checked);
configGroup.sync();
} else if (service == QLatin1String(CopyToMoveToService)) {
GeneralSettings::setShowCopyMoveMenu(checked);
GeneralSettings::self()->save();
ContextMenuSettings::setShowCopyMoveMenu(checked);
ContextMenuSettings::self()->save();
} else if (service == QLatin1String(AddToPlacesService)) {
ContextMenuSettings::setShowAddToPlaces(checked);
ContextMenuSettings::self()->save();
} else if (service == QLatin1String(SortByService)) {
ContextMenuSettings::setShowSortBy(checked);
ContextMenuSettings::self()->save();
} else if (service == QLatin1String(ViewModeService)) {
ContextMenuSettings::setShowViewMode(checked);
ContextMenuSettings::self()->save();
} else if (service == QLatin1String(OpenInNewTabService)) {
ContextMenuSettings::setShowOpenInNewTab(checked);
ContextMenuSettings::self()->save();
} else if (service == QLatin1String(OpenInNewWindowService)) {
ContextMenuSettings::setShowOpenInNewWindow(checked);
ContextMenuSettings::self()->save();
} else if (service == QLatin1String(CopyLocationService)) {
ContextMenuSettings::setShowCopyLocation(checked);
ContextMenuSettings::self()->save();
} else if (service == QLatin1String(DuplicateHereService)) {
ContextMenuSettings::setShowDuplicateHere(checked);
ContextMenuSettings::self()->save();
} else {
showGroup.writeEntry(service, checked);
}
......@@ -146,7 +176,7 @@ void ServicesSettingsPage::applySettings()
}
}
void ServicesSettingsPage::restoreDefaults()
void ContextMenuSettingsPage::restoreDefaults()
{
QAbstractItemModel* model = m_listView->model();
for (int i = 0; i < model->rowCount(); ++i) {
......@@ -160,7 +190,7 @@ void ServicesSettingsPage::restoreDefaults()
}
}
void ServicesSettingsPage::showEvent(QShowEvent* event)
void ContextMenuSettingsPage::showEvent(QShowEvent* event)
{
if (!event->spontaneous() && !m_initialized) {
loadServices();
......@@ -179,7 +209,37 @@ void ServicesSettingsPage::showEvent(QShowEvent* event)
addRow(QStringLiteral("edit-copy"),
i18nc("@option:check", "'Copy To' and 'Move To' commands"),
CopyToMoveToService,
GeneralSettings::showCopyMoveMenu());
ContextMenuSettings::showCopyMoveMenu());
// Add other built-in actions
addRow(QStringLiteral("bookmark-new"),
i18nc("@option:check", "Add to Places"),
AddToPlacesService,
ContextMenuSettings::showAddToPlaces());
addRow(QStringLiteral("view-sort"),
i18nc("@option:check", "Sort By"),
SortByService,
ContextMenuSettings::showSortBy());
addRow(QStringLiteral("view-list-icons"),
i18nc("@option:check", "View Mode"),
ViewModeService,
ContextMenuSettings::showViewMode());
addRow(QStringLiteral("folder-new"),
i18nc("@option:check", "'Open in New Tab' and 'Open in New Tabs'"),
OpenInNewTabService,
ContextMenuSettings::showOpenInNewTab());
addRow(QStringLiteral("window-new"),
i18nc("@option:check", "Open in New Window"),
OpenInNewWindowService,
ContextMenuSettings::showOpenInNewWindow());
addRow(QStringLiteral("edit-copy"),
i18nc("@option:check", "Copy Location"),
CopyLocationService,
ContextMenuSettings::showCopyLocation());
addRow(QStringLiteral("edit-copy"),
i18nc("@option:check", "Duplicate Here"),
DuplicateHereService,
ContextMenuSettings::showDuplicateHere());
m_sortModel->sort(Qt::DisplayRole);
......@@ -188,7 +248,7 @@ void ServicesSettingsPage::showEvent(QShowEvent* event)
SettingsPageBase::showEvent(event);
}
void ServicesSettingsPage::loadServices()
void ContextMenuSettingsPage::loadServices()
{
const KConfig config(QStringLiteral("kservicemenurc"), KConfig::NoGlobals);
const KConfigGroup showGroup = config.group("Show");
......@@ -243,7 +303,7 @@ void ServicesSettingsPage::loadServices()
m_searchLineEdit->setFocus(Qt::OtherFocusReason);
}
void ServicesSettingsPage::loadVersionControlSystems()
void ContextMenuSettingsPage::loadVersionControlSystems()
{
const QStringList enabledPlugins = VersionControlSettings::enabledPlugins();
......@@ -260,7 +320,7 @@ void ServicesSettingsPage::loadVersionControlSystems()
m_sortModel->sort(Qt::DisplayRole);
}
bool ServicesSettingsPage::isInServicesList(const QString &service) const
bool ContextMenuSettingsPage::isInServicesList(const QString &service) const
{
for (int i = 0; i < m_serviceModel->rowCount(); ++i) {
const QModelIndex index = m_serviceModel->index(i, 0);
......@@ -271,10 +331,10 @@ bool ServicesSettingsPage::isInServicesList(const QString &service) const
return false;
}
void ServicesSettingsPage::addRow(const QString &icon,
const QString &text,
const QString &value,
bool checked)
void ContextMenuSettingsPage::addRow(const QString &icon,
const QString &text,
const QString &value,
bool checked)
{
m_serviceModel->insertRow(0);
......@@ -284,4 +344,3 @@ void ServicesSettingsPage::addRow(const QString &icon,
m_serviceModel->setData(index, value, ServiceModel::DesktopEntryNameRole);
m_serviceModel->setData(index, checked, Qt::CheckStateRole);
}
......@@ -3,8 +3,8 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef SERVICESSETTINGSPAGE_H
#define SERVICESSETTINGSPAGE_H
#ifndef CONTEXTMENUSETTINGSPAGE_H
#define CONTEXTMENUSETTINGSPAGE_H
#include "settings/settingspagebase.h"
......@@ -16,15 +16,15 @@ class ServiceModel;
class QLineEdit;
/**
* @brief Page for the 'Services' settings of the Dolphin settings dialog.
* @brief Configurations for services in the context menu.
*/
class ServicesSettingsPage : public SettingsPageBase
class ContextMenuSettingsPage : public SettingsPageBase
{
Q_OBJECT
public:
explicit ServicesSettingsPage(QWidget* parent);
~ServicesSettingsPage() override;
explicit ContextMenuSettingsPage(QWidget* parent);
~ContextMenuSettingsPage() override;
/** @see SettingsPageBase::applySettings() */
void applySettings() override;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name="dolphinrc"/>
<group name="ContextMenu">
<entry name="ShowCopyMoveMenu" type="Bool">
<label>Show 'Copy To' and 'Move To' commands in context menu</label>
<default>false</default>
</entry>
<entry name="ShowAddToPlaces" type="Bool">
<label>Show 'Add to Places' in context menu.</label>
<default>true</default>
</entry>
<entry name="ShowSortBy" type="Bool">
<label>Show 'Sort By' in context menu.</label>
<default>true</default>
</entry>
<entry name="ShowViewMode" type="Bool">
<label>Show 'View Mode' in context menu.</label>
<default>true</default>
</entry>
<entry name="ShowOpenInNewTab" type="Bool">
<label>Show 'Open in New Tab' and 'Open in New Tabs' in context menu.</label>
<default>true</default>
</entry>
<entry name="ShowOpenInNewWindow" type="Bool">
<label>Show 'Open in New Window' in context menu.</label>
<default>true</default>
</entry>
<entry name="ShowCopyLocation" type="Bool">
<label>Show 'Copy Location' in context menu.</label>
<default>true</default>
</entry>
<entry name="ShowDuplicateHere" type="Bool">
<label>Show 'Duplicate Here' in context menu.</label>
<default>true</default>
</entry>
</group>
</kcfg>
File=dolphin_contextmenusettings.kcfg
ClassName=ContextMenuSettings
Singleton=yes
Mutators=true
......@@ -90,10 +90,6 @@
<label>Show tooltips</label>
<default>false</default>
</entry>
<entry name="ShowCopyMoveMenu" type="Bool">
<label>Show 'Copy To' and 'Move To' commands in context menu</label>
<default>false</default>
</entry>
<entry name="ViewPropsTimestamp" type="DateTime" >
<label>Timestamp since when the view properties are valid</label>
</entry>
......
......@@ -10,7 +10,7 @@
#include "dolphinmainwindow.h"
#include "general/generalsettingspage.h"
#include "navigation/navigationsettingspage.h"
#include "services/servicessettingspage.h"
#include "contextmenu/contextmenusettingspage.h"
#include "startup/startupsettingspage.h"
#include "trash/trashsettingspage.h"
#include "viewmodes/viewsettingspage.h"
......@@ -77,12 +77,12 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent) :
navigationSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-navigation")));
connect(navigationSettingsPage, &NavigationSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Services
ServicesSettingsPage* servicesSettingsPage = new ServicesSettingsPage(this);
KPageWidgetItem* servicesSettingsFrame = addPage(servicesSettingsPage,
i18nc("@title:group", "Services"));
servicesSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-services")));
connect(servicesSettingsPage, &ServicesSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Context Menu
auto contextMenuSettingsPage = new ContextMenuSettingsPage(this);
KPageWidgetItem* contextMenuSettingsFrame = addPage(contextMenuSettingsPage,
i18nc("@title:group", "Context Menu"));
contextMenuSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("application-menu")));
connect(contextMenuSettingsPage, &ContextMenuSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Trash
SettingsPageBase* trashSettingsPage = nullptr;
......@@ -111,7 +111,7 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent) :
m_pages.append(startupSettingsPage);
m_pages.append(viewSettingsPage);
m_pages.append(navigationSettingsPage);
m_pages.append(servicesSettingsPage);
m_pages.append(contextMenuSettingsPage);
if (trashSettingsPage) {
m_pages.append(trashSettingsPage);
}
......
<
......@@ -4,43 +4,44 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kcmdolphinservices.h"
#include "kcmdolphincontextmenu.h"
#include "settings/services/servicessettingspage.h"
#include "settings/contextmenu/contextmenusettingspage.h"
#include <kconfigwidgets_version.h>
#include <KPluginFactory>
#include <KPluginLoader>
#include <QVBoxLayout>
K_PLUGIN_FACTORY(KCMDolphinServicesConfigFactory, registerPlugin<DolphinServicesConfigModule>(QStringLiteral("dolphinservices"));)
K_PLUGIN_FACTORY(KCMDolphinContextMenuConfigFactory, registerPlugin<DolphinContextMenuConfigModule>(QStringLiteral("dolphincontextmenu"));)
DolphinServicesConfigModule::DolphinServicesConfigModule(QWidget* parent, const QVariantList& args) :
DolphinContextMenuConfigModule::DolphinContextMenuConfigModule(QWidget* parent, const QVariantList& args) :
KCModule(parent, args),
m_services(nullptr)
m_contextMenu(nullptr)
{
setButtons(KCModule::Default | KCModule::Help);
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins(0, 0, 0, 0);
m_services = new ServicesSettingsPage(this);
connect(m_services, &ServicesSettingsPage::changed, this, &DolphinServicesConfigModule::markAsChanged);
topLayout->addWidget(m_services, 0, {});
m_contextMenu = new ContextMenuSettingsPage(this);
connect(m_contextMenu, &ContextMenuSettingsPage::changed, this, &DolphinContextMenuConfigModule::markAsChanged);
topLayout->addWidget(m_contextMenu, 0, {});