Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up TalkReplyTextField, remove unnecessary parent Item #4790

Merged
merged 2 commits into from
Aug 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 38 additions & 51 deletions src/gui/tray/TalkReplyTextField.qml
Original file line number Diff line number Diff line change
@@ -1,71 +1,58 @@
import QtQuick 2.15
import Style 1.0
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

import com.nextcloud.desktopclient 1.0
import Style 1.0

Item {
id: root
TextField {
id: replyMessageTextField

signal sendReply(string reply)
function sendReplyMessage() { if (text !== "") sendReply(text) }

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

root.sendReply(replyMessageTextField.text);
}

TextField {
id: replyMessageTextField
height: Style.talkReplyTextFieldPreferredHeight
visible: model.messageSent === ""
color: Style.ncTextColor
placeholderText: qsTr("Reply to …")

height: Style.talkReplyTextFieldPreferredHeight
onAccepted: sendReplyMessage()

anchors.fill: parent
background: Rectangle {
id: replyMessageTextFieldBorder
radius: width / 2
border.width: Style.normalBorderWidth
border.color: replyMessageTextField.activeFocus ? UserModel.currentUser.accentColor : Style.menuBorder
color: Style.backgroundColor
}

visible: model.messageSent === ""
Button {
id: sendReplyMessageButton

color: Style.ncTextColor
placeholderText: qsTr("Reply to …")
width: Style.talkReplyTextFieldPreferredWidth * 0.12
height: parent.height

onAccepted: root.sendReplyMessage()
opacity: 0.8
flat: true
enabled: replyMessageTextField.text !== ""
onClicked: replyMessageTextField.sendReplyMessage()
background: null

background: Rectangle {
id: replyMessageTextFieldBorder
radius: 24
border.width: 1
border.color: parent.activeFocus ? UserModel.currentUser.accentColor : Style.menuBorder
color: Style.backgroundColor
icon {
source: "image://svgimage-custom-color/send.svg" + "/" + Style.menuBorder
color: hovered || !sendReplyMessageButton.enabled ? Style.menuBorder : UserModel.currentUser.accentColor
}

Button {
id: sendReplyMessageButton

width: Style.talkReplyTextFieldPreferredWidth * 0.12
height: parent.height

opacity: 0.8
flat: true
enabled: replyMessageTextField.text !== ""
onClicked: root.sendReplyMessage()
background: null

icon {
source: "image://svgimage-custom-color/send.svg" + "/" + Style.menuBorder
color: hovered || !sendReplyMessageButton.enabled? Style.menuBorder : UserModel.currentUser.accentColor
}

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

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