Save/load composer text

This commit is contained in:
miruka 2019-12-10 17:04:03 -04:00
parent 98c2efb773
commit 3c4c92dbc0
5 changed files with 21 additions and 8 deletions

View File

@ -76,10 +76,6 @@
but never do it again once the user hovered it long enough to show
tooltip or clicked on it once
- Restoring UI state:
- Composer content
- Which element was focused
- Combine events so they take less space
- After combining is implemented, no need to hide profile changes anymore.
- Replies

View File

@ -25,7 +25,7 @@ Drawer {
property string saveName: ""
property string saveId: ""
property var saveId: "ALL"
property var saveProperties: ["preferredSize"]
//

View File

@ -6,9 +6,21 @@ ScrollView {
clip: true
ScrollBar.vertical.visible: contentHeight > height
// Set it only on component creation to avoid binding loops
Component.onCompleted: if (! text) {
text = window.getState(this, "text", "")
textArea.cursorPosition = text.length
}
onTextChanged: window.saveState(this)
default property alias textAreaData: textArea.data
property string saveName: ""
property var saveId: "ALL"
property var saveProperties: ["text"]
property alias backgroundColor: textAreaBackground.color
property alias placeholderText: textArea.placeholderText
property alias text: textArea.text

View File

@ -30,8 +30,10 @@ TextField {
}
// Set it only on component creation to avoid binding loops
Component.onCompleted:
if (! text) text = window.getState(this, "text", "")
Component.onCompleted: if (! text) {
text = window.getState(this, "text", "")
cursorPosition = text.length
}
onTextChanged: window.saveState(this)
@ -42,7 +44,7 @@ TextField {
property string saveName: ""
property string saveId: ""
property var saveId: "ALL"
property var saveProperties: ["text"]
property bool error: false

View File

@ -65,6 +65,9 @@ Rectangle {
HScrollableTextArea {
id: areaScrollView
saveName: "composer"
saveId: [chat.roomId, writingUserId]
placeholderText: qsTr("Type a message...")
backgroundColor: "transparent"
area.tabStopDistance: 4 * 4 // 4 spaces