Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/main.qml
Show All 40 Lines | 34 | Item { | |||
---|---|---|---|---|---|
41 | 41 | | |||
42 | Plasmoid.toolTipSubText: { | 42 | Plasmoid.toolTipSubText: { | ||
43 | var lines = []; | 43 | var lines = []; | ||
44 | 44 | | |||
45 | if (historyModel.activeJobsCount > 0) { | 45 | if (historyModel.activeJobsCount > 0) { | ||
46 | lines.push(i18np("%1 running job", "%1 running jobs", historyModel.activeJobsCount)); | 46 | lines.push(i18np("%1 running job", "%1 running jobs", historyModel.activeJobsCount)); | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | if (!NotificationManager.Server.valid) { | ||||
50 | lines.push(i18n("Notification service not available")); | ||||
51 | } else { | ||||
49 | // Any notification that is newer than "lastRead" is "unread" | 52 | // Any notification that is newer than "lastRead" is "unread" | ||
50 | // since it doesn't know the popup is on screen which makes the user see it | 53 | // since it doesn't know the popup is on screen which makes the user see it | ||
51 | var actualUnread = historyModel.unreadNotificationsCount - Globals.popupNotificationsModel.activeNotificationsCount; | 54 | var actualUnread = historyModel.unreadNotificationsCount - Globals.popupNotificationsModel.activeNotificationsCount; | ||
52 | if (actualUnread > 0) { | 55 | if (actualUnread > 0) { | ||
53 | lines.push(i18np("%1 unread notification", "%1 unread notifications", actualUnread)); | 56 | lines.push(i18np("%1 unread notification", "%1 unread notifications", actualUnread)); | ||
54 | } | 57 | } | ||
55 | 58 | | |||
56 | if (Globals.inhibited) { | 59 | if (Globals.inhibited) { | ||
57 | var inhibitedUntil = notificationSettings.notificationsInhibitedUntil | 60 | var inhibitedUntil = notificationSettings.notificationsInhibitedUntil | ||
58 | var inhibitedUntilValid = !isNaN(inhibitedUntil.getTime()); | 61 | var inhibitedUntilValid = !isNaN(inhibitedUntil.getTime()); | ||
59 | 62 | | |||
60 | // TODO check app inhibition, too | 63 | // TODO check app inhibition, too | ||
61 | if (inhibitedUntilValid) { | 64 | if (inhibitedUntilValid) { | ||
62 | lines.push(i18n("Do not disturb until %1", | 65 | lines.push(i18n("Do not disturb until %1", | ||
63 | KCoreAddons.Format.formatRelativeDateTime(inhibitedUntil, Locale.ShortFormat))); | 66 | KCoreAddons.Format.formatRelativeDateTime(inhibitedUntil, Locale.ShortFormat))); | ||
64 | } | 67 | } | ||
65 | } else if (lines.length === 0) { | 68 | } else if (lines.length === 0) { | ||
66 | lines.push(i18n("No unread notifications")); | 69 | lines.push(i18n("No unread notifications")); | ||
67 | } | 70 | } | ||
71 | } | ||||
68 | 72 | | |||
69 | return lines.join("\n"); | 73 | return lines.join("\n"); | ||
70 | } | 74 | } | ||
71 | 75 | | |||
72 | Plasmoid.switchWidth: units.gridUnit * 14 | 76 | Plasmoid.switchWidth: units.gridUnit * 14 | ||
73 | // This is to let the plasmoid expand in a vertical panel for a "sidebar" notification panel | 77 | // This is to let the plasmoid expand in a vertical panel for a "sidebar" notification panel | ||
74 | // The CompactRepresentation size is limited to not have the notification icon grow gigantic | 78 | // The CompactRepresentation size is limited to not have the notification icon grow gigantic | ||
75 | // but it should still switch over to full rep once there's enough width (disregarding the limited height) | 79 | // but it should still switch over to full rep once there's enough width (disregarding the limited height) | ||
Show All 11 Lines | |||||
87 | 91 | | |||
88 | Plasmoid.compactRepresentation: CompactRepresentation { | 92 | Plasmoid.compactRepresentation: CompactRepresentation { | ||
89 | activeCount: Globals.popupNotificationsModel.activeNotificationsCount | 93 | activeCount: Globals.popupNotificationsModel.activeNotificationsCount | ||
90 | unreadCount: Math.min(99, historyModel.unreadNotificationsCount) | 94 | unreadCount: Math.min(99, historyModel.unreadNotificationsCount) | ||
91 | 95 | | |||
92 | jobsCount: historyModel.activeJobsCount | 96 | jobsCount: historyModel.activeJobsCount | ||
93 | jobsPercentage: historyModel.jobsPercentage | 97 | jobsPercentage: historyModel.jobsPercentage | ||
94 | 98 | | |||
95 | inhibited: Globals.inhibited | 99 | inhibited: Globals.inhibited || !NotificationManager.Server.valid | ||
96 | } | 100 | } | ||
97 | 101 | | |||
98 | Plasmoid.fullRepresentation: FullRepresentation { | 102 | Plasmoid.fullRepresentation: FullRepresentation { | ||
99 | 103 | | |||
100 | } | 104 | } | ||
101 | 105 | | |||
102 | NotificationManager.Settings { | 106 | NotificationManager.Settings { | ||
103 | id: notificationSettings | 107 | id: notificationSettings | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |