forked from R-033/toeterm
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement adding, editing and deleting actions, and action disableOn
- Loading branch information
Showing
8 changed files
with
195 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
|
||
Dialog { | ||
property string title | ||
property string command | ||
property string disableOn | ||
property int index: -1 | ||
property Item actionWorker | ||
|
||
signal updateActions | ||
|
||
Component.onCompleted: { | ||
console.log(title, command, index) | ||
} | ||
|
||
canAccept: titleField.acceptableInput && commandField.acceptableInput | ||
|
||
onAccepted: { | ||
if(index === -1) { | ||
term.addAction(titleField.text, commandField.text, disableOnField.text) | ||
} | ||
else { | ||
term.updateAction(index, titleField.text, commandField.text, disableOnField.text) | ||
} | ||
actionWorker.updateActions() | ||
} | ||
|
||
SilicaFlickable { | ||
anchors.fill: parent | ||
|
||
Column { | ||
width: parent.width | ||
DialogHeader { | ||
title: (index < 0) ? qsTr("Add new action") : qsTr("Edit action") | ||
} | ||
TextField { | ||
id: titleField | ||
text: title | ||
label: qsTr("Name of the action") | ||
clip: true | ||
} | ||
TextField { | ||
id: commandField | ||
text: command | ||
font.family: "monospace" | ||
label: qsTr("Command to run") | ||
} | ||
TextField { | ||
id: disableOnField | ||
text: disableOn | ||
label: qsTr("Disable action by window title") | ||
} | ||
Column { | ||
x: Theme.paddingLarge | ||
width: parent.width + (2 * x) | ||
Label { | ||
width: parent.width | ||
text: qsTr("Enter the command in one line of text.") + "\n" + qsTr("Here are some helpers:") | ||
wrapMode: Text.Wrap | ||
} | ||
|
||
Label { | ||
width: parent.width | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
font.pixelSize: Theme.fontSizeSmall | ||
text: "Enter: \\n\n"+ | ||
"Ctrl-A: \\x01\n"+ | ||
"Ctrl-B: \\x02\n"+ | ||
"Ctrl-C: \\x03\n"+ | ||
"...\n"+ | ||
"Ctrl-X: \\x18\n"+ | ||
"Ctrl-Y: \\x19\n"+ | ||
"Ctrl-Z: \\x20" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters