Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/gui/mainwindow/FolderListView.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -14,6 +14,7 @@ Item {
id: root

property int currentDropIndex: -1
property bool isDragging: false
property bool isPlay: false
property bool isRecordingAudio: false
property bool isVoiceToText: false
Expand Down Expand Up @@ -191,7 +192,7 @@ Item {
event.accepted = true;
break;
case Qt.Key_Delete:
if (webVisible || isRecordingAudio || isPlay) {
if (root.isDragging || webVisible || isRecordingAudio || isPlay) {
console.log("No notes available, cannot delete folder");
return;
}
Expand Down Expand Up @@ -493,6 +494,8 @@ Item {

property bool held: false

onHeldChanged: root.isDragging = held

acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
drag.target: this
Expand Down
7 changes: 5 additions & 2 deletions src/gui/mainwindow/ItemListView.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -16,6 +16,7 @@ import org.deepin.dtk 1.0
Item {
id: rootItem

property bool isDragging: false
property bool isPlay: false
property bool isRecordingAudio: false
property bool isSearch: false
Expand Down Expand Up @@ -238,7 +239,7 @@ Item {
event.accepted = true;
break;
case Qt.Key_Delete:
if (webVisible || isRecordingAudio || isPlay) {
if (rootItem.isDragging || webVisible || isRecordingAudio || isPlay) {
console.log("No notes available, cannot delete");
return;
}
Expand Down Expand Up @@ -898,6 +899,8 @@ Item {

property bool held: false

onHeldChanged: rootItem.isDragging = held

acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
drag.target: this
Expand Down
5 changes: 3 additions & 2 deletions src/gui/mainwindow/MainWindow.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -92,7 +92,7 @@ ApplicationWindow {
Shortcuts {
id: shortcuts

enabled: rootWindow.active
enabled: rootWindow.active && !itemListView.isDragging && !folderListView.isDragging

blockCreateKeys: {
var shouldBlock = (isRecordingAudio || webEngineView.titleBar.isPlaying || itemListView.isSearch || itemListView.isSearching || webEngineView.titleBar.isSearching || isVoiceToText);
Expand All @@ -103,6 +103,7 @@ ApplicationWindow {
|| webEngineView.titleBar.isPlaying
|| !webEngineView.titleBar.recordBtnEnabled
initialOnlyCreateFolder: initRect.visible
isDragging: itemListView.isDragging || folderListView.isDragging

onCopy: {
webEngineView.copy();
Expand Down
34 changes: 18 additions & 16 deletions src/gui/mainwindow/Shortcuts.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Item {
property bool blockRecordingKey: false
// 录音状态,用于禁用播放快捷键
property bool isRecordingAudio: false
// 拖拽状态下禁用所有快捷键
property bool isDragging: false

signal copy
signal createFolder
Expand All @@ -30,7 +32,7 @@ Item {

//帮助手册
autoRepeat: false
enabled: true
enabled: !item.isDragging
sequence: "F1"

onActivated: {
Expand All @@ -40,7 +42,7 @@ Item {

Shortcut {
id: ctrl_Shift_H
enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder

//快捷键界面
sequence: "Ctrl+Shift+/"
Expand All @@ -52,7 +54,7 @@ Item {

Shortcut {
id: ctrl_S
enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder

sequence: "Ctrl+S"

Expand All @@ -63,7 +65,7 @@ Item {

Shortcut {
id: ctrl_D
enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder

sequence: "Ctrl+D"

Expand All @@ -77,7 +79,7 @@ Item {

sequence: "Ctrl+N"

enabled: !item.blockCreateKeys
enabled: !item.isDragging && !item.blockCreateKeys

onActivated: {
createFolder();
Expand All @@ -86,7 +88,7 @@ Item {

Shortcut {
id: rename
enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder

sequence: "F2"

Expand All @@ -97,7 +99,7 @@ Item {

Shortcut {
id: renameNoteShort
enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder

sequence: "F3"

Expand All @@ -109,7 +111,7 @@ Item {
Shortcut {
id: ctrl_R
// 初始页面、录音中或显式要求屏蔽录音快捷键时,均不响应 Ctrl+R
enabled: !item.initialOnlyCreateFolder && !rootWindow.isRecordingAudio && !item.blockRecordingKey
enabled: !item.isDragging && !item.initialOnlyCreateFolder && !rootWindow.isRecordingAudio && !item.blockRecordingKey

sequence: "Ctrl+R"

Expand All @@ -135,7 +137,7 @@ Item {

sequence: "Ctrl+B"

enabled: !item.blockCreateKeys && !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.blockCreateKeys && !item.initialOnlyCreateFolder

onActivated: {
createNote();
Expand All @@ -147,7 +149,7 @@ Item {

sequence: "Ctrl+A"

enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder
onActivated: {}
}

Expand All @@ -156,7 +158,7 @@ Item {

sequence: "Ctrl+C"

enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder
onActivated: {
copy();
}
Expand All @@ -167,7 +169,7 @@ Item {

sequence: "Ctrl+X"

enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder
onActivated: {}
}

Expand All @@ -176,7 +178,7 @@ Item {

sequence: "Ctrl+V"

enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder
onActivated: {}
}

Expand All @@ -185,7 +187,7 @@ Item {

sequence: "Alt+M"

enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder
onActivated: {
showJsContextMenu();
}
Expand All @@ -196,7 +198,7 @@ Item {

sequence: "Ctrl+Z"

enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder
onActivated: {}
}

Expand All @@ -205,7 +207,7 @@ Item {

sequence: "Ctrl+Shift+Z"

enabled: !item.initialOnlyCreateFolder
enabled: !item.isDragging && !item.initialOnlyCreateFolder
onActivated: {}
}
}
Loading