fix: suppress rename-phase progress and reset bar before long-name ex…#440
Conversation
…tract Two fixes for long-name ZIP extraction (PMS #370449): 1. Suppress progress emission during the 7z rn (rename) phase in handleProgress. ZipCrypto only encrypts file content, not names, so 7z rn runs without a password and reports progress — causing the bar to jump ahead before the password dialog appears. Now the rename phase is silent; real progress starts only in the extract phase. 2. Emit a progress-reset sentinel (signalprogress(-1.0)) when onLongNameProcessFinished transitions from LNE_Rename to LNE_Extract. MainWindow::slotReceiveProgress catches the negative value and calls ProgressPage::resetProgress, so the extract phase starts from 0 and the remaining-time calculation is correct instead of stuck at 00:00:01. Log: fix progress bar jump and remaining-time stuck for encrypted ZIP with long filenames Bug: https://pms.uniontech.com/bug-view-370449.html
Reviewer's GuideSuppresses misleading progress updates during the 7z long-filename rename phase and introduces a sentinel-based progress reset when transitioning to the actual extract phase, so the progress bar and remaining-time calculations correctly reflect only the real extraction work. Sequence diagram for long-name ZIP progress handlingsequenceDiagram
participant CliInterface
participant QProcess7z as QProcess7z
participant MainWindow
participant ProgressPage
QProcess7z->>CliInterface: handleProgress(line)
alt m_longNamePhase == LNE_Rename
CliInterface-->>QProcess7z: return (suppress progress)
else m_longNamePhase == LNE_Extract
CliInterface-->>MainWindow: signalprogress(dPercentage)
end
CliInterface->>CliInterface: onLongNameProcessFinished(exitCode, exitStatus)
alt m_longNamePhase == LNE_Rename
CliInterface->>CliInterface: m_longNamePhase = LNE_Extract
CliInterface-->>MainWindow: signalprogress(-1.0)
end
MainWindow->>MainWindow: slotReceiveProgress(dPercentage)
alt dPercentage < 0
MainWindow->>ProgressPage: resetProgress()
else dPercentage >= 0
MainWindow->>ProgressPage: updateProgress(dPercentage)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider replacing the magic sentinel value
-1.0for progress reset with a named constant or enum so its meaning is self‑documenting and easier to reuse or change safely. - In
slotReceiveProgress, it may be worth guardingm_pProgressPagebefore callingresetProgress()to avoid potential null pointer issues during initialization or teardown paths.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider replacing the magic sentinel value `-1.0` for progress reset with a named constant or enum so its meaning is self‑documenting and easier to reuse or change safely.
- In `slotReceiveProgress`, it may be worth guarding `m_pProgressPage` before calling `resetProgress()` to avoid potential null pointer issues during initialization or teardown paths.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 建议在头文件或合适位置定义哨兵常量
// constexpr double PROGRESS_RESET_SENTINEL = -1.0;
void CliInterface::onLongNameProcessFinished(int exitCode, QProcess::ExitStatus)
{
// ...
if (m_longNamePhase == LNE_Rename) {
m_longNamePhase = LNE_Extract;
// rename→extract 阶段切换时重置进度条。
// 虽然已在 handleProgress 中屏蔽了 rename 阶段的进度上报,
// 但 extractFiles 入口处可能已 emit 过 signalprogress(1),
// 且 rename 阶段可能有少量进度泄露(非 handleProgress 路径)。
// 这里用负值作为重置哨兵,由 MainWindow::slotReceiveProgress 捕获并调用 resetProgress(),
// 确保 extract 阶段的进度从 0 开始单调递增,剩余时间计算正确。
emit signalprogress(PROGRESS_RESET_SENTINEL); // 使用常量替代魔法数字
QString program = m_cliProps->property("extractProgram").toString();
// ...
}
} |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000, max-lvs 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 |
|
/merge |
…tract
Two fixes for long-name ZIP extraction (PMS #370449):
Suppress progress emission during the 7z rn (rename) phase in handleProgress. ZipCrypto only encrypts file content, not names, so 7z rn runs without a password and reports progress — causing the bar to jump ahead before the password dialog appears. Now the rename phase is silent; real progress starts only in the extract phase.
Emit a progress-reset sentinel (signalprogress(-1.0)) when onLongNameProcessFinished transitions from LNE_Rename to LNE_Extract. MainWindow::slotReceiveProgress catches the negative value and calls ProgressPage::resetProgress, so the extract phase starts from 0 and the remaining-time calculation is correct instead of stuck at 00:00:01.
Log: fix progress bar jump and remaining-time stuck for encrypted ZIP with long filenames
Bug: https://pms.uniontech.com/bug-view-370449.html
Summary by Sourcery
Fix progress handling for long-filename ZIP extraction by suppressing rename-phase updates and resetting the progress bar when switching to the extract phase.
Bug Fixes: