Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F44113552
D288.1771897106.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D288.1771897106.diff
View Options
diff --git a/src/contents/ui/SendMessageBox.qml b/src/contents/ui/SendMessageBox.qml
--- a/src/contents/ui/SendMessageBox.qml
+++ b/src/contents/ui/SendMessageBox.qml
@@ -112,147 +112,155 @@
}
RowLayout {
- TextArea {
- id: textArea
- objectName: 'draftMessage'
- property var shortcutList: ["Ctrl+Return", "Ctrl+Enter"]
- property var inhibitTyping: false
- placeholderText: l10n.get('send-message-box-input-placeholder')
- property string filter: getFilter()
+ ScrollView{
+
Layout.fillWidth: true
- wrapMode: TextEdit.Wrap
- persistentSelection: true
- onTextChanged: {
- room.setLocalDraft(text);
- if (!inhibitTyping) {
- room.setTyping(true);
+ ScrollBar.vertical.policy: ScrollBar.AsNeeded
+ Layout.preferredHeight: textArea.implicitHeight
+ Layout.maximumHeight: Kirigami.Units.gridUnit * 8
+
+ TextArea {
+ id: textArea
+ objectName: 'draftMessage'
+ property var shortcutList: ["Ctrl+Return", "Ctrl+Enter"]
+ property var inhibitTyping: false
+ placeholderText: l10n.get('send-message-box-input-placeholder')
+ property string filter: getFilter()
+ Layout.fillWidth: true
+ wrapMode: TextEdit.Wrap
+ persistentSelection: true
+ onTextChanged: {
+ room.setLocalDraft(text);
+ if (!inhibitTyping) {
+ room.setTyping(true);
+ }
+ inhibitTyping = false;
}
- inhibitTyping = false;
- }
- function changeText(newText, inhibitTyping) {
- textArea.inhibitTyping = inhibitTyping;
- textArea.text = newText;
- }
-
- onVisibleChanged: {
- if (!visible) {
- room.updateLocalDraftNow();
+ function changeText(newText, inhibitTyping) {
+ textArea.inhibitTyping = inhibitTyping;
+ textArea.text = newText;
}
- }
- function getFilter() {
- const atPos = text.lastIndexOf('@', cursorPosition);
- if (atPos < 0) {
- return '';
+ onVisibleChanged: {
+ if (!visible) {
+ room.updateLocalDraftNow();
+ }
}
- const textInBetween = text.slice(atPos, cursorPosition);
- const hasSpaces = /\s/.test(textInBetween);
- return hasSpaces ? '' : textInBetween;
- }
-
- function removePartialMention() {
- const atPos = text.lastIndexOf('@', cursorPosition);
- text = text.slice(0, atPos) + text.slice(cursorPosition);
- cursorPosition = atPos;
- }
+ function getFilter() {
+ const atPos = text.lastIndexOf('@', cursorPosition);
+ if (atPos < 0) {
+ return '';
+ }
- onFilterChanged: {
- sendMessageBox.members.filter = filter.slice(1);
- if (filter && sendMessageBox.members.count > 0) {
- completionPopup.open();
- } else {
- completionPopup.close();
+ const textInBetween = text.slice(atPos, cursorPosition);
+ const hasSpaces = /\s/.test(textInBetween);
+ return hasSpaces ? '' : textInBetween;
}
- }
- // Shortcut keys for sending messages (TODO: Shortcut keys customized by the user)
- Shortcut {
- sequences: textArea.shortcutList
- onActivated: {
- sendAction.trigger()
+ function removePartialMention() {
+ const atPos = text.lastIndexOf('@', cursorPosition);
+ text = text.slice(0, atPos) + text.slice(cursorPosition);
+ cursorPosition = atPos;
}
- }
- DropArea {
- anchors.fill: parent
- onDropped: (drag) => {
- if (drag.hasUrls) {
- confirmUploadPopup.call(drag.urls);
+ onFilterChanged: {
+ sendMessageBox.members.filter = filter.slice(1);
+ if (filter && sendMessageBox.members.count > 0) {
+ completionPopup.open();
+ } else {
+ completionPopup.close();
}
}
- }
- function handlePaste() {
- if (MK.KazvClipboard.hasUrls) {
- confirmUploadPopup.call(MK.KazvClipboard.urls());
- } else if (MK.KazvClipboard.hasImage) {
- confirmUploadPopup.call([ MK.KazvClipboard.saveClipboardImage() ]);
- } else {
- textArea.paste();
- }
- }
- Keys.onPressed: (event) => {
- if (event.matches(StandardKey.Paste)) {
- textArea.handlePaste();
- event.accepted = true;
+ // Shortcut keys for sending messages (TODO: Shortcut keys customized by the user)
+ Shortcut {
+ sequences: textArea.shortcutList
+ onActivated: {
+ sendAction.trigger()
+ }
}
- }
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.RightButton
- preventStealing: true
- cursorShape: Qt.IBeamCursor
- onClicked: (mouse) => {
- if (mouse.button === Qt.RightButton)
- textAreaMenu.popup();
+ DropArea {
+ anchors.fill: parent
+ onDropped: (drag) => {
+ if (drag.hasUrls) {
+ confirmUploadPopup.call(drag.urls);
+ }
+ }
}
- Menu {
- id: textAreaMenu
- MenuItem {
- text: l10n.get("action-undo")
- icon.name: "edit-undo"
- onTriggered: textArea.undo()
- enabled: textArea.canUndo
- }
- MenuItem {
- text: l10n.get("action-redo")
- icon.name: "edit-redo"
- onTriggered: textArea.redo()
- enabled: textArea.canRedo
- }
- MenuSeparator {}
- MenuItem {
- text: l10n.get("action-cut")
- icon.name: "edit-cut"
- onTriggered: textArea.cut()
- enabled: !!textArea.selectedText
+ function handlePaste() {
+ if (MK.KazvClipboard.hasUrls) {
+ confirmUploadPopup.call(MK.KazvClipboard.urls());
+ } else if (MK.KazvClipboard.hasImage) {
+ confirmUploadPopup.call([ MK.KazvClipboard.saveClipboardImage() ]);
+ } else {
+ textArea.paste();
}
- MenuItem {
- text: l10n.get("action-copy")
- icon.name: "edit-copy"
- onTriggered: textArea.copy()
- enabled: !!textArea.selectedText
- }
- MenuItem {
- text: l10n.get("action-paste")
- icon.name: "edit-paste"
- onTriggered: textArea.handlePaste()
- enabled: textArea.canPaste || MK.KazvClipboard.hasImage || MK.KazvClipboard.hasUrls
+ }
+ Keys.onPressed: (event) => {
+ if (event.matches(StandardKey.Paste)) {
+ textArea.handlePaste();
+ event.accepted = true;
}
- MenuItem {
- text: l10n.get("action-delete")
- icon.name: "edit-delete"
- onTriggered: textArea.remove(textArea.selectionStart, textArea.selectionEnd)
- enabled: !!textArea.selectedText
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+ preventStealing: true
+ cursorShape: Qt.IBeamCursor
+ onClicked: (mouse) => {
+ if (mouse.button === Qt.RightButton)
+ textAreaMenu.popup();
}
- MenuItem {
- text: l10n.get("action-select-all")
- icon.name: "edit-select-all"
- onTriggered: textArea.selectAll()
+
+ Menu {
+ id: textAreaMenu
+ MenuItem {
+ text: l10n.get("action-undo")
+ icon.name: "edit-undo"
+ onTriggered: textArea.undo()
+ enabled: textArea.canUndo
+ }
+ MenuItem {
+ text: l10n.get("action-redo")
+ icon.name: "edit-redo"
+ onTriggered: textArea.redo()
+ enabled: textArea.canRedo
+ }
+ MenuSeparator {}
+ MenuItem {
+ text: l10n.get("action-cut")
+ icon.name: "edit-cut"
+ onTriggered: textArea.cut()
+ enabled: !!textArea.selectedText
+ }
+ MenuItem {
+ text: l10n.get("action-copy")
+ icon.name: "edit-copy"
+ onTriggered: textArea.copy()
+ enabled: !!textArea.selectedText
+ }
+ MenuItem {
+ text: l10n.get("action-paste")
+ icon.name: "edit-paste"
+ onTriggered: textArea.handlePaste()
+ enabled: textArea.canPaste || MK.KazvClipboard.hasImage || MK.KazvClipboard.hasUrls
+ }
+ MenuItem {
+ text: l10n.get("action-delete")
+ icon.name: "edit-delete"
+ onTriggered: textArea.remove(textArea.selectionStart, textArea.selectionEnd)
+ enabled: !!textArea.selectedText
+ }
+ MenuItem {
+ text: l10n.get("action-select-all")
+ icon.name: "edit-select-all"
+ onTriggered: textArea.selectAll()
+ }
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 23, 5:38 PM (17 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128669
Default Alt Text
D288.1771897106.diff (9 KB)
Attached To
Mode
D288: Make SendMessageBox Scrollable and limited in height
Attached
Detach File
Event Timeline
Log In to Comment