Skip to content

Commit 098bb9a

Browse files
author
luginf
committed
fix format with qmlformat
1 parent 2009bbf commit 098bb9a

3 files changed

Lines changed: 159 additions & 139 deletions

File tree

zettelkasten/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,7 @@ All settings are accessible in *Settings → Scripting → Zettelkasten*:
7474
| ID generation format | `%Y%M%D%h%m%s` | Format string for new IDs |
7575
| ID detection pattern | `\d{14}` | ECMAScript regex to locate IDs in filenames and content |
7676
| Auto-repair backlinks on note open | enabled | Automatically fix stale backlinks when a note with a ZK ID is opened |
77+
78+
79+
fix with qmlformat
80+

zettelkasten/ZkLinkDialog.qml

Lines changed: 83 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,35 @@ Window {
1515
signal linkSelected(string linkTarget, string zkId)
1616
property var filtered: []
1717

18-
SystemPalette { id: pal }
18+
SystemPalette {
19+
id: pal
20+
}
1921

2022
Component.onCompleted: {
2123
applyFilter();
2224
searchInput.forceActiveFocus();
2325
}
2426

2527
// ── Search field ──────────────────────────────────────────────────────────
26-
2728
Rectangle {
2829
id: searchBox
29-
anchors { top: parent.top; left: parent.left; right: parent.right; margins: 10 }
30+
anchors {
31+
top: parent.top
32+
left: parent.left
33+
right: parent.right
34+
margins: 10
35+
}
3036
height: 30
3137
radius: 3
3238
color: pal.base
3339
border.color: searchInput.activeFocus ? "#1cb27e" : pal.mid
3440
border.width: 1
3541

3642
Text {
37-
anchors { fill: parent; leftMargin: 8 }
43+
anchors {
44+
fill: parent
45+
leftMargin: 8
46+
}
3847
verticalAlignment: Text.AlignVCenter
3948
text: "Filter by name…"
4049
color: pal.mid
@@ -44,26 +53,32 @@ Window {
4453

4554
TextInput {
4655
id: searchInput
47-
anchors { fill: parent; margins: 8 }
56+
anchors {
57+
fill: parent
58+
margins: 8
59+
}
4860
verticalAlignment: TextInput.AlignVCenter
4961
font.pixelSize: 13
5062
color: pal.text
5163
clip: true
5264
onTextChanged: applyFilter()
5365
Keys.onReturnPressed: acceptSelection()
5466
Keys.onDownPressed: moveSelection(1)
55-
Keys.onUpPressed: moveSelection(-1)
67+
Keys.onUpPressed: moveSelection(-1)
5668
}
5769
}
5870

5971
// ── Note list ─────────────────────────────────────────────────────────────
60-
6172
Rectangle {
6273
id: listBox
6374
anchors {
64-
top: searchBox.bottom; topMargin: 6
65-
left: parent.left; right: parent.right; margins: 10
66-
bottom: bottomBar.top; bottomMargin: 6
75+
top: searchBox.bottom
76+
topMargin: 6
77+
left: parent.left
78+
right: parent.right
79+
margins: 10
80+
bottom: bottomBar.top
81+
bottomMargin: 6
6782
}
6883
radius: 3
6984
color: pal.base
@@ -73,7 +88,11 @@ Window {
7388

7489
ListView {
7590
id: resultList
76-
anchors { fill: parent; margins: 1; rightMargin: scrollBar.visible ? 8 : 1 }
91+
anchors {
92+
fill: parent
93+
margins: 1
94+
rightMargin: scrollBar.visible ? 8 : 1
95+
}
7796
model: filtered
7897
currentIndex: 0
7998
clip: true
@@ -85,15 +104,14 @@ Window {
85104

86105
Rectangle {
87106
anchors.fill: parent
88-
color: index === resultList.currentIndex
89-
? "#1cb27e"
90-
: (rowMouse.containsMouse ? "#e4f5ef" : "transparent")
107+
color: index === resultList.currentIndex ? "#1cb27e" : (rowMouse.containsMouse ? "#e4f5ef" : "transparent")
91108
}
92109

93110
Text {
94111
anchors {
95112
verticalCenter: parent.verticalCenter
96-
left: parent.left; right: parent.right
113+
left: parent.left
114+
right: parent.right
97115
margins: 8
98116
}
99117
text: modelData.label
@@ -106,7 +124,7 @@ Window {
106124
id: rowMouse
107125
anchors.fill: parent
108126
hoverEnabled: true
109-
onClicked: resultList.currentIndex = index
127+
onClicked: resultList.currentIndex = index
110128
onDoubleClicked: acceptSelection()
111129
}
112130
}
@@ -117,18 +135,20 @@ Window {
117135
id: scrollBar
118136
visible: resultList.contentHeight > resultList.height
119137
width: 5
120-
anchors { right: parent.right; top: parent.top; bottom: parent.bottom; margins: 1 }
138+
anchors {
139+
right: parent.right
140+
top: parent.top
141+
bottom: parent.bottom
142+
margins: 1
143+
}
121144
color: "transparent"
122145

123146
Rectangle {
124147
width: parent.width
125148
radius: 2
126149
color: pal.mid
127150
height: Math.max(24, resultList.height * resultList.height / Math.max(resultList.contentHeight, 1))
128-
y: resultList.height > 0
129-
? resultList.contentY / Math.max(resultList.contentHeight - resultList.height, 1)
130-
* (resultList.height - height)
131-
: 0
151+
y: resultList.height > 0 ? resultList.contentY / Math.max(resultList.contentHeight - resultList.height, 1) * (resultList.height - height) : 0
132152
}
133153
}
134154

@@ -142,14 +162,21 @@ Window {
142162
}
143163

144164
// ── Bottom bar ────────────────────────────────────────────────────────────
145-
146165
Item {
147166
id: bottomBar
148-
anchors { bottom: parent.bottom; left: parent.left; right: parent.right; margins: 10 }
167+
anchors {
168+
bottom: parent.bottom
169+
left: parent.left
170+
right: parent.right
171+
margins: 10
172+
}
149173
height: 34
150174

151175
Text {
152-
anchors { verticalCenter: parent.verticalCenter; left: parent.left }
176+
anchors {
177+
verticalCenter: parent.verticalCenter
178+
left: parent.left
179+
}
153180
text: filtered.length + " note(s)"
154181
color: pal.mid
155182
font.pixelSize: 12
@@ -158,27 +185,50 @@ Window {
158185
// Cancel
159186
Rectangle {
160187
id: cancelBtn
161-
anchors { verticalCenter: parent.verticalCenter; right: insertBtn.left; rightMargin: 8 }
162-
width: 76; height: 26
188+
anchors {
189+
verticalCenter: parent.verticalCenter
190+
right: insertBtn.left
191+
rightMargin: 8
192+
}
193+
width: 76
194+
height: 26
163195
radius: 4
164196
color: cancelMouse.pressed ? pal.dark : pal.button
165197
border.color: pal.mid
166198
border.width: 1
167199

168-
Text { anchors.centerIn: parent; text: "Cancel"; color: pal.buttonText; font.pixelSize: 13 }
169-
MouseArea { id: cancelMouse; anchors.fill: parent; onClicked: root.close() }
200+
Text {
201+
anchors.centerIn: parent
202+
text: "Cancel"
203+
color: pal.buttonText
204+
font.pixelSize: 13
205+
}
206+
MouseArea {
207+
id: cancelMouse
208+
anchors.fill: parent
209+
onClicked: root.close()
210+
}
170211
}
171212

172213
// Insert
173214
Rectangle {
174215
id: insertBtn
175-
anchors { verticalCenter: parent.verticalCenter; right: parent.right }
176-
width: 76; height: 26
216+
anchors {
217+
verticalCenter: parent.verticalCenter
218+
right: parent.right
219+
}
220+
width: 76
221+
height: 26
177222
radius: 4
178223
opacity: (resultList.currentIndex >= 0 && filtered.length > 0) ? 1.0 : 0.4
179224
color: insertMouse.pressed ? "#15896b" : "#1cb27e"
180225

181-
Text { anchors.centerIn: parent; text: "Insert"; color: "white"; font.pixelSize: 13 }
226+
Text {
227+
anchors.centerIn: parent
228+
text: "Insert"
229+
color: "white"
230+
font.pixelSize: 13
231+
}
182232
MouseArea {
183233
id: insertMouse
184234
anchors.fill: parent
@@ -189,7 +239,6 @@ Window {
189239
}
190240

191241
// ── Logic ─────────────────────────────────────────────────────────────────
192-
193242
function moveSelection(delta) {
194243
var next = resultList.currentIndex + delta;
195244
if (next >= 0 && next < resultList.count)
@@ -209,7 +258,8 @@ Window {
209258

210259
function acceptSelection() {
211260
var idx = resultList.currentIndex;
212-
if (idx < 0 || idx >= filtered.length) return;
261+
if (idx < 0 || idx >= filtered.length)
262+
return;
213263
linkSelected(filtered[idx].linkTarget, filtered[idx].zkId);
214264
root.close();
215265
}

0 commit comments

Comments
 (0)