aboutsummaryrefslogtreecommitdiff
path: root/qml
diff options
context:
space:
mode:
Diffstat (limited to 'qml')
-rw-r--r--qml/StateHandler.qml8
-rw-r--r--qml/TerminalItem.qml17
-rw-r--r--qml/main.qml14
3 files changed, 26 insertions, 13 deletions
diff --git a/qml/StateHandler.qml b/qml/StateHandler.qml
index aacb0fa..53ca3af 100644
--- a/qml/StateHandler.qml
+++ b/qml/StateHandler.qml
@@ -24,7 +24,7 @@ Item {
PropertyChanges { target: prevTerminalAction; enabled: true }
PropertyChanges { target: lastTerminalAction; enabled: true }
PropertyChanges { target: firstTerminalAction; enabled: true }
- PropertyChanges { target: deleteTerminalAction; enabled: true }
+ PropertyChanges { target: resetTerminalAction; enabled: true }
},
State {
name: "INSERT"
@@ -37,7 +37,7 @@ Item {
PropertyChanges { target: prevTerminalAction; enabled: false }
PropertyChanges { target: lastTerminalAction; enabled: false }
PropertyChanges { target: firstTerminalAction; enabled: false }
- PropertyChanges { target: deleteTerminalAction; enabled: false }
+ PropertyChanges { target: resetTerminalAction; enabled: false }
}
]
@@ -99,8 +99,8 @@ Item {
}
Action {
- id: deleteTerminalAction
+ id: resetTerminalAction
shortcut: "d"
- onTriggered: terminalList.deleteCurrent()
+ onTriggered: terminalList.getCurrent().reset()
}
}
diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml
index 0650b1e..26793da 100644
--- a/qml/TerminalItem.qml
+++ b/qml/TerminalItem.qml
@@ -8,7 +8,7 @@ Item {
property int index : 0
property EmbeddedTerminal terminal : null
- signal executed
+ signal executed (int index)
anchors {
left: parent.left
@@ -63,6 +63,19 @@ Item {
}
}
+ function reset() {
+ if ( terminal !== null ) {
+ terminal.destroy();
+
+ terminal = null;
+ command.readOnly = false;
+ command.focus = true;
+
+ unfocus();
+ select();
+ }
+ }
+
FocusScope {
id: scope
@@ -146,7 +159,7 @@ Item {
focus = false;
elementList.createTerminal(text);
- item.executed();
+ item.executed(item.index);
highlighter.deselect();
}
}
diff --git a/qml/main.qml b/qml/main.qml
index f9e7162..836f97c 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -38,6 +38,12 @@ ApplicationWindow {
onHeightChanged: scrollTo(activeItem)
+ function onItemExecuted(index) {
+ if ( index === (children.length - 1) ) {
+ createItem();
+ }
+ }
+
function createItem() {
var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml");
var instantiateTerminal = function() {
@@ -45,7 +51,7 @@ ApplicationWindow {
"index": itemIndex,
"width": terminalListFlickable.width
});
- instance.onExecuted.connect(createItem);
+ instance.onExecuted.connect(onItemExecuted);
++itemIndex;
}
@@ -110,12 +116,6 @@ ApplicationWindow {
function getCurrent() {
return children[activeItem];
}
-
- function deleteCurrent() {
- if ( children[activeItem].terminal != null ) {
- children[activeItem].destroy();
- }
- }
}
}