Changeset View
Changeset View
Standalone View
Standalone View
src/apps/qml/qml/MessageLine.qml
Show All 32 Lines | 31 | ColumnLayout { | |||
---|---|---|---|---|---|
33 | property alias messageLineText: messageLine.text | 33 | property alias messageLineText: messageLine.text | ||
34 | property string savePreviousMessage | 34 | property string savePreviousMessage | ||
35 | readonly property int popupheight: 100 | 35 | readonly property int popupheight: 100 | ||
36 | property string selectedRoomId | 36 | property string selectedRoomId | ||
37 | property string messageId | 37 | property string messageId | ||
38 | property string threadmessageId | 38 | property string threadmessageId | ||
39 | property string selectedThreadMessage | 39 | property string selectedThreadMessage | ||
40 | 40 | | |||
41 | property QtObject inputCompleterModel | 41 | property QtObject inputTextManager | ||
42 | 42 | | |||
43 | function sendMessage() | 43 | function sendMessage() | ||
44 | { | 44 | { | ||
45 | var text = messageLine.text; | 45 | var text = messageLine.text; | ||
46 | if (text === "") | 46 | if (text === "") | ||
47 | return; | 47 | return; | ||
48 | if (appid.rocketChatAccount.loginStatus !== DDPClient.LoggedIn) | 48 | if (appid.rocketChatAccount.loginStatus !== DDPClient.LoggedIn) | ||
49 | return; | 49 | return; | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 97 | QQC2.TextArea { | |||
104 | background: Rectangle { | 104 | background: Rectangle { | ||
105 | anchors.fill: parent | 105 | anchors.fill: parent | ||
106 | Kirigami.Theme.colorSet: Kirigami.Theme.Window | 106 | Kirigami.Theme.colorSet: Kirigami.Theme.Window | ||
107 | border.color: parent.activeFocus ? Kirigami.Theme.activeTextColor : Kirigami.Theme.textColor | 107 | border.color: parent.activeFocus ? Kirigami.Theme.activeTextColor : Kirigami.Theme.textColor | ||
108 | color: Kirigami.Theme.backgroundColor | 108 | color: Kirigami.Theme.backgroundColor | ||
109 | } | 109 | } | ||
110 | 110 | | |||
111 | onTextChanged: { | 111 | onTextChanged: { | ||
112 | appid.rocketChatAccount.setInputTextChanged(text, cursorPosition); | 112 | inputTextManager.setInputTextChanged(text, cursorPosition); | ||
113 | if (listView.count > 0) { | 113 | if (listView.count > 0) { | ||
114 | showPopupCompleting() | 114 | showPopupCompleting() | ||
115 | } else { | 115 | } else { | ||
116 | popup.close() | 116 | popup.close() | ||
117 | } | 117 | } | ||
118 | footerItem.textEditing(text) | 118 | footerItem.textEditing(text) | ||
119 | } | 119 | } | ||
120 | Keys.onDownPressed: { | 120 | Keys.onDownPressed: { | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 175 | ListView { | |||
176 | id: listView | 176 | id: listView | ||
177 | 177 | | |||
178 | readonly property int delegateHeight: count > 0 ? contentItem.children[0].height : 0 | 178 | readonly property int delegateHeight: count > 0 ? contentItem.children[0].height : 0 | ||
179 | 179 | | |||
180 | height: popup.height | 180 | height: popup.height | ||
181 | width: parent.width | 181 | width: parent.width | ||
182 | interactive: true | 182 | interactive: true | ||
183 | clip: true | 183 | clip: true | ||
184 | model: inputCompleterModel | 184 | model: inputTextManager.inputCompleterModel | ||
185 | delegate: Kirigami.BasicListItem { | 185 | delegate: Kirigami.BasicListItem { | ||
186 | readonly property variant myData: model | 186 | readonly property variant myData: model | ||
187 | 187 | | |||
188 | icon: model.iconname | 188 | icon: model.iconname | ||
189 | 189 | | |||
190 | label: model.displayname | 190 | label: model.displayname | ||
191 | onClicked: { | 191 | onClicked: { | ||
192 | listView.currentIndex = model.index | 192 | listView.currentIndex = model.index | ||
Show All 14 Lines | |||||
207 | } | 207 | } | ||
208 | 208 | | |||
209 | } | 209 | } | ||
210 | 210 | | |||
211 | function textSelected(completerName) { | 211 | function textSelected(completerName) { | ||
212 | if (listView.currentItem) { | 212 | if (listView.currentItem) { | ||
213 | var oldCursorPosition = messageLine.cursorPosition; | 213 | var oldCursorPosition = messageLine.cursorPosition; | ||
214 | var oldTextLength = messageLine.text.length; | 214 | var oldTextLength = messageLine.text.length; | ||
215 | messageLine.text = appid.rocketChatAccount.replaceWord(completerName + " ", messageLine.text, messageLine.cursorPosition) | 215 | messageLine.text = inputTextManager.replaceWord(completerName + " ", messageLine.text, messageLine.cursorPosition) | ||
216 | // need to adjust cursor position by completer name length, '@' char and " " | 216 | // need to adjust cursor position by completer name length, '@' char and " " | ||
217 | messageLine.cursorPosition = oldCursorPosition + (messageLine.text.length - oldTextLength) | 217 | messageLine.cursorPosition = oldCursorPosition + (messageLine.text.length - oldTextLength) | ||
218 | } | 218 | } | ||
219 | popup.close() | 219 | popup.close() | ||
220 | } | 220 | } | ||
221 | Keys.onEscapePressed: { | 221 | Keys.onEscapePressed: { | ||
222 | if (popup.visible) { | 222 | if (popup.visible) { | ||
223 | popup.close() | 223 | popup.close() | ||
Show All 11 Lines |