Repository navigation
Expand file tree
/
Copy pathResultRow.qml
More file actions
120 lines (103 loc) · 3.02 KB
/
Copy pathResultRow.qml
File metadata and controls
120 lines (103 loc) · 3.02 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import QtQuick
import qs.Ui
import qs.Commons
CursorSurface {
id: root
property var bar: null
required property string bookmarkId
required property string bookmarkTitle
required property string bookmarkUrl
required property string bookmarkDomain
required property string bookmarkDescription
required property string bookmarkNote
required property string bookmarkImageUrl
required property string bookmarkFolderName
required property var bookmarkTagNames
required property string bookmarkCreatedAt
signal openRequested(string url)
signal cursorRequested()
readonly property color fg: bar ? bar.foreground : Color.foreground
readonly property string family: bar ? bar.fontFamily : Style.font.family
implicitHeight: row.implicitHeight + Style.space(16)
function displayTags() {
if (!bookmarkTagNames || bookmarkTagNames.length === 0) return "";
var tags = [];
var limit = Math.min(bookmarkTagNames.length, 3);
for (var i = 0; i < limit; i++) {
tags.push(bookmarkTagNames[i]);
}
if (bookmarkTagNames.length > 3) {
tags.push("+" + (bookmarkTagNames.length - 3));
}
return tags.join(", ");
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onContainsMouseChanged: if (containsMouse) root.cursorRequested()
onClicked: root.openRequested(root.bookmarkUrl)
}
Row {
id: row
anchors.fill: parent
anchors.margins: Style.space(8)
spacing: Style.space(10)
Rectangle {
width: 24
height: 24
radius: 4
color: Color.muted
anchors.verticalCenter: parent.verticalCenter
Text {
anchors.centerIn: parent
text: root.bookmarkDomain.charAt(0).toUpperCase()
font.family: root.family
font.pixelSize: 12
font.bold: true
color: root.fg
textFormat: Text.PlainText
}
}
Column {
width: parent.width - 24 - Style.space(10)
spacing: 2
Text {
width: parent.width
text: root.bookmarkTitle || root.bookmarkDomain
font.family: root.family
font.pixelSize: Style.font.body
color: root.fg
elide: Text.ElideRight
maximumLineCount: 1
textFormat: Text.PlainText
}
Row {
spacing: Style.space(6)
Text {
text: root.bookmarkDomain
font.family: root.family
font.pixelSize: Style.font.caption
color: Color.muted
textFormat: Text.PlainText
}
Text {
visible: root.bookmarkFolderName.length > 0
text: "| " + root.bookmarkFolderName
font.family: root.family
font.pixelSize: Style.font.caption
color: Color.muted
textFormat: Text.PlainText
}
Text {
visible: displayTags().length > 0
text: "| " + displayTags()
font.family: root.family
font.pixelSize: Style.font.caption
color: Color.accent
textFormat: Text.PlainText
}
}
}
}
}