Skip to content

Commit

Permalink
fix!: correct app id used by DConfig
Browse files Browse the repository at this point in the history
纠正应用组件 ID 名称。

Log:
Influnce: 不再兼容之前的 dde-launchpad 配置文件
  • Loading branch information
BLumia committed Aug 6, 2024
1 parent 80bffdb commit af60c62
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Copyright: None
License: CC0-1.0

# dconfig base template files
Files: */org.deepin.dde.launchpad.*.json
Files: */org.deepin.dde.shell.launchpad.json
Copyright: None
License: CC0-1.0

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
7 changes: 3 additions & 4 deletions desktopintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,11 @@ DesktopIntegration::DesktopIntegration(QObject *parent)
, m_dockIntegration(new DdeDock(this))
, m_appearanceIntegration(new Appearance(this))
{
QScopedPointer<DConfig> dconfig(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel"));
QScopedPointer<DConfig> 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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<component>
<id>org.deepin.dde.launchpad</id>
<id>org.deepin.dde.shell.launchpad</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>DDE Launchpad</name>
Expand Down
4 changes: 2 additions & 2 deletions docs/DConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand Down
11 changes: 9 additions & 2 deletions src/models/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion src/models/appsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions src/models/categorizedsortproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void CategorizedSortProxyModel::setCategoryType(CategoryType categoryType)
}

if (oldCategoryType != categoryType) {
QScopedPointer<DConfig> config(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel"));
QScopedPointer<DConfig> config(DConfig::create("org.deepin.dde.shell", "org.deepin.dde.shell.launchpad"));
config->setValue("categoryType", categoryType);
emit categoryTypeChanged();
}
Expand Down Expand Up @@ -131,7 +131,7 @@ CategorizedSortProxyModel::CategorizedSortProxyModel(QObject *parent)
{
setSortCaseSensitivity(Qt::CaseInsensitive);
setSourceModel(&AppsModel::instance());
QScopedPointer<DConfig> config(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel"));
QScopedPointer<DConfig> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/models/frequentlyusedproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DCORE_USE_NAMESPACE
FrequentlyUsedProxyModel::FrequentlyUsedProxyModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
QScopedPointer<DConfig> dconfig(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel"));
QScopedPointer<DConfig> 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;
Expand Down
80 changes: 80 additions & 0 deletions src/models/org.deepin.dde.shell.launchpad.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}

0 comments on commit af60c62

Please sign in to comment.