Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2577475
SendMessageBox.qml
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
SendMessageBox.qml
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2023 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import
QtQuick
2.15
import
QtQuick
.
Layouts
1.15
import
QtQuick
.
Controls
2.15
import
QtQuick
.
Dialogs
1.3
import
org
.
kde
.
kirigami
2.13
as
Kirigami
import
moe
.
kazv
.
mxc
.
kazv
0.0
as
MK
import
'.'
as
Kazv
ColumnLayout
{
id: sendMessageBox
property
var
room
property
var
draftReplyTo:
''
property
var
timeline:
room
.
timeline
()
onRoomChanged:
{
textArea
.
changeText
(
room
.
localDraft
,
true
);
}
ColumnLayout
{
visible:
!!
sendMessageBox
.
draftReplyTo
RowLayout
{
Label
{
Layout.fillWidth:
true
text:
l10n
.
get
(
'send-message-box-reply-to'
)
}
ToolButton
{
action:
removeReplyToAction
display:
AbstractButton
.
IconOnly
}
}
Kazv
.
EventViewWrapper
{
Layout.minimumHeight:
implicitHeight
Layout.fillWidth:
true
event:
room
.
messageById
(
sendMessageBox
.
draftReplyTo
)
compactMode:
true
}
}
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'
)
Layout.fillWidth:
true
wrapMode:
TextEdit
.
Wrap
onTextChanged:
{
room
.
setLocalDraft
(
text
);
if
(
!
inhibitTyping
)
{
room
.
setTyping
(
true
);
}
inhibitTyping
=
false
;
}
function
changeText
(
newText
,
inhibitTyping
)
{
textArea
.
inhibitTyping
=
inhibitTyping
;
textArea
.
text
=
newText
;
}
onVisibleChanged:
{
if
(
!
visible
)
{
room
.
updateLocalDraftNow
();
}
}
// Shortcut keys for sending messages (TODO: Shortcut keys customized by the user)
Shortcut
{
sequences:
textArea
.
shortcutList
onActivated:
{
sendAction
.
trigger
()
}
}
}
ToolButton
{
icon.name:
"document-send-symbolic"
onClicked:
sendMediaFileAction
.
trigger
()
}
ToolButton
{
icon.name:
"document-send"
onClicked:
sendAction
.
trigger
()
}
}
Kirigami
.
Action
{
id: removeReplyToAction
iconName:
'window-close-symbolic'
text:
l10n
.
get
(
'send-message-box-remove-reply-to-action'
)
onTriggered:
{
sendMessageBox
.
draftReplyTo
=
''
;
}
}
Kirigami
.
Action
{
id: sendAction
iconName:
"document-send"
text:
l10n
.
get
(
"send-message-box-send"
)
onTriggered:
{
room
.
setTyping
(
false
);
room
.
sendTextMessage
(
textArea
.
text
,
draftReplyTo
);
textArea
.
changeText
(
""
,
true
);
draftReplyTo
=
''
;
}
}
Kirigami
.
Action
{
id:sendMediaFileAction
iconName:
"mail-attachment-symbolic"
text:
l10n
.
get
(
"send-message-box-send-file"
)
onTriggered:
{
fileDialog
.
open
()
}
}
property
var
fileDialog:
FileDialog
{
onAccepted:
{
kazvIOManager
.
startNewUploadJob
(
matrixSdk
.
serverUrl
,
fileUrl
,
matrixSdk
.
token
,
room
.
roomId
,
sdkVars
.
roomList
,
room
.
encrypted
)
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jun 24, 8:00 AM (1 d, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
234768
Default Alt Text
SendMessageBox.qml (3 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment