Skip to content
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
46 changes: 41 additions & 5 deletions src/gui/tray/CurrentAccountHeaderButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -123,27 +123,63 @@ Button {
id: addAccountButton
hoverEnabled: true
visible: Systray.enableAddAccount
height: visible ? implicitHeight : 0
enabled: visible
implicitHeight: Style.trayWindowHeaderHeight

readonly property real addAccountIconSize: Style.accountAvatarSize * Style.smallIconScaleFactor
readonly property real addAccountHorizontalOffset: ( (Style.accountAvatarSize - addAccountIconSize) / 2 ) + Style.accountIconsMenuMargin
readonly property string addAccountIconSource: "image://svgimage-custom-color/add.svg/" + iconColor
property var iconColor: !addAccountButton.enabled
? addAccountButton.palette.mid
: ((addAccountButton.highlighted || addAccountButton.down) && Qt.platform.os !== "windows"
? addAccountButton.palette.highlightedText
: addAccountButton.palette.text)

icon.source: "image://svgimage-custom-color/add.svg/" + iconColor
icon.width: addAccountIconSize
icon.height: addAccountIconSize
leftPadding: addAccountHorizontalOffset
spacing: Style.userLineSpacing
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
text: qsTr("Add account")
onClicked: UserModel.addAccount()

Accessible.role: Accessible.MenuItem
Accessible.name: qsTr("Add new account")
Accessible.onPressAction: addAccountButton.clicked()

contentItem: Item {
implicitHeight: Style.trayWindowHeaderHeight
implicitWidth: addAccountButton.addAccountHorizontalOffset
+ addAccountButton.addAccountIconSize
+ Style.userLineSpacing
+ addAccountLabel.implicitWidth

RowLayout {
anchors.fill: parent
anchors.leftMargin: addAccountButton.addAccountHorizontalOffset
spacing: Style.userLineSpacing

Image {
source: addAccountButton.addAccountIconSource
sourceSize.width: addAccountButton.addAccountIconSize
sourceSize.height: addAccountButton.addAccountIconSize
Layout.preferredWidth: addAccountButton.addAccountIconSize
Layout.preferredHeight: addAccountButton.addAccountIconSize
Layout.alignment: Qt.AlignVCenter
}

Text {
id: addAccountLabel
text: addAccountButton.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
font: addAccountButton.font
Layout.alignment: Qt.AlignVCenter
color: addAccountButton.iconColor
}
}
}
}

MenuSeparator {}
Expand Down
Loading