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

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

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

@ -6,9 +6,21 @@ ScrollView {
clip: true clip: true
ScrollBar.vertical.visible: contentHeight > height 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 default property alias textAreaData: textArea.data
property string saveName: ""
property var saveId: "ALL"
property var saveProperties: ["text"]
property alias backgroundColor: textAreaBackground.color property alias backgroundColor: textAreaBackground.color
property alias placeholderText: textArea.placeholderText property alias placeholderText: textArea.placeholderText
property alias text: textArea.text property alias text: textArea.text

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

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