import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import Communi 3.1
TextField {
id: textField
property alias buffer: completer.buffer
focus: true
placeholderText: qsTr("...")
Keys.onTabPressed: completer.complete(text, cursorPosition)
id: completer
onCompleted: {
textField.text = text
textField.cursorPosition = cursor
}
parser: IrcCommandParser {
id: parser
tolerant: true
triggers: ["/"]
target: buffer ? buffer.
title :
""
Component.onCompleted: {
parser.addCommand(
IrcCommand.
Part,
"PART (<#channel>) (<message...>)")
}
}
}
style: TextFieldStyle {
background: Rectangle {
color: palette.base
Rectangle {
color: "transparent"
anchors.leftMargin: -1
border.color: "#aaa"
}
}
}
onAccepted: {
var cmd = parser.parse(text)
if (cmd) {
textField.messageSent(msg)
}
textField.text = ""
}
}
}