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 | | ||||
37 | property int minimumHeight: 100 | | |||
38 | | ||||
39 | spacing: 16 | | |||
40 | | ||||
41 | height: Math.max(childrenRect.height, minimumHeight) | | |||
42 | | ||||
43 | opacity: applicationModel.enabled ? 1 : .3 | | |||
44 | Behavior on opacity { NumberAnimation { duration: 150 } } | | |||
45 | 25 | | |||
46 | Repeater { | 26 | QQC2.ScrollView { | ||
27 | enabled: applicationModel.enabled | ||||
28 | Component.onCompleted: background.visible = true; | ||||
29 | | ||||
30 | GridView { | ||||
31 | id: gridView | ||||
32 | cellHeight: Kirigami.Units.gridUnit * 5 | ||||
33 | cellWidth: Kirigami.Units.gridUnit * 9 | ||||
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 | ||
48 | anchors.bottom: parent.verticalCenter | ||||
49 | height: Kirigami.Units.iconSizes.medium | ||||
50 | width: height | ||||
51 | source: model.icon | ||||
52 | opacity: model.blocked ? 0.6 : 1.0 | ||||
73 | 53 | | |||
74 | anchors { | 54 | Behavior on opacity { NumberAnimation { duration: 100 } } | ||
75 | right : parent.right | | |||
76 | bottom : parent.bottom | | |||
77 | } | 55 | } | ||
78 | 56 | | |||
79 | width : 48 | 57 | Kirigami.Icon { | ||
80 | height : 48 | 58 | anchors.bottom: icon.bottom | ||
81 | opacity : (1 - icon.opacity) * 2 | 59 | anchors.right: icon.right | ||
82 | } | 60 | height: Kirigami.Units.iconSizes.small | ||
61 | width: height | ||||
62 | source: "emblem-unavailable" | ||||
63 | opacity: model.blocked ? 1.0 : 0.0 | ||||
83 | 64 | | |||
84 | MouseArea { | 65 | Behavior on opacity { NumberAnimation { duration: 100 } } | ||
85 | onClicked: applicationModel.toggleApplicationBlocked(model.index) | | |||
86 | anchors.fill: parent | | |||
87 | } | | |||
88 | } | 66 | } | ||
89 | 67 | | |||
90 | Text { | 68 | QQC2.Label { | ||
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 | 69 | anchors.horizontalCenter: parent.horizontalCenter | ||
ngraham: `emblem-unavailable` looks nicer and seems more semantically correct. If we use it, it should… | |||||
70 | anchors.top: parent.verticalCenter | ||||
71 | width: parent.width - 20 | ||||
72 | text: model.title | ||||
100 | horizontalAlignment : Text.AlignHCenter | 73 | horizontalAlignment: Text.AlignHCenter | ||
74 | elide: Text.ElideRight | ||||
75 | maximumLineCount: 2 | ||||
76 | wrapMode: Text.Wrap | ||||
77 | opacity: model.blocked ? 0.6 : 1.0 | ||||
78 | | ||||
79 | Behavior on opacity { NumberAnimation { duration: 100 } } | ||||
101 | } | 80 | } | ||
81 | | ||||
82 | MouseArea { | ||||
83 | id: mouseArea | ||||
84 | anchors.fill: parent | ||||
85 | hoverEnabled: true | ||||
86 | onClicked: applicationModel.toggleApplicationBlocked(model.index) | ||||
102 | } | 87 | } | ||
103 | } | 88 | } | ||
104 | } | 89 | } | ||
105 | | ||||
106 | } | 90 | } | ||
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.