diff options
| author | Adrian Kummerlaender | 2015-07-24 22:54:12 +0200 | 
|---|---|---|
| committer | Adrian Kummerlaender | 2015-07-24 22:54:12 +0200 | 
| commit | 18538591a6226e79e5add5dfc084ab8701e1fd3b (patch) | |
| tree | c3804e54a599e97a2ea9e98d33fe0f37568ac6bf /qml | |
| parent | 607e86675e831a1fa70de5b2813a0e0f9d1bbd56 (diff) | |
| download | MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.gz MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.bz2 MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.lz MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.xz MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.zst MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.zip  | |
Implemented basic delete command in normal mode
Diffstat (limited to 'qml')
| -rw-r--r-- | qml/StateHandler.qml | 8 | ||||
| -rw-r--r-- | qml/main.qml | 17 | 
2 files changed, 20 insertions, 5 deletions
diff --git a/qml/StateHandler.qml b/qml/StateHandler.qml index 4334a6b..aacb0fa 100644 --- a/qml/StateHandler.qml +++ b/qml/StateHandler.qml @@ -24,6 +24,7 @@ Item {  			PropertyChanges { target: prevTerminalAction;     enabled: true  }  			PropertyChanges { target: lastTerminalAction;     enabled: true  }  			PropertyChanges { target: firstTerminalAction;    enabled: true  } +			PropertyChanges { target: deleteTerminalAction;   enabled: true  }  		},  		State {  			name: "INSERT" @@ -36,6 +37,7 @@ Item {  			PropertyChanges { target: prevTerminalAction;     enabled: false }  			PropertyChanges { target: lastTerminalAction;     enabled: false }  			PropertyChanges { target: firstTerminalAction;    enabled: false } +			PropertyChanges { target: deleteTerminalAction;   enabled: false }  		}  	] @@ -95,4 +97,10 @@ Item {  		shortcut: "g"  		onTriggered: terminalList.selectItem(0)  	} + +	Action { +		id: deleteTerminalAction +		shortcut: "d" +		onTriggered: terminalList.deleteCurrent() +	}  } diff --git a/qml/main.qml b/qml/main.qml index 11337f3..f9e7162 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -8,7 +8,10 @@ ApplicationWindow {  	visible: true  	color: "#161616" -	Component.onCompleted: terminalList.focusCurrent() +	Component.onCompleted: { +		terminalList.createItem(); +		terminalList.focusCurrent(); +	}  	Flickable {  		id: terminalListFlickable @@ -24,6 +27,7 @@ ApplicationWindow {  			id: terminalList  			property int activeItem : 0 +			property int itemIndex  : 0  			anchors {  				left:  parent.left @@ -38,10 +42,12 @@ ApplicationWindow {  				var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml");  				var instantiateTerminal = function() {  					var instance = terminalItem.createObject(terminalList, { -						"index": terminalList.children.length, +						"index": itemIndex,  						"width": terminalListFlickable.width  					});  					instance.onExecuted.connect(createItem); + +					++itemIndex;  				}  				if ( terminalItem.status === Component.Ready ) { @@ -105,9 +111,10 @@ ApplicationWindow {  				return children[activeItem];  			} -			TerminalItem { -				width: terminalListFlickable.width -				onExecuted: terminalList.createItem() +			function deleteCurrent() { +				if ( children[activeItem].terminal != null ) { +					children[activeItem].destroy(); +				}  			}          }  	}  | 
