2
* This file is part of system-settings
4
* Copyright (C) 2016 Canonical Ltd.
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 3, as published
8
* by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranties of
12
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13
* PURPOSE. See the GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program. If not, see <http://www.gnu.org/licenses/>.
20
import Ubuntu.Components 1.3
21
import Ubuntu.SystemSettings.Notifications 1.0
22
import SystemSettings 1.0
25
id: appNotificationsPage
28
property int entryIndex
30
title: entry ? entry.displayName : ""
32
function disableNotificationsWhenAllUnchecked() {
37
if (!entry.soundsNotify && !entry.vibrationsNotify && !entry.bubblesNotify && !entry.listNotify) {
38
enableNotificationsSwitch.checked = false
39
entry.enableNotifications = false
43
Component.onDestruction: disableNotificationsWhenAllUnchecked()
46
id: notificationsColumn
51
height: enableNotificationsLayout.height + (divider.visible ? divider.height : 0)
53
id: enableNotificationsLayout
54
title.text: i18n.tr("Notifications")
56
id: enableNotificationsSwitch
57
objectName: "enableNotificationsSwitch"
58
SlotsLayout.position: SlotsLayout.Trailing
59
checked: entry ? entry.enableNotifications : false
62
ClickApplicationsModel.setNotifyEnabled(ClickApplicationsModel.EnableNotifications,
63
appNotificationsPage.entryIndex,
72
title.text: i18n.tr("Let this app alert me using:")
73
title.color: theme.palette.normal.backgroundSecondaryText
78
height: soundsLayout.height + (divider.visible ? divider.height : 0)
81
title.text: i18n.tr("Sounds")
84
objectName: "soundsChecked"
85
SlotsLayout.position: SlotsLayout.Leading
86
enabled: entry ? entry.enableNotifications : false
87
checked: entry ? entry.soundsNotify : false
90
ClickApplicationsModel.setNotifyEnabled(ClickApplicationsModel.SoundsNotify,
91
appNotificationsPage.entryIndex,
93
disableNotificationsWhenAllUnchecked()
100
height: vibrationsLayout.height + (divider.visible ? divider.height : 0)
103
title.text: i18n.tr("Vibrations")
105
id: vibrationsChecked
106
objectName: "vibrationsChecked"
107
SlotsLayout.position: SlotsLayout.Leading
108
enabled: entry ? entry.enableNotifications : false
109
checked: entry ? entry.vibrationsNotify : false
112
ClickApplicationsModel.setNotifyEnabled(ClickApplicationsModel.VibrationsNotify,
113
appNotificationsPage.entryIndex,
115
disableNotificationsWhenAllUnchecked()
122
height: bubblesLayout.height + (divider.visible ? divider.height : 0)
125
title.text: i18n.tr("Notification Bubbles")
128
objectName: "bubblesChecked"
129
SlotsLayout.position: SlotsLayout.Leading
130
enabled: entry ? entry.enableNotifications : false
131
checked: entry ? entry.bubblesNotify : false
134
ClickApplicationsModel.setNotifyEnabled(ClickApplicationsModel.BubblesNotify,
135
appNotificationsPage.entryIndex,
137
disableNotificationsWhenAllUnchecked()
144
height: listLayout.height + (divider.visible ? divider.height : 0)
147
title.text: i18n.tr("Notification List")
150
objectName: "listChecked"
151
SlotsLayout.position: SlotsLayout.Leading
152
enabled: entry ? entry.enableNotifications : false
153
checked: entry ? entry.listNotify : false
156
ClickApplicationsModel.setNotifyEnabled(ClickApplicationsModel.ListNotify,
157
appNotificationsPage.entryIndex,
159
disableNotificationsWhenAllUnchecked()