mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 13:56:10 +00:00
e13726e4af
- rework the way social links are displayed/editted; we now only allow to enter a so called "handle" and then substitute that in the final URL template - move the "icon" model role to NIM backend This has several advantages: - we display only the "handle" and don't have to elide some long URL - we won't let users enter random URLs into their profile and spoof the viewing part into clicking it Additionally, make the social link "button" clickable -> navigate to the target URL, and make the tooltip behave as "usual" (on mouse hover).
64 lines
1.3 KiB
QML
64 lines
1.3 KiB
QML
import QtQuick 2.14
|
|
import QtQuick.Layouts 1.14
|
|
|
|
import utils 1.0
|
|
|
|
import StatusQ.Core 0.1
|
|
import StatusQ.Core.Theme 0.1
|
|
import StatusQ.Controls 0.1
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
property string text
|
|
property string url
|
|
property int linkType: 1
|
|
property string icon
|
|
|
|
implicitWidth: layout.implicitWidth + 16
|
|
implicitHeight: layout.implicitHeight + 10
|
|
|
|
color: "transparent"
|
|
border {
|
|
width: 1
|
|
color: Theme.palette.baseColor2
|
|
}
|
|
radius: height/2
|
|
|
|
RowLayout {
|
|
id: layout
|
|
|
|
anchors.centerIn: parent
|
|
|
|
StatusIcon {
|
|
Layout.preferredWidth: 20
|
|
Layout.preferredHeight: 20
|
|
icon: root.icon
|
|
visible: icon !== ""
|
|
color: Theme.palette.directColor1
|
|
}
|
|
|
|
StatusBaseText {
|
|
Layout.maximumWidth: 150
|
|
text: root.text
|
|
color: Theme.palette.directColor4
|
|
font.weight: Font.Medium
|
|
elide: Text.ElideMiddle
|
|
}
|
|
}
|
|
|
|
StatusToolTip {
|
|
id: toolTip
|
|
text: root.url
|
|
visible: mouseArea.containsMouse
|
|
}
|
|
|
|
MouseArea {
|
|
id: mouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: Global.openLink(root.url)
|
|
}
|
|
}
|