Repository navigation
Conversation
The taskbar (dde-shell dock) passed the static icon name 'dde-calendar-dynamic' directly to DciIcon without intercepting it to synthesize a date-specific SVG, so the calendar app icon showed a generic calendar instead of the current date. Port the createCalendarIcon() SVG generation logic from dde-launchpad into dde-shell. In AppItem::icon(), intercept 'dde-calendar-dynamic', generate a temp SVG with the current date, and return the file path. In AppItem.qml, wrap DciIcon in a parent Item and add an Image element that renders file paths, with visibility toggled by whether iconName starts with '/'. Log: BUG-295871
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideThe taskbar now recognizes the calendar application's dynamic icon name, generates and reuses a current-date SVG in the temporary directory, and renders returned file paths through QML while leaving standard theme icon handling unchanged. Sequence diagram for dynamic calendar taskbar icon renderingsequenceDiagram
participant DesktopFileAMParser
participant AppItem
participant CalendarIconHelper
participant TempDirectory
participant AppItemQML
DesktopFileAMParser->>AppItem: desktopIcon()
AppItem->>AppItem: icon()
alt iconName == dde-calendar-dynamic
AppItem->>AppItem: QDate::currentDate()
AppItem->>CalendarIconHelper: createCalendarIcon(svgPath)
CalendarIconHelper->>TempDirectory: QFile::exists(svgPath)
alt SVG does not exist
CalendarIconHelper->>TempDirectory: write current-date SVG
end
CalendarIconHelper-->>AppItem: true
AppItem-->>AppItemQML: svgPath
AppItemQML->>AppItemQML: Image renders file path
else standard icon
AppItem-->>AppItemQML: iconName
AppItemQML->>AppItemQML: DciIcon renders theme icon
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
📝 提交信息标题: fix: support dynamic calendar icon in taskbar 描述:
修改文件:
🔍 详细分析1. 语法逻辑 ❌评价: 存在逻辑缺陷 ❌ 不通过 评分: 14/25 分 潜在问题:
建议:
2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 评分: 20/25 分 潜在问题:
正面评价:
3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 评分: 17/20 分 潜在问题:
正面评价:
4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过 评分: 30/30 分
漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个 安全分析:
🔧 OCR 审查结果
💡 改进建议代码示例修复1:createCalendarIcon返回值校验(calendariconhelper.cpp) bool createCalendarIcon(const QString &fileName)
{
qCDebug(calendarIconLog) << "Creating calendar icon:" << fileName;
// ... SVG data definitions ...
if (!QFile(fileName).exists()) {
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
return false;
// ... write SVG content ...
file.write(QByteArray(" </g>\n</svg>"));
file.close();
// 检查写入是否成功
if (file.error() != QFile::NoError) {
QFile::remove(fileName); // 删除可能损坏的文件
return false;
}
}
return true;
}修复2:constFirst()防御性检查(appitem.cpp) if (iconName == QStringLiteral("dde-calendar-dynamic")) {
const QDate today = QDate::currentDate();
const auto locations = QStandardPaths::standardLocations(QStandardPaths::TempLocation);
if (locations.isEmpty())
return iconName; // 回退到原始图标名
const QString tempDir = locations.constFirst();
const QString svgPath = tempDir + QStringLiteral("/%1_%2.svg").arg(today.year()).arg(today.dayOfYear());
if (dock::createCalendarIcon(svgPath))
return svgPath;
}📋 审查清单
本报告由 AI 代码审查工具自动生成 审查时间: 2026-09-14 19:14 |
|
方案不合理, AM 已经支持动态刷新图标,应该在日历本身进行处理,刷新自己的图标 |
Root Cause Analysis
In the V25 architecture, dde-shell's taskbar passes the static icon name
"dde-calendar-dynamic"directly toDciIconfor rendering, without intercepting it to synthesize a date-specific SVG. The calendar app declaresIcon=dde-calendar-dynamicin its.desktopfile, expecting display components to generate a dynamic icon with the current date. The icon flows unchanged throughDesktopFileAMParser::updateDesktopIcon()→AppItem::icon()→ QMLDciIcon, resulting in a generic calendar icon without the date.Fix Approach
Port the
createCalendarIcon()SVG generation logic from dde-launchpad into dde-shell. InAppItem::icon(), intercept"dde-calendar-dynamic", generate a temp SVG file with the current date, and return the file path. InAppItem.qml, wrapDciIconin a parentItemand add anImageelement that renders file paths, with visibility toggled by whethericonNamestarts with/.Change Safety Assessment
Code Safety
AppItem::icon()code area was last changed in a UI refactor (not a bug fix), so this change does not revert any historical fix.icon()return value is consumed only by QML binding, and non-calendar icons return the same value as before.Business Impact Scope
Affects taskbar icon rendering for the calendar application only. When the calendar app icon appears in the taskbar (docked or running), it will now display a dynamic icon with the current date instead of a static calendar icon. All other application icons are unaffected.
Verification Suggestion
Verify that the calendar app icon in the taskbar shows the correct current date, and that other app icons display normally without regression. Test icon drag, hover preview, and launch animation to confirm QML container changes have no side effects.
根因分析
V25 架构中,dde-shell 任务栏将静态图标名
"dde-calendar-dynamic"直接传递给DciIcon渲染,未拦截并合成带日期的 SVG。日历应用在.desktop文件中声明Icon=dde-calendar-dynamic,期望显示组件根据当前日期生成动态图标。图标名未经处理地流经DesktopFileAMParser::updateDesktopIcon()→AppItem::icon()→ QMLDciIcon,导致显示为不带日期的通用日历图标。修复方案
将 dde-launchpad 的
createCalendarIcon()SVG 生成逻辑移植到 dde-shell。在AppItem::icon()中拦截"dde-calendar-dynamic",生成带当前日期的临时 SVG 文件并返回文件路径。在AppItem.qml中,将DciIcon包裹在父Item中,新增Image元素渲染文件路径,通过iconName是否以/开头切换显示。改动安全评估
代码安全评估
AppItem::icon()代码区域上次修改为 UI 重构(非 bug 修复),本次改动不会撤销历史修复。icon()返回值仅由 QML 绑定消费,非日历图标返回值与改动前一致。业务影响范围
仅影响日历应用在任务栏中的图标渲染。当日历应用图标出现在任务栏(驻留或运行中)时,将显示带当前日期的动态图标,而非静态日历图标。其他应用图标不受影响。
验证建议
验证任务栏中日历应用图标显示正确的当前日期,其他应用图标正常显示无回归。测试图标拖拽、悬停预览、启动动画以确认 QML 容器改动无副作用。
Summary by Sourcery
Support dynamic calendar icons in the taskbar by generating date-specific artwork and rendering it alongside standard application icons.
New Features:
Bug Fixes:
Enhancements:
Build: