From: Jin Liu Date: Mon, 14 Apr 2025 13:21:11 +0000 (+0800) Subject: Add kconf_update to replace view_mode with view_settings in the toolbar X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/ee9ebf2b17724a161ccd4dccab0504f1082010b7?ds=sidebyside Add kconf_update to replace view_mode with view_settings in the toolbar --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4e6e10f0d..7f0ec8296 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -650,6 +650,8 @@ install( FILES settings/dolphin_detailsmodesettings.upd settings/dolphin_directorysizemode.upd settings/dolphin_directorysizemode.py settings/dolphin_statusandlocationbarssettings.upd + settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.upd + settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.py DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR} ) # install KF6 kconfig updater C++ scripts to kconf_update_bin diff --git a/src/settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.py b/src/settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.py new file mode 100644 index 000000000..af70a3f50 --- /dev/null +++ b/src/settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.py @@ -0,0 +1,17 @@ +#SPDX-FileCopyrightText: 2025 Jin Liu +#SPDX-License-Identifier: GPL-2.0-or-later + +import os +from pathlib import Path +import xml.etree.ElementTree as ET + +XDG_DATA_HOME = Path(os.getenv("XDG_DATA_HOME") or (Path.home() / ".local/share")) +custom_ui_file = XDG_DATA_HOME / "kxmlgui5/dolphin/dolphinui.rc" +if custom_ui_file.exists(): + tree = ET.parse(custom_ui_file) + root = tree.getroot() + for toolbar in root.iter("ToolBar"): + for item in toolbar.iter("Action"): + if item.attrib.get("name") == "view_mode": + item.set("name", "view_settings") + tree.write(custom_ui_file, encoding="utf-8") diff --git a/src/settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.upd b/src/settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.upd new file mode 100644 index 000000000..4d754dbb1 --- /dev/null +++ b/src/settings/dolphin_replace_view_mode_with_view_settings_in_toolbar.upd @@ -0,0 +1,8 @@ +#SPDX-FileCopyrightText: 2025 Jin Liu +#SPDX-License-Identifier: GPL-2.0-or-later + +#Configuration update for Dolphin +Version=6 + +Id=replace-view-mode-with-view-settings-in-toolbar +Script=dolphin_replace_view_mode_with_view_settings_in_toolbar.py,python3