-
Notifications
You must be signed in to change notification settings - Fork 42
fix: Add a password input box menu setting item #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#522
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR introduces configurable enablement for copy and cut context menu items in password input fields by adding control flags and exposing setter functions to toggle these features. Sequence diagram for toggling copy/cut menu enablement in password inputsequenceDiagram
actor User
participant PasswordEdit
participant TextField
User->>PasswordEdit: Calls setCopyEnable(enable)
PasswordEdit->>TextField: Sets copyMenuEnabled
User->>PasswordEdit: Calls setCutEnable(enable)
PasswordEdit->>TextField: Sets cutMenuEnabled
User->>TextField: Opens context menu
TextField-->>User: Shows Copy/Cut enabled or disabled
Class diagram for updated TextField and PasswordEdit componentsclassDiagram
class TextField {
+bool copyMenuEnabled
+bool cutMenuEnabled
+copy()
+cut()
}
class PasswordEdit {
+setCopyEnable(enable)
+setCutEnable(enable)
}
PasswordEdit --> TextField: uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Rename setCopyEnable() and setCutEnable() to setCopyEnabled() and setCutEnabled() to match the copyMenuEnabled and cutMenuEnabled property naming.
- Expose copyMenuEnabled and cutMenuEnabled as QML property aliases on PasswordEdit instead of only providing setter functions for more straightforward usage and binding.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Rename setCopyEnable() and setCutEnable() to setCopyEnabled() and setCutEnabled() to match the copyMenuEnabled and cutMenuEnabled property naming.
- Expose copyMenuEnabled and cutMenuEnabled as QML property aliases on PasswordEdit instead of only providing setter functions for more straightforward usage and binding.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
18202781743
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样,只是菜单不显示吧,但实际上还是能剪切吧,
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#522
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#522
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#522
Add a password input box menu setting item Log: Add a password input box menu setting item pms: BUG-308717
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#522
deepin pr auto review这段代码是一个Qt Quick的TextField组件的修改,我来分析一下它的改进点以及可能存在的问题: 改进点:
潜在问题与建议:
修改建议示例:T.TextField {
// ... 其他属性保持不变 ...
// 提取通用的操作条件判断
readonly property bool canEdit: control.echoMode === TextInput.Normal
readonly property bool hasSelection: control.selectedText.length > 0
readonly property bool canCopy: canEdit && hasSelection
readonly property bool canCut: canEdit && hasSelection && !control.readonly
// 提取键盘事件处理为独立函数
function handleKeyEvent(event) {
if (event.matches(StandardKey.Copy)) {
if (!canCopy) {
event.accepted = true
showFeedback("复制功能不可用")
return true
}
} else if (event.matches(StandardKey.Cut)) {
if (!canCut) {
event.accepted = true
showFeedback("剪切功能不可用")
return true
}
}
return false
}
// 反馈函数
function showFeedback(message) {
// 实现视觉或听觉反馈
console.log(message)
// 或者使用Qt Quick的Toast/Notification组件
}
Keys.enabled: !canCopy || !canCut
Keys.onPressed: function(event) {
handleKeyEvent(event)
}
// ... 其他代码保持不变 ...
}这些改进可以提高代码的可维护性、可读性和用户体验,同时保持原有功能的完整性。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, pengfeixx 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 |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#522
Add a password input box menu setting item
Log: Add a password input box menu setting item
pms: BUG-308717
Summary by Sourcery
Add support for toggling copy and cut operations in the password input context menu
New Features:
Enhancements: