Remove "Open Folder" button

This commit is contained in:
David Rowe 2016-06-01 16:16:08 +12:00
parent 4da1c0ac4d
commit c4aed1ce06

View file

@ -212,8 +212,9 @@ ModalWindow {
function update() { function update() {
var row = fileTableView.currentRow; var row = fileTableView.currentRow;
openButton.text = root.selectDirectory && row === -1 ? "Choose" : "Open"
if (row === -1) { if (row === -1) {
openFolderButton.enabled = false;
return; return;
} }
@ -224,7 +225,6 @@ ModalWindow {
} else { } else {
currentSelection.text = ""; currentSelection.text = "";
} }
openFolderButton.enabled = currentSelectionIsFolder
} }
function navigateUp() { function navigateUp() {
@ -637,16 +637,6 @@ ModalWindow {
Keys.onReturnPressed: okAction.trigger() Keys.onReturnPressed: okAction.trigger()
KeyNavigation.up: selectionType KeyNavigation.up: selectionType
KeyNavigation.left: selectionType KeyNavigation.left: selectionType
KeyNavigation.right: openFolderButton
}
Button {
id: openFolderButton
text: "Open Folder"
enabled: false
action: openFolderAction
KeyNavigation.up: selectionType
KeyNavigation.left: openButton
KeyNavigation.right: cancelButton KeyNavigation.right: cancelButton
} }
@ -654,7 +644,7 @@ ModalWindow {
id: cancelButton id: cancelButton
action: cancelAction action: cancelAction
KeyNavigation.up: selectionType KeyNavigation.up: selectionType
KeyNavigation.left: openFolderButton KeyNavigation.left: openButton
KeyNavigation.right: fileTableView.contentItem KeyNavigation.right: fileTableView.contentItem
Keys.onReturnPressed: { canceled(); root.enabled = false } Keys.onReturnPressed: { canceled(); root.enabled = false }
} }
@ -663,8 +653,15 @@ ModalWindow {
Action { Action {
id: okAction id: okAction
text: root.saveDialog ? "Save" : (root.selectDirectory ? "Choose" : "Open") text: root.saveDialog ? "Save" : (root.selectDirectory ? "Choose" : "Open")
enabled: currentSelection.text ? true : false enabled: currentSelection.text || !root.selectDirectory && d.currentSelectionIsFolder ? true : false
onTriggered: okActionTimer.start(); onTriggered: {
if (!root.selectDirectory && !d.currentSelectionIsFolder
|| root.selectDirectory && fileTableView.currentRow === -1) {
okActionTimer.start();
} else {
fileTableView.navigateToCurrentRow();
}
}
} }
Timer { Timer {
@ -724,12 +721,6 @@ ModalWindow {
} }
} }
Action {
id: openFolderAction
text: "Open Folder"
onTriggered: { fileTableView.navigateToCurrentRow(); }
}
Action { Action {
id: cancelAction id: cancelAction
text: "Cancel" text: "Cancel"