Repository navigation
Expand file tree
/
Copy pathBarWidget.qml
More file actions
69 lines (57 loc) · 1.8 KB
/
Copy pathBarWidget.qml
File metadata and controls
69 lines (57 loc) · 1.8 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
import QtQuick
import qs.Ui
BarWidget {
id: root
moduleName: "io.github.kitsunesemcalda.feader-rss"
function injectPanel() {
if (!panelLoader.item) return
panelLoader.item.bar = root.bar
panelLoader.item.settings = root.settings
panelLoader.item.anchorItem = button
panelLoader.item.hostWidget = root
}
readonly property bool opened: panelLoader.item ? panelLoader.item.opened : false
function open() {
if (panelLoader.item) panelLoader.item.openFromHotkey()
}
function close() {
if (panelLoader.item) panelLoader.item.close()
}
function toggle() {
if (panelLoader.item) panelLoader.item.toggle()
}
function closeForPopoutSwitch() {
if (panelLoader.item) panelLoader.item.closeForPopoutSwitch()
}
readonly property bool popoutSwitchClosing: panelLoader.item
? panelLoader.item.popoutSwitchClosing : false
implicitWidth: button.implicitWidth
implicitHeight: button.implicitHeight
onBarChanged: injectPanel()
onSettingsChanged: injectPanel()
Loader {
id: panelLoader
active: true
source: Qt.resolvedUrl("Panel.qml")
visible: false
onLoaded: {
root.injectPanel()
Qt.callLater(root.injectPanel)
}
}
BarIconButton {
id: button
anchors.fill: parent
bar: root.bar
text: panelLoader.item ? panelLoader.item.label : ""
active: panelLoader.item ? panelLoader.item.unreadCount > 0 : false
tooltipText: panelLoader.item ? panelLoader.item.unreadSummary
+ "\nClick open · middle refresh · right first unread" : "Feader RSS"
onPressed: function(buttonCode) {
if (!panelLoader.item) return
if (buttonCode === Qt.MiddleButton) panelLoader.item.refresh()
else if (buttonCode === Qt.RightButton) panelLoader.item.openAllUnread()
else panelLoader.item.toggle()
}
}
}