diff --git a/qml/Dialogs/OpenWithDialog.qml b/qml/Dialogs/OpenWithDialog.qml index ac7aa64..6a4961a 100644 --- a/qml/Dialogs/OpenWithDialog.qml +++ b/qml/Dialogs/OpenWithDialog.qml @@ -64,8 +64,10 @@ FishUI.Window { control.close() } - Keys.enabled: true - Keys.onEscapePressed: control.close() + Shortcut { + sequence: "Escape" + onActivated: control.close() + } ColumnLayout { id: _mainLayout diff --git a/qml/Dialogs/PropertiesDialog.qml b/qml/Dialogs/PropertiesDialog.qml index 0be56aa..cdbe8c7 100644 --- a/qml/Dialogs/PropertiesDialog.qml +++ b/qml/Dialogs/PropertiesDialog.qml @@ -41,8 +41,10 @@ FishUI.Window { maximumWidth: widthValue maximumHeight: heightValue - Keys.enabled: true - Keys.onEscapePressed: control.close() + Shortcut { + sequence: "Escape" + onActivated: control.close() + } background.color: FishUI.Theme.secondBackgroundColor diff --git a/qml/FolderGridView.qml b/qml/FolderGridView.qml index a18d323..5a41d9a 100644 --- a/qml/FolderGridView.qml +++ b/qml/FolderGridView.qml @@ -197,7 +197,7 @@ GridView { highlightMoveDuration: 0 keyNavigationEnabled : true keyNavigationWraps : true - Keys.onPressed: { + Keys.onPressed: function(event) { control.keyPress(event) if (event.key === Qt.Key_Control) { @@ -213,7 +213,7 @@ GridView { control.decreaseIconSize() } } - Keys.onReleased: { + Keys.onReleased: function(event) { if (event.key === Qt.Key_Control) { ctrlPressed = false } else if (event.key === Qt.Key_Shift) { @@ -221,13 +221,13 @@ GridView { anchorIndex = 0 } } - Keys.onEscapePressed: { + Keys.onEscapePressed: function(event) { if (!editor || !editor.targetItem) { dirModel.clearSelection() event.accepted = false } } - Keys.onUpPressed: { + Keys.onUpPressed: function(event) { if (!editor || !editor.targetItem) { var newIndex = positioner.nearestItem(currentIndex, effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.UpArrow)) @@ -237,7 +237,7 @@ GridView { } } } - Keys.onDownPressed: { + Keys.onDownPressed: function(event) { if (!editor || !editor.targetItem) { var newIndex = positioner.nearestItem(currentIndex, effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.DownArrow)) @@ -247,7 +247,7 @@ GridView { } } } - Keys.onLeftPressed: { + Keys.onLeftPressed: function(event) { if (!editor || !editor.targetItem) { var newIndex = positioner.nearestItem(currentIndex, effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.LeftArrow)) @@ -257,7 +257,7 @@ GridView { } } } - Keys.onRightPressed: { + Keys.onRightPressed: function(event) { if (!editor || !editor.targetItem) { var newIndex = positioner.nearestItem(currentIndex, effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.RightArrow)) @@ -332,7 +332,7 @@ GridView { DragDrop.DropArea { anchors.fill: parent - onDrop: { + onDrop: function(event) { control.drop(control, event, mapToItem(control, event.x, event.y)) } } @@ -347,7 +347,7 @@ GridView { enabled: true z: -1 - onPressed: { + onPressed: function(mouse) { control.forceActiveFocus() if (control.editor && childAt(mouse.x, mouse.y) !== control.editor) @@ -403,7 +403,7 @@ GridView { } } - onPositionChanged: { + onPositionChanged: function(mouse) { control.ctrlPressed = (mouse.modifiers & Qt.ControlModifier) control.shiftPressed = (mouse.modifiers & Qt.ShiftModifier) @@ -483,7 +483,7 @@ GridView { clearPressState() } - onDoubleClicked: { + onDoubleClicked: function(mouse) { if (mouse.button === Qt.LeftButton && control.pressedItem) dirModel.openSelected() } @@ -506,7 +506,7 @@ GridView { onCanceled: pressCanceled() - onWheel: { + onWheel: function(wheel) { if (wheel.modifiers & Qt.ControlModifier) { if (wheel.angleDelta.y > 0) control.increaseIconSize() @@ -676,7 +676,7 @@ GridView { } } - Keys.onPressed: { + Keys.onPressed: function(event) { switch (event.key) { case Qt.Key_Return: case Qt.Key_Enter: diff --git a/qml/FolderListView.qml b/qml/FolderListView.qml index c6fbabe..0edc9fd 100644 --- a/qml/FolderListView.qml +++ b/qml/FolderListView.qml @@ -143,7 +143,7 @@ ListView { highlightMoveDuration: 0 Keys.enabled: true - Keys.onPressed: { + Keys.onPressed: function(event) { control.keyPress(event) if (event.key === Qt.Key_Control) { @@ -156,7 +156,7 @@ ListView { } } - Keys.onReleased: { + Keys.onReleased: function(event) { if (event.key === Qt.Key_Control) { ctrlPressed = false } else if (event.key === Qt.Key_Shift) { @@ -165,14 +165,14 @@ ListView { } } - Keys.onEscapePressed: { + Keys.onEscapePressed: function(event) { if (!editor || !editor.targetItem) { dirModel.clearSelection() event.accepted = false } } - Keys.onUpPressed: { + Keys.onUpPressed: function(event) { if (!editor || !editor.targetItem) { var newIndex = currentIndex newIndex--; @@ -185,7 +185,7 @@ ListView { } } - Keys.onDownPressed: { + Keys.onDownPressed: function(event) { if (!editor || !editor.targetItem) { var newIndex = currentIndex newIndex++ @@ -227,7 +227,7 @@ ListView { DragDrop.DropArea { anchors.fill: parent - onDrop: { + onDrop: function(event) { control.drop(control, event, mapToItem(control, event.x, event.y)) } } @@ -242,12 +242,12 @@ ListView { enabled: true z: -1 - onDoubleClicked: { + onDoubleClicked: function(mouse) { if (mouse.button === Qt.LeftButton && control.pressedItem) dirModel.openSelected() } - onPressed: { + onPressed: function(mouse) { control.forceActiveFocus() if (control.editor && childAt(mouse.x, mouse.y) !== control.editor) @@ -316,7 +316,7 @@ ListView { // TODO: rename } - onPositionChanged: { + onPositionChanged: function(mouse) { control.ctrlPressed = (mouse.modifiers & Qt.ControlModifier) control.shiftPressed = (mouse.modifiers & Qt.ShiftModifier) @@ -497,7 +497,7 @@ ListView { control.forceActiveFocus() } - Keys.onPressed: { + Keys.onPressed: function(event) { switch (event.key) { case Qt.Key_Return: case Qt.Key_Enter: diff --git a/qml/PathBar.qml b/qml/PathBar.qml index 7d2de6e..c24b521 100644 --- a/qml/PathBar.qml +++ b/qml/PathBar.qml @@ -57,12 +57,12 @@ Item { MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton - onPressed: { + onPressed: function(mouse) { _dragged = false _pressX = mouse.x _pressY = mouse.y } - onPositionChanged: { + onPositionChanged: function(mouse) { if (Math.abs(mouse.x - _pressX) > 4 || Math.abs(mouse.y - _pressY) > 4) _dragged = true } @@ -130,12 +130,12 @@ Item { property real pressX: 0 property real pressY: 0 - onPressed: { + onPressed: function(mouse) { dragged = false pressX = mouse.x pressY = mouse.y } - onPositionChanged: { + onPositionChanged: function(mouse) { if (Math.abs(mouse.x - pressX) > 4 || Math.abs(mouse.y - pressY) > 4) dragged = true } @@ -191,7 +191,7 @@ Item { closeEditor() } - Keys.onPressed: { + Keys.onPressed: function(event) { if (event.key === Qt.Key_Escape) focus = false } diff --git a/qml/SideBar.qml b/qml/SideBar.qml index 09a8e4e..004e4fa 100644 --- a/qml/SideBar.qml +++ b/qml/SideBar.qml @@ -101,7 +101,7 @@ ListView { anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { + onClicked: function(mouse) { if (mouse.button === Qt.LeftButton) { if (model.isDevice && model.setupNeeded) placesModel.requestSetup(index)