Changeset View
Changeset View
Standalone View
Standalone View
kcms/activities/qml/privacyTab/BlacklistApplicationView.qml
Show All 12 Lines | |||||
13 | * GNU General Public License for more details | 13 | * GNU General Public License for more details | ||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU General Public | 15 | * You should have received a copy of the GNU General Public | ||
16 | * License along with this program; if not, write to the | 16 | * License along with this program; if not, write to the | ||
17 | * Free Software Foundation, Inc., | 17 | * Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.0 | 21 | import QtQuick 2.5 | ||
22 | import org.kde.kquickcontrolsaddons 2.0 | 22 | import QtQuick.Controls 2.5 as QQC2 | ||
23 | import QtQuick.Controls 1.0 as QtControls | | |||
24 | 23 | | |||
25 | QtControls.ScrollView { | 24 | import org.kde.kirigami 2.5 as Kirigami | ||
26 | anchors.fill: parent | | |||
27 | | ||||
28 | Flow { | | |||
29 | id: main | | |||
30 | | ||||
31 | SystemPalette { | | |||
32 | id: colors | | |||
33 | } | | |||
34 | | ||||
35 | width: parent.parent.width | | |||
36 | 25 | | |||
37 | property int minimumHeight: 100 | 26 | QQC2.ScrollView { | ||
38 | 27 | enabled: applicationModel.enabled | |||
39 | spacing: 16 | 28 | Component.onCompleted: background.visible = true; | ||
40 | 29 | | |||
41 | height: Math.max(childrenRect.height, minimumHeight) | 30 | GridView { | ||
42 | 31 | id: gridView | |||
43 | opacity: applicationModel.enabled ? 1 : .3 | 32 | cellHeight: Kirigami.Units.gridUnit * 5 | ||
44 | Behavior on opacity { NumberAnimation { duration: 150 } } | 33 | cellWidth: Kirigami.Units.gridUnit * 9 | ||
45 | | ||||
46 | Repeater { | | |||
47 | model: applicationModel | 34 | model: applicationModel | ||
48 | Column { | 35 | delegate: Item { | ||
49 | id: item | 36 | height: gridView.cellHeight | ||
50 | 37 | width: gridView.cellWidth | |||
51 | property bool blocked: model.blocked | | |||
52 | | ||||
53 | Item { | | |||
54 | id: mainIcon | | |||
55 | | ||||
56 | width : 64 + 20 | | |||
57 | height : 64 + 20 | | |||
58 | | ||||
59 | QIconItem { | | |||
60 | id: icon | | |||
61 | icon: model.icon | | |||
62 | 38 | | |||
39 | Rectangle { | ||||
63 | anchors.fill : parent | 40 | anchors.fill: parent | ||
64 | anchors.margins : 10 | 41 | visible: mouseArea.containsMouse | ||
65 | 42 | color: Kirigami.Theme.hoverColor | |||
66 | opacity: item.blocked ? 0.5 : 1.0 | | |||
67 | Behavior on opacity { NumberAnimation { duration: 150 } } | | |||
68 | } | 43 | } | ||
69 | 44 | | |||
70 | QIconItem { | 45 | Kirigami.Icon { | ||
71 | id: iconNo | 46 | id: icon | ||
72 | icon: "dialog-cancel" | 47 | anchors.horizontalCenter: parent.horizontalCenter | ||
73 | 48 | anchors.bottom: parent.verticalCenter | |||
74 | anchors { | 49 | height: Kirigami.Units.iconSizes.medium | ||
75 | right : parent.right | 50 | width: height | ||
76 | bottom : parent.bottom | 51 | source: model.icon | ||
52 | opacity: model.blocked ? 0.6 : 1.0 | ||||
53 | | ||||
54 | Behavior on opacity { NumberAnimation { duration: 100 } } | ||||
77 | } | 55 | } | ||
78 | 56 | | |||
79 | width : 48 | 57 | Kirigami.Icon { | ||
80 | height : 48 | 58 | anchors.bottom: parent.bottom | ||
59 | anchors.right: parent.right | ||||
60 | height: Kirigami.Units.iconSizes.smallMedium | ||||
61 | width: parent.width | ||||
ngraham: `emblem-unavailable` looks nicer and seems more semantically correct. If we use it, it should… | |||||
62 | source: "emblem-unavailable" | ||||
81 | opacity : (1 - icon.opacity) * 2 | 63 | opacity: (1 - icon.opacity) * 2 | ||
82 | } | 64 | } | ||
83 | 65 | | |||
84 | MouseArea { | 66 | QQC2.Label { | ||
85 | onClicked: applicationModel.toggleApplicationBlocked(model.index) | | |||
86 | anchors.fill: parent | | |||
87 | } | | |||
88 | } | | |||
89 | | ||||
90 | Text { | | |||
91 | elide : Text.ElideRight | | |||
92 | width : mainIcon.width | | |||
93 | | ||||
94 | text : model.title | | |||
95 | opacity : icon.opacity | | |||
96 | color : colors.windowText | | |||
97 | | ||||
98 | anchors.margins : 10 | | |||
99 | anchors.horizontalCenter : parent.horizontalCenter | 67 | anchors.horizontalCenter: parent.horizontalCenter | ||
68 | anchors.top: parent.verticalCenter | ||||
69 | width: parent.width - 20 | ||||
70 | text: model.title | ||||
100 | horizontalAlignment : Text.AlignHCenter | 71 | horizontalAlignment: Text.AlignHCenter | ||
72 | elide: Text.ElideRight | ||||
73 | maximumLineCount: 2 | ||||
74 | wrapMode: Text.Wrap | ||||
75 | opacity: model.blocked ? 0.6 : 1.0 | ||||
76 | | ||||
77 | Behavior on opacity { NumberAnimation { duration: 100 } } | ||||
101 | } | 78 | } | ||
79 | | ||||
80 | MouseArea { | ||||
81 | id: mouseArea | ||||
82 | anchors.fill: parent | ||||
83 | hoverEnabled: true | ||||
84 | onClicked: applicationModel.toggleApplicationBlocked(model.index) | ||||
102 | } | 85 | } | ||
103 | } | 86 | } | ||
104 | } | 87 | } | ||
105 | | ||||
106 | } | 88 | } | ||
107 | |
emblem-unavailable looks nicer and seems more semantically correct. If we use it, it should be located in the bottom-right corner of the icon to be consistent with other emblem placement.