feat: add cancel button state parameter for bluetooth dialog#429
Merged
fly602 merged 1 commit intolinuxdeepin:masterfrom Apr 21, 2026
Merged
feat: add cancel button state parameter for bluetooth dialog#429fly602 merged 1 commit intolinuxdeepin:masterfrom
fly602 merged 1 commit intolinuxdeepin:masterfrom
Conversation
1. Add new CancelBtnState constant (index 4) for command line argument parsing 2. Introduce cancelable variable to control cancel button visibility 3. Read optional 5th parameter to determine cancel button state 4. Default cancelable to true when 5th parameter is not provided 5. Pass cancelable state to PinCodeDialog constructor instead of hardcoded true 6. Update debug output to include isCancelBtnShown information Log: Added cancel button visibility parameter for Bluetooth pairing dialog Influence: 1. Test Bluetooth pairing dialog with cancel button enabled (pass "true" as 5th argument) 2. Test Bluetooth pairing dialog with cancel button disabled (pass "false" as 5th argument) 3. Verify backward compatibility when only 4 arguments are provided (should default to showing cancel button) 4. Test dialog behavior during pairing process with different cancel button states 5. Verify command line argument parsing with various parameter combinations feat: 新增蓝牙弹窗取消按钮状态参数 1. 添加新的 CancelBtnState 常量(索引 4)用于命令行参数解析 2. 引入 cancelable 变量控制取消按钮的可见性 3. 读取可选的第 5 个参数来确定取消按钮状态 4. 当未提供第 5 个参数时,cancelable 默认为 true 5. 将 cancelable 状态传递给 PinCodeDialog 构造函数,替代硬编码的 true 6. 更新调试输出以包含 isCancelBtnShown 信息 Log: 新增蓝牙配对弹窗取消按钮可见性参数 Influence: 1. 测试启用取消按钮的蓝牙配对弹窗(第 5 个参数传 "true") 2. 测试禁用取消按钮的蓝牙配对弹窗(第 5 个参数传 "false") 3. 验证仅提供 4 个参数时的向后兼容性(应默认显示取消按钮) 4. 测试不同取消按钮状态下配对过程中的弹窗行为 5. 验证各种参数组合下的命令行参数解析 PMS: BUG-343047 Change-Id: I617b0b24a0709f4c9395879a9b17df69b705cf60
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a command-line controlled cancel-button visibility flag to the Bluetooth pairing dialog and threads that state through argument parsing, logging, and the PinCodeDialog construction while preserving backward compatibility. Sequence diagram for Bluetooth dialog cancel button state handlingsequenceDiagram
actor User
participant Shell
participant BluetoothDialogApp as dde_bluetooth_dialog
participant PinCodeDialog
User->>Shell: Run dde_bluetooth_dialog with args
Shell->>BluetoothDialogApp: argc, argv
BluetoothDialogApp->>BluetoothDialogApp: Parse arguslist
BluetoothDialogApp->>BluetoothDialogApp: Validate arg count >= 4
alt arguslist size >= 5
BluetoothDialogApp->>BluetoothDialogApp: cancelable = (arguslist[4] == "true")
else only 4 args
BluetoothDialogApp->>BluetoothDialogApp: cancelable = true
end
BluetoothDialogApp->>BluetoothDialogApp: qDebug PingCode, DevicePath, PingTime, isCancelBtnShown
BluetoothDialogApp->>PinCodeDialog: create with PingCode, DevicePath, PingTime, cancelable
User->>PinCodeDialog: Interact (enter PIN, optional Cancel)
PinCodeDialog-->>BluetoothDialogApp: Result (paired, cancelled, timeout)
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:
- The
cancelableflag currently treats any 5th argument other than the exact string "true" asfalse; consider explicitly handling/validating supported values (e.g., "true"/"false" or 1/0) and logging unexpected inputs so accidental typos do not silently disable the cancel button. - For readability and consistency with the rest of the
qDebug()call, consider separating the "Ping Time" label and value with<<instead of using string concatenation ("Ping Time:" << arguslist[PingTime]) so all fields are logged in a uniform way.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `cancelable` flag currently treats any 5th argument other than the exact string "true" as `false`; consider explicitly handling/validating supported values (e.g., "true"/"false" or 1/0) and logging unexpected inputs so accidental typos do not silently disable the cancel button.
- For readability and consistency with the rest of the `qDebug()` call, consider separating the "Ping Time" label and value with `<<` instead of using string concatenation (`"Ping Time:" << arguslist[PingTime]`) so all fields are logged in a uniform way.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以下是对这段代码变更的审查意见,包括语法逻辑、代码质量、代码性能和代码安全方面的改进建议: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
5. 改进后的代码示例// SPDX-FileCopyrightText: 2016 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include <DApplication>
#include <DLog>
#include <QDebug>
#include "pincode-dialog.h"
DCORE_USE_NAMESPACE
const int PingCode = 1;
const int DevicePath = 2;
const int PingTime = 3;
const int CancelBtnState = 4;
int main(int argc, char *argv[])
{
DApplication app(argc, argv);
app.setOrganizationName("deepin");
app.setApplicationName("dde-bluetooth-dialog");
DLogManager::registerConsoleAppender();
DLogManager::registerFileAppender();
QStringList arguslist = app.arguments();
if (arguslist.size() < 4) {
qDebug() << "number of parameters must be greater than 3";
return -1;
}
// 提取参数到局部变量以提高性能
QString pingCode = arguslist[PingCode];
QString devicePath = arguslist[DevicePath];
QString pingTime = arguslist[PingTime];
bool cancelable = (arguslist.size() >= 5) ? (arguslist[CancelBtnState].toLower() == "true") : true;
qDebug() << "PingCode:" << pingCode
<< "Device Path:" << devicePath
<< "Ping Time:" << pingTime
<< "isCancelBtnShown:" << cancelable;
PinCodeDialog dialog(pingCode, devicePath, pingTime, cancelable);
#if (defined QT_DEBUG) && (defined CHECK_ACCESSIBLENAME)
AccessibilityCheckerEx checker;
checker.setOutputFormat(DAccessibilityChecker::FullFormat);
checker.start();
#endif
return dialog.exec();
}总结
|
caixr23
approved these changes
Apr 21, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, fly602 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log: Added cancel button visibility parameter for Bluetooth pairing dialog
Influence:
feat: 新增蓝牙弹窗取消按钮状态参数
Log: 新增蓝牙配对弹窗取消按钮可见性参数
Influence:
PMS: BUG-343047
Change-Id: I617b0b24a0709f4c9395879a9b17df69b705cf60
Summary by Sourcery
Add support for controlling the Bluetooth PIN code dialog’s cancel button visibility via an optional command line parameter and propagate this state into the dialog.
New Features:
Enhancements: