From 6fbb1ba33ada1916e574d7be3ce562007f39ea0c Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Mon, 5 Aug 2024 19:39:01 +0800 Subject: [PATCH] fix!: correct app id used by DConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 纠正应用组件 ID 名称。 Log: Influnce: 不再兼容之前的 dde-launchpad 配置文件 --- .reuse/dep5 | 2 +- CMakeLists.txt | 2 +- desktopintegration.cpp | 7 +- ...rg.deepin.dde.shell.launchpad.appdata.xml} | 2 +- docs/DConfig.md | 4 +- src/models/CMakeLists.txt | 11 ++- src/models/appsmodel.cpp | 2 +- src/models/categorizedsortproxymodel.cpp | 4 +- src/models/frequentlyusedproxymodel.cpp | 2 +- .../org.deepin.dde.shell.launchpad.json | 80 +++++++++++++++++++ 10 files changed, 101 insertions(+), 15 deletions(-) rename dist/{org.deepin.dde.launchpad.appdata.xml => org.deepin.dde.shell.launchpad.appdata.xml} (92%) create mode 100644 src/models/org.deepin.dde.shell.launchpad.json diff --git a/.reuse/dep5 b/.reuse/dep5 index 5cc35bd2..8858ea94 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -29,7 +29,7 @@ Copyright: None License: CC0-1.0 # dconfig base template files -Files: */org.deepin.dde.launchpad.*.json +Files: */org.deepin.dde.*.json Copyright: None License: CC0-1.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 322fb20b..490281ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,7 @@ target_link_libraries(${BIN_NAME} PRIVATE install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${TRANSLATED_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${BIN_NAME}/translations) install( - FILES dist/org.deepin.dde.launchpad.appdata.xml + FILES dist/org.deepin.dde.shell.launchpad.appdata.xml DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" ) diff --git a/desktopintegration.cpp b/desktopintegration.cpp index 0bd6d3a8..dcd62696 100644 --- a/desktopintegration.cpp +++ b/desktopintegration.cpp @@ -200,12 +200,11 @@ DesktopIntegration::DesktopIntegration(QObject *parent) , m_dockIntegration(new DdeDock(this)) , m_appearanceIntegration(new Appearance(this)) { - QScopedPointer dconfig(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel")); + QScopedPointer dconfig(DConfig::create("org.deepin.dde.shell.launchpad", "org.deepin.dde.shell.launchpad")); Q_ASSERT_X(dconfig->isValid(), "DConfig", "DConfig file is missing or invalid"); // TODO: - // 1. ensure dde-launchpad is build with AppStream support - // 2. ensure dde-control-center, deepin-calendar, dde-file-manager ship their AppStream MetaInfo file - // 3. remove the hard-coded list below + // 1. ensure dde-control-center, deepin-calendar, dde-file-manager ship their AppStream MetaInfo file + // 2. remove the hard-coded list below static const QStringList defaultCompulsoryAppIdList{ "org.deepin.dde.control-center.desktop", "dde-computer.desktop", diff --git a/dist/org.deepin.dde.launchpad.appdata.xml b/dist/org.deepin.dde.shell.launchpad.appdata.xml similarity index 92% rename from dist/org.deepin.dde.launchpad.appdata.xml rename to dist/org.deepin.dde.shell.launchpad.appdata.xml index 9a96135e..7a4341ae 100644 --- a/dist/org.deepin.dde.launchpad.appdata.xml +++ b/dist/org.deepin.dde.shell.launchpad.appdata.xml @@ -1,6 +1,6 @@ - org.deepin.dde.launchpad + org.deepin.dde.shell.launchpad CC0-1.0 GPL-3.0+ DDE Launchpad diff --git a/docs/DConfig.md b/docs/DConfig.md index f5bbf097..c1792a5d 100644 --- a/docs/DConfig.md +++ b/docs/DConfig.md @@ -20,7 +20,7 @@ Some heads-up: - `dde-dconfig-editor` is a GUI util to tweak those values. - `readonly` fields will be read-only in the editor, but it's override-able! - `dde-dconfig` cli util can be used to test out the config values when needed: - - Example usage: `dde-dconfig get -a dde-launchpad -r org.deepin.dde.launchpad.appsmodel -k excludeAppIdList` + - Example usage: `dde-dconfig get -a dde-launchpad -r org.deepin.dde.shell.launchpad -k excludeAppIdList` - If you just changed the on-disk base configuration template file or override file, dde-dconfig service might still holding a outdated cache! - To avoid that, simply restart the service: `systemctl restart dde-dconfig-daemon.service`. - `dde-config`'s `reset` option won't clear the default value cache that offered by base configuration template file and override file. i.e. things like `dde-dconfig reset -a dde-launchpad -r org.deepin.dde.launchpad.appsmodel -k excludeAppIdList` won't work as intended. @@ -37,7 +37,7 @@ The base configuration template is **usually** located at `/usr/share/dsg/config ## Configurations -### org.deepin.dde.launchpad.appsmodel +### org.deepin.dde.shell.launchpad #### `excludeAppIdList` (readonly) diff --git a/src/models/CMakeLists.txt b/src/models/CMakeLists.txt index bc839f9e..e9121afa 100644 --- a/src/models/CMakeLists.txt +++ b/src/models/CMakeLists.txt @@ -56,7 +56,14 @@ target_link_libraries(launcher-models PRIVATE launcher-utils ) +# legacy one, provided for migration purpose (begin) dtk_add_config_meta_files( - APPID ${PROJECT_NAME} - FILES org.deepin.dde.launchpad.appsmodel.json + APPID ${PROJECT_NAME} + FILES org.deepin.dde.launchpad.appsmodel.json +) +# (end) + +dtk_add_config_meta_files( + APPID org.deepin.dde.shell + FILES org.deepin.dde.shell.launchpad.json ) diff --git a/src/models/appsmodel.cpp b/src/models/appsmodel.cpp index 815d377f..128269b2 100644 --- a/src/models/appsmodel.cpp +++ b/src/models/appsmodel.cpp @@ -38,7 +38,7 @@ static void updateAppItemFromAM(AppItem *appItem) AppsModel::AppsModel(QObject *parent) : QStandardItemModel(parent) - , m_dconfig(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel")) + , m_dconfig(DConfig::create("org.deepin.dde.shell", "org.deepin.dde.shell.launchpad")) , m_tmUpdateCache(new QTimer(this)) { Q_ASSERT_X(m_dconfig->isValid(), "DConfig", "DConfig file is missing or invalid"); diff --git a/src/models/categorizedsortproxymodel.cpp b/src/models/categorizedsortproxymodel.cpp index c6fa03c8..6d19ed67 100644 --- a/src/models/categorizedsortproxymodel.cpp +++ b/src/models/categorizedsortproxymodel.cpp @@ -29,7 +29,7 @@ void CategorizedSortProxyModel::setCategoryType(CategoryType categoryType) } if (oldCategoryType != categoryType) { - QScopedPointer config(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel")); + QScopedPointer config(DConfig::create("org.deepin.dde.shell", "org.deepin.dde.shell.launchpad")); config->setValue("categoryType", categoryType); emit categoryTypeChanged(); } @@ -131,7 +131,7 @@ CategorizedSortProxyModel::CategorizedSortProxyModel(QObject *parent) { setSortCaseSensitivity(Qt::CaseInsensitive); setSourceModel(&AppsModel::instance()); - QScopedPointer config(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel")); + QScopedPointer config(DConfig::create("org.deepin.dde.shell", "org.deepin.dde.shell.launchpad")); CategoryType categoryType = CategoryType(config->value("categoryType", FreeCategory).toInt()); isFreeSort = (categoryType == FreeCategory); setCategoryType(categoryType); diff --git a/src/models/frequentlyusedproxymodel.cpp b/src/models/frequentlyusedproxymodel.cpp index 7ed1bdee..4ffe275b 100644 --- a/src/models/frequentlyusedproxymodel.cpp +++ b/src/models/frequentlyusedproxymodel.cpp @@ -12,7 +12,7 @@ DCORE_USE_NAMESPACE FrequentlyUsedProxyModel::FrequentlyUsedProxyModel(QObject *parent) : QSortFilterProxyModel(parent) { - QScopedPointer dconfig(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel")); + QScopedPointer dconfig(DConfig::create("org.deepin.dde.shell", "org.deepin.dde.shell.launchpad")); // lower priority is higher. m_frequentlyUsedAppIdList = dconfig->value("frequentlyUsedAppIdList").toStringList(); qDebug() << "Fetched frequentlyUsed app list by DConfig" << m_frequentlyUsedAppIdList; diff --git a/src/models/org.deepin.dde.shell.launchpad.json b/src/models/org.deepin.dde.shell.launchpad.json new file mode 100644 index 00000000..0560b2b2 --- /dev/null +++ b/src/models/org.deepin.dde.shell.launchpad.json @@ -0,0 +1,80 @@ +{ + "magic": "dsg.config.meta", + "version": "1.0", + "contents": { + "excludeAppIdList": { + "value": [], + "serial": 0, + "flags": [], + "name": "Exclude Application ID List", + "name[zh_CN]": "应用排除 ID 列表", + "description": "List of application's desktop IDs that should be exclude/hidden from the launchpad.", + "description[zh_CN]": "需要使 launchpad 排除(避免显示)的应用程序的 desktop ID 列表。", + "permissions": "readonly", + "visibility": "private" + }, + "compulsoryAppIdList": { + "value": [ + "dde-computer.desktop", + "dde-trash.desktop", + "dde-file-manager.desktop", + "deepin-terminal.desktop", + "deepin-manual.desktop", + "deepin-system-monitor.desktop", + "deepin-devicemanager.desktop", + "dde-printer.desktop", + "dde-calendar.desktop", + "org.fcitx.fcitx5-migrator.desktop", + "fcitx5-configtool.desktop", + "org.fcitx.Fcitx5.desktop" + ], + "serial": 0, + "flags": [], + "name": "Compulsory Application ID List", + "name[zh_CN]": "核心必要应用 ID 列表", + "description": "The desktop ID list for applications considered as compulsory.", + "description[zh_CN]": "需要被视为核心必要应用的应用 ID 列表。", + "permissions": "readonly", + "visibility": "private" + }, + "frequentlyUsedAppIdList": { + "value": [ + "org.deepin.browser.desktop", + "deepin-app-store.desktop", + "dde-file-manager.desktop", + "deepin-mail.desktop", + "deepin-home.desktop", + "deepin-screen-recorder.desktop", + "deepin-calculator.desktop", + "deepin-terminal.desktop", + "dde-calendar.desktop", + "deepin-image-viewer.desktop", + "deepin-movie.desktop", + "deepin-album.desktop", + "deepin-system-monitor.desktop", + "libreoffice-base.desktop", + "libreoffice-writer.desktop", + "libreoffice-calc.desktop" + ], + "serial": 0, + "flags": [], + "name": "Frequently Used Application ID List", + "name[zh_CN]": "常用应用 ID 列表", + "description": "The default desktop ID list for \"my frequently used\" applications.", + "description[zh_CN]": "我的常用中默认显示的应用程序的 desktop ID 列表。", + "permissions": "readonly", + "visibility": "private" + }, + "categoryType": { + "value": 2, + "serial": 0, + "flags": [], + "name": "Application Sort Type", + "name[zh_CN]": "应用排序类别", + "description": "The type of sorting Application list under windows mode. 0: Alphabetary, 1: DDE Category, 2: Freeform Sort", + "description[zh_CN]": "在窗口模式下排序应用列表的类别。0: 首字母分组排序,1: DDE 风格分类,2: 自由排序", + "permissions": "readwrite", + "visibility": "private" + } + } +}