Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/main.qml
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 33 | MouseEventListener { | |||
---|---|---|---|---|---|
48 | property int layoutSpacing: UiProperties.layoutSpacing | 48 | property int layoutSpacing: UiProperties.layoutSpacing | ||
49 | 49 | | |||
50 | property real globalProgress: 0 | 50 | property real globalProgress: 0 | ||
51 | 51 | | |||
52 | property Item notifications: notificationsLoader.item | 52 | property Item notifications: notificationsLoader.item | ||
53 | property Item jobs: jobsLoader.item | 53 | property Item jobs: jobsLoader.item | ||
54 | 54 | | |||
55 | //notifications + jobs | 55 | //notifications + jobs | ||
56 | property int totalCount: (notifications ? notifications.count : 0) + (jobs ? jobs.count : 0) | 56 | property int activeItemsCount: (notifications ? notifications.count : 0) + (jobs ? jobs.count : 0) | ||
57 | property int totalCount: activeItemsCount + (notifications ? notifications.historyCount : 0) | ||||
davidedmundson: This is now a somewhat confusing name as it's not the total.
Then you have the real total… | |||||
57 | 58 | | |||
58 | property Item notificationIcon | 59 | property Item notificationIcon | ||
59 | 60 | | |||
60 | Plasmoid.switchWidth: units.gridUnit * 20 | 61 | Plasmoid.switchWidth: units.gridUnit * 20 | ||
61 | Plasmoid.switchHeight: units.gridUnit * 30 | 62 | Plasmoid.switchHeight: units.gridUnit * 30 | ||
62 | 63 | | |||
63 | Plasmoid.status: totalCount > 0 ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus | 64 | Plasmoid.status: activeItemsCount > 0 ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus | ||
64 | 65 | | |||
65 | Plasmoid.icon: { | 66 | Plasmoid.icon: { | ||
66 | if (jobs && jobs.count) { | 67 | if (jobs && jobs.count) { | ||
67 | return "notification-active" | 68 | return "notification-active" | ||
68 | } | 69 | } | ||
69 | return totalCount ? "notification-inactive" : "notification-disabled" | 70 | return activeItemsCount ? "notification-inactive" : "notification-disabled" | ||
70 | } | 71 | } | ||
71 | 72 | | |||
72 | Plasmoid.toolTipSubText: { | 73 | Plasmoid.toolTipSubText: { | ||
73 | if (totalCount == 0) { | 74 | if (activeItemsCount == 0) { | ||
74 | return i18n("No notifications or jobs") | 75 | return i18n("No notifications or jobs") | ||
75 | } else if (!notifications || !notifications.count) { | 76 | } else if (!notifications || !notifications.count) { | ||
76 | return i18np("%1 running job", "%1 running jobs", jobs.count) | 77 | return i18np("%1 running job", "%1 running jobs", jobs.count) | ||
77 | } else if (!jobs || !jobs.count) { | 78 | } else if (!jobs || !jobs.count) { | ||
78 | return i18np("%1 notification", "%1 notifications", notifications.count) | 79 | return i18np("%1 notification", "%1 notifications", notifications.count) | ||
79 | } else { | 80 | } else { | ||
80 | return i18np("%1 running job", "%1 running jobs", jobs.count) + "\n" + i18np("%1 notification", "%1 notifications", notifications.count) | 81 | return i18np("%1 running job", "%1 running jobs", jobs.count) + "\n" + i18np("%1 notification", "%1 notifications", notifications.count) | ||
81 | } | 82 | } | ||
82 | } | 83 | } | ||
83 | 84 | | |||
84 | Plasmoid.compactRepresentation: Component { | 85 | Plasmoid.compactRepresentation: Component { | ||
85 | NotificationIcon { | 86 | NotificationIcon { | ||
86 | id: notificationIcon | 87 | id: notificationIcon | ||
87 | Component.onCompleted: notificationsApplet.notificationIcon = notificationIcon | 88 | Component.onCompleted: notificationsApplet.notificationIcon = notificationIcon | ||
88 | } | 89 | } | ||
89 | } | 90 | } | ||
90 | 91 | | |||
91 | state: "default" | 92 | state: "default" | ||
92 | hoverEnabled: !UiProperties.touchInput | 93 | hoverEnabled: !UiProperties.touchInput | ||
93 | 94 | | |||
94 | onTotalCountChanged: { | 95 | onActiveItemsCountChanged: { | ||
95 | print(" totalCountChanged " + totalCount) | 96 | print(" activeItemsCountChanged " + activeItemsCount) | ||
96 | if (totalCount > 0) { | 97 | if (activeItemsCount > 0) { | ||
97 | state = "new-notifications" | 98 | state = "new-notifications" | ||
98 | } else { | 99 | } else { | ||
99 | state = "default" | 100 | state = "default" | ||
100 | //plasmoid.hidePopup() | 101 | //plasmoid.hidePopup() | ||
101 | plasmoid.expanded = false; | 102 | plasmoid.expanded = false; | ||
102 | } | 103 | } | ||
103 | } | 104 | } | ||
104 | 105 | | |||
Show All 37 Lines | 139 | Loader { | |||
142 | active: notificationsApplet.Plasmoid.configuration.showJobs | 143 | active: notificationsApplet.Plasmoid.configuration.showJobs | ||
143 | } | 144 | } | ||
144 | 145 | | |||
145 | Loader { | 146 | Loader { | ||
146 | id: notificationsLoader | 147 | id: notificationsLoader | ||
147 | width: parent.width | 148 | width: parent.width | ||
148 | source: "Notifications.qml" | 149 | source: "Notifications.qml" | ||
149 | active: notificationsApplet.Plasmoid.configuration.showNotifications | 150 | active: notificationsApplet.Plasmoid.configuration.showNotifications | ||
151 | onLoaded: { | ||||
152 | notificationsLoader.item.showHistory = Qt.binding(function(){ return notificationsApplet.Plasmoid.configuration.showHistory }) | ||||
153 | } | ||||
150 | } | 154 | } | ||
151 | } | 155 | } | ||
152 | } | 156 | } | ||
153 | 157 | | |||
154 | states: [ | 158 | states: [ | ||
155 | State { | 159 | State { | ||
156 | name: "underMouse" | 160 | name: "underMouse" | ||
157 | when: notificationsApplet.containsMouse | 161 | when: notificationsApplet.containsMouse | ||
Show All 36 Lines |
This is now a somewhat confusing name as it's not the total.
Then you have the real total under a new name property below.