aboutsummaryrefslogtreecommitdiff
path: root/src/list/TerminalItem.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/list/TerminalItem.qml')
-rw-r--r--src/list/TerminalItem.qml26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/list/TerminalItem.qml b/src/list/TerminalItem.qml
index febd116..cfffd86 100644
--- a/src/list/TerminalItem.qml
+++ b/src/list/TerminalItem.qml
@@ -6,6 +6,7 @@ Item {
id: item
property EmbeddedTerminal terminal : null
+ property HistoryViewer history : null
property int index : 0
signal executed (int index)
@@ -96,12 +97,22 @@ Item {
function createTerminal(program) {
var terminalComponent = Qt.createComponent("qrc:/EmbeddedTerminal.qml");
var instantiateTerminal = function() {
+ if ( item.history !== null ) {
+ item.history.destroy();
+ item.history = null;
+ }
+
item.terminal = terminalComponent.createObject(elementList, {
"settings" : settings,
"program" : program,
"workingDirectory" : "$HOME",
"focus" : true
});
+ item.terminal.onFinished.connect(function() {
+ var history = item.terminal.history;
+ item.reset();
+ createHistoryViewer(history);
+ });
}
if ( terminalComponent.status === Component.Ready ) {
@@ -111,6 +122,21 @@ Item {
}
}
+ function createHistoryViewer(history) {
+ var historyComponent = Qt.createComponent("qrc:/HistoryViewer.qml");
+ var instantiateHistory = function() {
+ item.history = historyComponent.createObject(elementList, {
+ "history" : history
+ });
+ }
+
+ if ( historyComponent.status === Component.Ready ) {
+ instantiateHistory();
+ } else {
+ historyComponent.statusChanged.connect(instantiateHistory);
+ }
+ }
+
RowLayout {
anchors {
left: parent.left