Skip to content

Commit 07846fc

Browse files
committed
feat(dock): pass launch_type when launching apps from taskbar
任务栏启动应用时传入 launch_type 参数,用于应用启动埋点统计。 launch_type=2 表示从任务栏快捷启动。涵盖直接 DBus 调用 和 dde-am CLI 两种启动路径。 Pass launch_type parameter when launching applications from taskbar for application launch event reporting. launch_type=2 indicates the app was launched from the taskbar. Covers both direct DBus calls and dde-am CLI launch paths. PMS: TASK-388657
1 parent 5e3b941 commit 07846fc

5 files changed

Lines changed: 18 additions & 5 deletions

File tree

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Maintainer: Deepin Packages Builder <packages@deepin.com>
55
Build-Depends:
66
debhelper-compat (= 13),
77
cmake,
8-
dde-application-manager-api (>= 1.2.48),
8+
dde-application-manager-api (>> 1.2.51),
99
dde-api-dev (>> 6.0.39),
1010
dde-tray-loader-dev (> 2.0.24),
1111
extra-cmake-modules,

panels/dock/taskmanager/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ if (HAVE_DDE_API_EVENTLOGGER)
107107
target_link_libraries(dock-taskmanager PRIVATE DDEAPI::EventLogger)
108108
endif()
109109

110+
110111
if (BUILD_WITH_X11)
111112
target_compile_definitions(dock-taskmanager PRIVATE BUILD_WITH_X11=)
112113
pkg_check_modules(TaskmanagerXcb REQUIRED IMPORTED_TARGET xcb xcb-res xcb-ewmh xcb-icccm)

panels/dock/taskmanager/desktopfileamparser.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -194,7 +194,7 @@ void DesktopFileAMParser::launchWithAction(const QString& action)
194194

195195
void DesktopFileAMParser::launchWithUrls(const QStringList & urls)
196196
{
197-
m_applicationInterface->Launch(QString(), urls, QVariantMap());
197+
m_applicationInterface->Launch(QString(), urls, QVariantMap{{QStringLiteral("_launch_type"), QStringLiteral("dde-shell")}});
198198
}
199199

200200
void DesktopFileAMParser::requestQuit()
@@ -222,7 +222,11 @@ void DesktopFileAMParser::launchByAMTool(const QString &action)
222222
QProcess process;
223223
const auto path = m_applicationInterface->path();
224224
process.setProcessChannelMode(QProcess::MergedChannels);
225+
#ifdef HAVE_DDE_API_EVENTLOGGER
226+
process.start("dde-am", {"--by-user", "--launch-type", "dde-shell", path, action});
227+
#else
225228
process.start("dde-am", {"--by-user", path, action});
229+
#endif
226230
if (!process.waitForFinished()) {
227231
qWarning() << "Failed to launch the path:" << path << process.errorString();
228232
return;

panels/dock/taskmanager/dockglobalelementmodel.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,11 @@ void DockGlobalElementModel::requestNewInstance(const QModelIndex &index, const
443443
} else {
444444
QProcess process;
445445
process.setProcessChannelMode(QProcess::MergedChannels);
446+
#ifdef HAVE_DDE_API_EVENTLOGGER
447+
process.start("dde-am", {"--by-user", "--launch-type", "dde-shell", id, action});
448+
#else
446449
process.start("dde-am", {"--by-user", id, action});
450+
#endif
447451
process.waitForFinished();
448452
}
449453
}
@@ -463,7 +467,7 @@ void DockGlobalElementModel::requestOpenUrls(const QModelIndex &index, const QLi
463467
Application appInterface(QStringLiteral("org.desktopspec.ApplicationManager1"), dbusPath, QDBusConnection::sessionBus());
464468

465469
if (appInterface.isValid()) {
466-
appInterface.Launch(QString(), urlStrings, QVariantMap());
470+
appInterface.Launch(QString(), urlStrings, QVariantMap{{QStringLiteral("_launch_type"), QStringLiteral("dde-shell")}});
467471
}
468472
}
469473

panels/dock/taskmanager/dockgroupmodel.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -206,7 +206,11 @@ void DockGroupModel::requestNewInstance(const QModelIndex &index, const QString
206206
auto desktopId = index.data(TaskManager::DesktopIdRole).toString();
207207
QProcess process;
208208
process.setProcessChannelMode(QProcess::MergedChannels);
209+
#ifdef HAVE_DDE_API_EVENTLOGGER
210+
process.start("dde-am", {"--by-user", "--launch-type", "dde-shell", desktopId, action});
211+
#else
209212
process.start("dde-am", {"--by-user", desktopId, action});
213+
#endif
210214
process.waitForFinished();
211215
return;
212216
}

0 commit comments

Comments
 (0)