Skip to content

Commit

Permalink
feat: check am app is really valid
Browse files Browse the repository at this point in the history
log: as title
  • Loading branch information
tsic404 authored and robertkill committed Apr 9, 2024
1 parent 6df2ce7 commit 7605703
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"visibility": "private"
},
"Docked_Items": {
"value": ["id: dde-file-manager,type: amAPP", "id: dde-control-center,type: amAPP"],
"value": ["id: dde-file-manager,type: amAPP", "id: deepin-app-store,type: amAPP", "id: org.deepin.browser,type: amAPP", "id: deepin-mail,type: amAPP","id: deepin-terminal,type: amAPP","id: dde-calendar,type: amAPP","id: deepin-music,type: amAPP","id: deepin-editor,type: amAPP","id: deepin-calculator,type: amAPP","id: dde-control-center,type: amAPP","id: dde-trash,type: amAPP"],
"serial": 0,
"flags": [],
"name": "Docked_Items",
Expand Down
7 changes: 6 additions & 1 deletion panels/dock/taskmanager/desktopfileamparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ QString DesktopFileAMParser::genericName()

std::pair<bool, QString> DesktopFileAMParser::isValied()
{
return std::make_pair(true, "has am as backend");
// TODO: 1. am service may be unavailable and get dbus timeout
// 2. show call path existed not id equeals

if (!(m_applicationInterface && m_applicationInterface->iD() == id()))
return std::make_pair(false, QStringLiteral("am do not contains app %1").arg(id()));
return std::make_pair(true, QStringLiteral("has am as desktopfileparser backend"));
}

QList<QPair<QString, QString>> DesktopFileAMParser::actions()
Expand Down
14 changes: 12 additions & 2 deletions panels/dock/taskmanager/taskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,18 @@ void TaskManager::loadDockedAppItems()
auto appid = app.value("id").toString();
auto type = app.value("type").toString();
auto desktopfile = DESKTOPFILEFACTORY::createById(appid, type);

auto appitem = new AppItem(appid);
auto valid = desktopfile->isValied();

if (!valid.first) {
qInfo(taskManagerLog()) << "failed to load " << appid << " beacause " << valid.second;
continue;
}

auto appitem = desktopfile->getAppItem();
if (appitem.isNull()) {
appitem = new AppItem(appid);
}

appitem->setDesktopFileParser(desktopfile);
ItemModel::instance()->addItem(appitem);
}
Expand Down

0 comments on commit 7605703

Please sign in to comment.