11import QtQuick 2.15
22import QtQuick.Controls 2.3
3- import QtQuick.Layouts 1.15
43import Style 1.0
54import com.nextcloud.desktopclient 1.0
65
7- Item {
6+ AbstractButton {
87 id: root
98
10- property string text: " "
119 property string toolTipText: " "
1210
1311 property bool bold: false
@@ -18,49 +16,60 @@ Item {
1816 property color textColor: Style .ncTextColor
1917 property color textColorHovered: Style .ncSecondaryTextColor
2018
21- signal clicked ()
19+ property string verb: " "
20+ property bool primary: false
21+ property bool isTalkReplyButton: false
2222
23- Loader {
24- active: root .imageSource === " "
25-
26- anchors .fill : parent
27-
28- sourceComponent: CustomTextButton {
29- anchors .fill : parent
30- text: root .text
31- toolTipText: root .toolTipText
23+ background: NCButtonBackground {
24+ color: UserModel .currentUser .headerColor
25+ hovered: root .hovered
26+ visible: root .primary
27+ }
3228
33- textColor: root .textColor
34- textColorHovered: root .textColorHovered
29+ contentItem: Loader {
30+ id: contentItemLoader
31+ active: true
32+ sourceComponent: primary ? primaryButtonContent : textButtonContent
33+ }
3534
36- onClicked: root .clicked ()
35+ ToolTip {
36+ id: customTextButtonTooltip
37+ text: root .toolTipText
38+ delay: Qt .styleHints .mousePressAndHoldInterval
39+ visible: root .toolTipText !== " " && root .hovered
40+ contentItem: Label {
41+ text: customTextButtonTooltip .text
42+ color: Style .ncTextColor
43+ }
44+ background: Rectangle {
45+ border .color : Style .menuBorder
46+ color: Style .backgroundColor
3747 }
3848 }
3949
40- Loader {
41- active: root .imageSource !== " "
42-
43- anchors .fill : parent
44-
45- sourceComponent: CustomButton {
50+ Component {
51+ id: textButtonContent
52+ TextButtonContents {
4653 anchors .fill : parent
47- anchors .topMargin : Style .roundedButtonBackgroundVerticalMargins
48- anchors .bottomMargin : Style .roundedButtonBackgroundVerticalMargins
49-
54+ hovered: root .hovered
5055 text: root .text
51- toolTipText: root .toolTipText
52-
5356 textColor: root .textColor
5457 textColorHovered: root .textColorHovered
55-
5658 bold: root .bold
59+ }
60+ }
5761
58- imageSource: root .imageSource
62+ Component {
63+ id: primaryButtonContent
64+ NCButtonContents {
65+ anchors .fill : parent
66+ hovered: root .hovered
5967 imageSourceHover: root .imageSourceHover
60-
61- bgColor: UserModel .currentUser .headerColor
62-
63- onClicked: root .clicked ()
68+ imageSource: root .imageSource
69+ text: root .text
70+ textColor: root .textColor
71+ textColorHovered: root .textColorHovered
72+ bold: root .bold
6473 }
6574 }
6675}
0 commit comments