~artmello/ubuntu-system-settings/ubuntu-system-settings-notifications_remove_list_check

« back to all changes in this revision

Viewing changes to plugins/notifications/ClickAppsSoundsNotify.qml

Implement extended Notifications panel using Gsettings to store notifications settings for each app

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of system-settings
 
3
 *
 
4
 * Copyright (C) 2013-2014 Canonical Ltd.
 
5
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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/>.
 
17
 */
 
18
 
 
19
import QtQuick 2.4
 
20
import Ubuntu.Components 1.3
 
21
import Ubuntu.SystemSettings.Notifications 1.0
 
22
import SystemSettings 1.0
 
23
 
 
24
ItemPage {
 
25
    id: appsSoundsNotifyPage
 
26
    objectName: "appsSoundsNotifyPage"
 
27
 
 
28
    property alias model: appsSoundsNotifyList.model
 
29
    
 
30
    title: i18n.tr("Sound")
 
31
 
 
32
    ListView {
 
33
        id: appsSoundsNotifyList
 
34
        objectName: "appsSoundsNotifyList"
 
35
 
 
36
        anchors {
 
37
            left: parent.left
 
38
            right: parent.right
 
39
            top: parent.top
 
40
            bottom: parent.bottom
 
41
        }
 
42
 
 
43
        clip: true
 
44
        contentHeight: contentItem.childrenRect.height
 
45
 
 
46
        header: ListItem {
 
47
            ListItemLayout {
 
48
                title.text: i18n.tr("Apps that notify with sound:")
 
49
                title.color: theme.palette.normal.backgroundSecondaryText
 
50
            }
 
51
        }
 
52
 
 
53
        delegate: ListItem {
 
54
            ListItemLayout {
 
55
                Component.onCompleted: {
 
56
                    var iconPath = model.icon.toString()
 
57
                    if (iconPath.search("/") == -1) {
 
58
                        icon.name = model.icon
 
59
                    } else {
 
60
                        icon.source = model.icon
 
61
                    }
 
62
                }
 
63
 
 
64
                title.text: model.displayName
 
65
 
 
66
                Row {
 
67
                    spacing: units.gu(2)
 
68
 
 
69
                    SlotsLayout.position: SlotsLayout.Leading;
 
70
 
 
71
                    CheckBox {
 
72
                        anchors.verticalCenter: icon.verticalCenter
 
73
                        checked: model.soundsNotify
 
74
 
 
75
                        onCheckedChanged: appsSoundsNotifyPage.model.setNotifyEnabled(index, checked)
 
76
                    }
 
77
 
 
78
                    Icon {
 
79
                        id: icon
 
80
                        width: units.gu(5)
 
81
                    }
 
82
                }
 
83
            }
 
84
        }
 
85
    }
 
86
}