Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TalkReplyTextField.qml « tray « gui « src - github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 807876f8f490e7856bbcfb568c8bb3ea9e365cdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import QtQuick 2.15
import Style 1.0
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import com.nextcloud.desktopclient 1.0

Item {
    id: root

    function sendReplyMessage() {
        if (replyMessageTextField.text === "") {
            return;
        }

        UserModel.currentUser.sendReplyMessage(model.conversationToken, replyMessageTextField.text, model.messageId);
        replyMessageSent.text = replyMessageTextField.text;
        replyMessageTextField.clear();
    }

    Text {
        id: replyMessageSent
        font.pixelSize: Style.topLinePixelSize
        color: Style.menuBorder
        visible: replyMessageSent.text !== ""
    }

    TextField {
        id: replyMessageTextField

        // TODO use Layout to manage width/height. The Layout.minimunWidth does not apply to the width set.
        height: 38
        width: 250

        onAccepted: root.sendReplyMessage()
        visible: replyMessageSent.text === ""

        topPadding: 4
        leftPadding: 12

        placeholderText: qsTr("Reply to …")

        background: Rectangle {
            id: replyMessageTextFieldBorder
            radius: 24
            border.width: 1
            border.color: Style.ncBlue
        }

        Button {
            id: sendReplyMessageButton  
            width: 32
            height: parent.height
            opacity: 0.8
            flat: true
            enabled: replyMessageTextField.text !== ""
            onClicked: root.sendReplyMessage()

            icon {
                source: "image://svgimage-custom-color/send.svg" + "/" + Style.ncBlue
                width: 38
                height: 38
                color: hovered || !sendReplyMessageButton.enabled? Style.menuBorder : Style.ncBlue
            }

            anchors {
                right: replyMessageTextField.right
                top: replyMessageTextField.top
            }

            ToolTip {
                visible: sendReplyMessageButton.hovered
                delay: Qt.styleHints.mousePressAndHoldInterval
                text:  qsTr("Send reply to chat message")
            }
        }
    }
}