Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing app list #448

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
deepin-manual (6.0.7) stable; urgency=medium

* chore: Sync by https://github.com/linuxdeepin/.github/commit/2e5e092ba3f86b16d1aabbabcf0bfd2ae65b19c8(Influence: none)
* chore: Sync by https://github.com/linuxdeepin/.github/commit/559e91167d4919644f37bbcf123eb0651c1528ea(Influence: none)
* fix: 修复系统启动后dmanHelper成为常驻进程的问题
* feat: support dtk 5.6.17
Thanks to Hillwood Yang
* fix: missing app list(Issue: https://github.com/linuxdeepin/developer-center/issues/6902)
* feat: add metainfo of dde

-- myml <wurongjie@deepin.org> Tue, 16 Jan 2024 13:55:52 +0800

deepin-manual (6.0.6) stable; urgency=medium

* Update version to 6.0.6. community
Expand Down
69 changes: 12 additions & 57 deletions src/base/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,12 @@ bool Utils::judgeWayLand()
QStringList Utils::getMdsourcePath()
{
QStringList sourcePath;
#ifdef LINGLONG_BUILD
QStringList pathlist = getEnvsourcePath();
for (int i = 0; i < pathlist.size(); ++i) {
if (pathlist[i].contains("persistent") || pathlist[i].contains("usr/share")) {
sourcePath.push_back(pathlist[i] + "/deepin-manual/manual-assets");
qDebug() << " all MD source path : " << sourcePath.last();
}
sourcePath.push_back(pathlist[i] + "/deepin-manual/manual-assets");
}
#else
sourcePath.push_back(DMAN_MANUAL_DIR);
#endif
qDebug() << " all MD source path : " << sourcePath.last();
return sourcePath;
}

Expand Down Expand Up @@ -282,35 +277,12 @@ QString Utils::getDesktopFilePath(const QString &desktopname)
*/
QStringList Utils::getSystemManualList()
{
const QHash<QString, QString> kAppNameMap = {
{"org.deepin.flatdeb.deepin-calendar", "dde-calendar"},
{"org.deepin.flatdeb.deepin-music", "deepin-music"},
{"org.deepin.flatdeb.deepin-screenshot", "deepin-screenshot"},
{"org.deepin.flatdeb.deepin-voice-recorder", "deepin-voice-recorder"},
{"org.deepin.flatdeb.deepin-image-viewer", "deepin-image-viewer"},
{"deepin-cloud-scan-configurator", "deepin-cloud-scan"},
{"org.deepin.flatdeb.deepin-movie", "deepin-movie"},
{"org.deepin.flatdeb.deepin-screen-recorder", "deepin-screen-recorder"},
{"org.deepin.flatdeb.deepin-calculator", "deepin-calculator"},
{"com.deepin.editor", "deepin-editor"},
};

QStringList app_list_;
QStringList strMANUAL_DIR_list = Utils::getMdsourcePath();
//调用dbus服务获取系统安装应用
const AppInfoList list = launcherInterface();
QMultiMap<qlonglong, AppInfo> appMap;
for (int var = 0; var < list.size(); ++var) {
appMap.insert(list.at(var).installed_time, list.at(var));
}
//安装时间相同时,按名称排序
QList<AppInfo> listApp = sortAppList(appMap);
foreach (auto strMANUAL_DIR, strMANUAL_DIR_list) {
const QStringList applicationList = QDir(QString("%1/application/").arg(strMANUAL_DIR)).entryList();
const QStringList systemList = QDir(QString("%1/system/").arg(strMANUAL_DIR)).entryList();
const QStringList applicationList = QDir(QString("%1/application/").arg(strMANUAL_DIR)).entryList(QDir::Dirs|QDir::NoDotAndDotDot);
const QStringList systemList = QDir(QString("%1/system/").arg(strMANUAL_DIR)).entryList(QDir::Dirs|QDir::NoDotAndDotDot);
QString oldMdPath = strMANUAL_DIR;

#if (DTK_VERSION > DTK_VERSION_CHECK(5, 4, 12, 0))
if (Dtk::Core::DSysInfo::UosServer == Dtk::Core::DSysInfo::uosType()) {
oldMdPath += "/server";
} else if (Dtk::Core::DSysInfo::UosHome == Dtk::Core::DSysInfo::uosEditionType()) {
Expand All @@ -322,36 +294,19 @@ QStringList Utils::getSystemManualList()
} else {
oldMdPath += "/professional";
}
#else
Dtk::Core::DSysInfo::DeepinType nType = Dtk::Core::DSysInfo::deepinType();
if (Dtk::Core::DSysInfo::DeepinServer == nType) {
oldMdPath += "/server";
} else if (Dtk::Core::DSysInfo::DeepinPersonal == nType) {
oldMdPath += "/personal";
} else {
if (Dtk::Core::DSysInfo::isCommunityEdition()) {
oldMdPath += "/community";
} else {
oldMdPath += "/professional";
}
}

#endif
const QStringList oldAppList = QDir(oldMdPath).entryList();

//比对存在帮助md文件的应用
for (int i = 0; i < listApp.size(); ++i) {
const QString app_name = kAppNameMap.value(listApp.at(i).key, listApp.at(i).key);
if ((applicationList.contains(app_name) || oldAppList.contains(app_name)) && app_list_.indexOf(app_name) == -1) {
app_list_.append(app_name);
const QStringList oldAppList = QDir(oldMdPath).entryList(QDir::Dirs|QDir::NoDotAndDotDot);
for(auto app:applicationList){
if (app_list_.indexOf(app) == -1) {
app_list_.append(app);
}
}
if (systemList.contains("dde") || oldAppList.contains("dde")) {
app_list_.append("dde");
if (app_list_.indexOf("dde") == -1) {
app_list_.append("dde");
}
}
qDebug() << "exist app list: " << app_list_ << ", count:" << app_list_.size();
}
app_list_.append("DeepinAIAssistant"); //语音助手无法通过launcherInterface获取目前只能手动添加
qDebug() << "exist app list: " << app_list_ << ", count:" << app_list_.size();
return app_list_;
}

Expand Down
2 changes: 2 additions & 0 deletions src/resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ install(FILES deepin-manual.desktop

install(FILES themes/common/images/deepin-manual.svg
DESTINATION share/icons/hicolor/scalable/apps/)

install(FILES org.deepin.manual.metainfo.xml DESTINATION share/metainfo)
29 changes: 29 additions & 0 deletions src/resources/org.deepin.manual.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop-application">
<id>org.deepin.manual</id>
<launchable type="desktop-id">deepin-manual.desktop</launchable>
<project_group>DDE</project_group>
<compulsory_for_desktop>DDE</compulsory_for_desktop>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<content_rating type="oars-1.0"/>
<categories>
<category>DDE</category>
<category>Qt</category>
</categories>
<name>Deepin Manual</name>
<name xml:lang="zh-CN">深度帮助手册</name>
<summary>Manual provides user guides of the system and applications.</summary>
<summary xml:lang="zh-CN">手册旨在帮助用户了解操作系统及其应用程序,提供具体的使用说明和功能说明。</summary>
<icon type="stock">deepin-manual</icon>
<description>
<p>Manual is designed to help users learn the operating system and its applications, providing specific instructions and function descriptions.</p>
<p xml:lang="zh-CN">深度帮助手册覆盖深度操作系统与深度原生应用,主要以系统/应用操作介绍、技巧为主,旨在将帮助大家进一步了解系统和应用。</p>
</description>
<url type="bugtracker">https://github.com/linuxdeepin/developer-center/issues/</url>
<url type="help">https://github.com/linuxdeepin/developer-center/issues/</url>
<url type="homepage">https://bbs.deepin.org/</url>
<releases>
<release version="6.0.7" date="2024-01-16"/>
</releases>
</component>
22 changes: 10 additions & 12 deletions src/view/manual_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,17 @@ QString ManualProxy::appToPath(const QString &appName)
oldMdPath = getAppLocalDir(oldMdPath);
mdList.append(oldMdPath.append("/index.md"));
}
qInfo() << mdList;
//初始化赋值,如果为空字符,web层路径请求依旧能onload成功...
QString ret = "error";
if (QFile(mdList[0]).exists()) {
ret = mdList[0];
} else if (mdList.length() > 1 && QFile(mdList[1]).exists()) {
ret = mdList[1];
} else if (mdList.length() > 2 && QFile(mdList[2]).exists()) {
ret = mdList[2];
} else if (mdList.length() > 3 && QFile(mdList[3]).exists()) {
ret = mdList[3];
} else {
qInfo() << "appToPath" << "find markdown file list" << mdList;
QString ret;
for (auto md : mdList) {
if (QFile(md).exists()) {
ret = md;
}
}
if (ret.isEmpty()) {
qWarning() << Q_FUNC_INFO << " no exist file:" << appName;
// TODO(wurongjie) 在之前的代码中返回了error,暂不知作用
return "error";
}
qInfo() << "========>" << ret;
return ret;
Expand Down
Loading