on xenial help sign in
Drop People lens.
commit0adb9c5d422d40a0e95985cbb23b98f30220589d authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 14 Jun 2013, 15:54 (13 years ago) parent0d44e91
28 files changed−1683
Dash/DashHome.qml−5 Dash/DashPeople.qml−235 Dash/People/CarouselDelegatePeople.qml−166 Dash/People/Data.qml−71 Dash/People/Delegate.qml−167 Dash/People/PeopleCarousel.qml−43 Dash/People/PeopleFilterGrid.qml−74 Dash/People/PeoplePreview.qml−124 Dash/People/Preview/Address.qml−74 Dash/People/Preview/Base.qml−22 Dash/People/Preview/Generic.qml−80 Dash/People/Preview/Phone.qml−108 Dash/People/Preview/Status.qml−97 Dash/People/graphics/bottomshape@18.png Dash/People/graphics/bottomshape@18.sci−5 Dash/People/graphics/icon_facebook@18.png Dash/People/graphics/icon_offline@18.png Dash/People/graphics/icon_online@18.png Dash/People/graphics/icon_twitter@18.png Dash/People/graphics/icon_unknown@18.png Dash/People/graphics/icon_write_text@18.png Dash/People/graphics/star_favourite@18.png Dash/People/graphics/star_not_favourite@18.png debian/control−1 tests/qmltests/CMakeLists.txt−2 tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml−154 tests/qmltests/Dash/tst_FilterGrids.qml−1 tests/qmltests/Dash/tst_PeoplePreview.qml−254
Dash/DashHome.qml−5
@@ -23,7 +23,6 @@ import "../Applications"
2323import "Apps"
2424import "Video"
2525import "Music"
26−import "People"
2726
2827ScopeView {
2928 id: root
@@ -123,14 +122,10 @@ ScopeView {
123122 }
124123 }
125124
126− Component { id: peopleCarousel; PeopleCarousel {} }
127− Component { id: peopleGrid; PeopleFilterGrid {} }
128125 Component { id: musicGrid; MusicFilterGrid {} }
129126 Component { id: videosGrid; VideosFilterGrid {} }
130127 property var componentModels: {
131128 "AppsGrid": applicationsFilterGrid,
132− "PeopleCarousel": peopleCarousel,
133− "PeopleGrid": peopleGrid,
134129 "MusicGrid": musicGrid,
135130 "VideosGrid": videosGrid,
136131 }
Dash/DashPeople.qmldeleted−235
@@ -1,235 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import Dee 3.0
20−import Unity 0.1
21−import Utils 0.1
22−import "../Components"
23−import "../Components/ListItems" as ListItems
24−import "People"
25−
26−ScopeView {
27− id: scopeView
28− property alias previewShown: previewLoader.onScreen
29−
30− property var categoryNames: [
31− i18n.tr("Favourites"),
32− i18n.tr("Recently in touch"),
33− i18n.tr("New Contacts"),
34− i18n.tr("A-Z")
35− ]
36−
37− onIsCurrentChanged: {
38− pageHeader.resetSearch();
39− }
40−
41− onMovementStarted: categoryView.showHeader()
42−
43− Binding {
44− target: scopeView.scope
45− property: "searchQuery"
46− value: pageHeader.searchQuery
47− }
48−
49− Connections {
50− target: panel
51− onSearchClicked: if (isCurrent) {
52− pageHeader.triggerSearch()
53− categoryView.showHeader()
54− }
55− }
56−
57− OpenEffect {
58− id: effect
59− anchors {
60− fill: parent
61− bottomMargin: -bottomOverflow
62− }
63− sourceItem: categoryView
64−
65− enabled: gap > 0.0
66−
67− topGapPx: (1 - gap) * positionPx
68− topOpacity: (1 - gap * 1.2)
69− bottomGapPx: positionPx + gap * (targetBottomGapPx - positionPx)
70− bottomOverflow: units.gu(20)
71− bottomOpacity: 1 - (gap * 0.8)
72−
73− property int targetBottomGapPx: height - units.gu(8) - bottomOverflow
74− property real gap: previewLoader.open ? 1.0 : 0.0
75−
76− Behavior on gap {
77− NumberAnimation {
78− duration: 200
79− easing.type: Easing.InOutQuad
80− onRunningChanged: {
81− if (!previewLoader.open && !running) {
82− previewLoader.onScreen = false;
83− }
84− }
85− }
86− }
87− }
88−
89− ListViewWithPageHeader {
90− id: categoryView
91− anchors.fill: parent
92− model: scopeView.categories
93− onAtYEndChanged: if (atYEnd) endReached()
94− onMovingChanged: if (moving && atYEnd) endReached()
95− clipListView: !previewLoader.onScreen
96−
97− delegate: ListItems.Base {
98− id: base
99− property int categoryIndex: index
100− property int categoryId: id
101− highlightWhenPressed: false
102−
103− Loader {
104− width: categoryView.width
105− sourceComponent: base.categoryId == 0 ? peopleCarouselComponent : peopleGridComponent
106−
107− onLoaded: {
108− item.categoryId = Qt.binding(function() { return base.categoryId; })
109− item.categoryIndex = Qt.binding(function() { return base.categoryIndex; })
110− item.model = results;
111− }
112− }
113− }
114−
115− sectionProperty: "name"
116− sectionDelegate: ListItems.Header {
117− width: categoryView.width
118− text: i18n.tr(section)
119− }
120− pageHeader: PageHeader {
121− id: pageHeader
122− width: categoryView.width
123− text: i18n.tr("People")
124− searchEntryEnabled: true
125− searchHistory: scopeView.searchHistory
126− }
127− }
128−
129− Component {
130− id: peopleCarouselComponent
131− PeopleCarousel {
132− id: peopleCarousel
133−
134− property int categoryId
135− property int categoryIndex
136−
137− onClicked: {
138− effect.positionPx = mapToItem(categoryView, 0, itemY).y;
139− previewData.model = delegateItem.dataModel;
140− previewData.uri = delegateItem.dataModel.uri;
141− previewLoader.open = true;
142− }
143− }
144− }
145−
146− Component {
147− id: peopleGridComponent
148− PeopleFilterGrid {
149− id: peopleGrid
150−
151− property int categoryIndex
152−
153− onClicked: {
154− if (peopleGrid.columnCount == 1) {
155− if (categoryIndex >= categoryView.model.count -1 && index >= peopleGrid.model.count - 1) {
156− effect.positionPx = mapToItem(categoryView, 0, itemY).y;
157− } else {
158− effect.positionPx = mapToItem(categoryView, 0, itemY + peopleGrid.cellHeight).y
159− }
160− } else {
161− effect.positionPx = mapToItem(categoryView, 0, itemY).y
162− }
163− previewData.model = data;
164− previewData.uri = data.uri
165− previewLoader.open = true;
166− }
167− }
168− }
169−
170− Loader {
171− id: previewLoader
172− height: effect.bottomGapPx - effect.topGapPx
173− anchors {
174− top: parent.top
175− topMargin: effect.topGapPx
176− left: parent.left
177− right: parent.right
178− }
179− sourceComponent: onScreen ? previewComponent : undefined
180−
181− property bool open: false
182− property bool onScreen: false
183− property QtObject videoItem
184−
185− onOpenChanged: {
186− if (open) {
187− onScreen = true
188− }
189− }
190−
191− onLoaded: {
192− if (previewData.ready) {
193− item.model = previewData;
194− }
195− }
196− }
197−
198− Component {
199− id: previewComponent
200−
201− PeoplePreview {
202− id: preview
203− anchors.fill: parent
204− forceSquare: true
205− onClose: {
206− open = false;
207− }
208− }
209− }
210−
211− PeoplePreviewData {
212− id: previewData
213− scope: scopeView.scope
214− property Data model
215−
216− onError: previewLoader.open = false
217− onReadyChanged: {
218− if (previewLoader.item) {
219− previewLoader.item.model = ready ? previewData : undefined
220− }
221− }
222− }
223−
224− // TODO: Move as InverseMouseArea to DashPreview
225− MouseArea {
226− enabled: previewLoader.onScreen
227− anchors {
228− fill: parent
229− topMargin: effect.bottomGapPx
230− }
231− onClicked: {
232− previewLoader.open = false;
233− }
234− }
235−}
Dash/People/CarouselDelegatePeople.qmldeleted−166
@@ -1,166 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import "../../Components"
20−
21−BaseCarouselDelegate {
22− id: item
23−
24− property var dataModel
25− readonly property real frameHeight: Math.max(height / 3.6, units.gu(5.5))
26−
27− UbuntuShape {
28− anchors.fill: parent
29− radius: "medium"
30− borderSource: ""
31− image: Image {
32− asynchronous: true
33− sourceSize { width: item.width; height: item.height }
34− source: dataModel.avatar ? dataModel.avatar : ""
35− fillMode: Image.PreserveAspectCrop
36− }
37− }
38−
39− Component {
40− id: component_frame
41− Item {
42− id: frame
43−
44− BorderImage {
45− // TODO This will go away once we have 'clip: true' in UbuntuShape
46− anchors.centerIn: parent
47− width: parent.width + units.gu(1.5)
48− height: parent.height + units.gu(1.5)
49− visible: labelRemotePost.visible
50− opacity: 0.9
51− source: "graphics/bottomshape.sci"
52− }
53−
54− property bool showRemoteDetails: true
55− // To decide if the remote icon and time should be shown, its once layed out to do so.
56− // Then it's checked if everything fits in the frame size. If not, showRemoteDetails is set false
57− // Using bindings to do so cause a binding loop
58− function checkSizeForRemoteDetails() {
59− showRemoteDetails = true
60− showRemoteDetails = (frame.height - column.minimumHeight) >= labelRemotePostTime.height
61− }
62−
63− Item {
64− id: remoteSourceIconContainer
65−
66− // TODO use proper asset and get rid of these dimensions
67− width: units.gu(3)
68− height: units.gu(4)
69− visible: showRemoteDetails
70−
71− Image {
72− anchors.centerIn: parent
73− anchors.horizontalCenterOffset: units.gu(1)
74− source: dataModel.remoteSourceIcon ? dataModel.remoteSourceIcon : ""
75− fillMode: Image.PreserveAspectFit
76− }
77− }
78−
79− Column {
80− id: column
81−
82− property real minimumHeight: labelName.height + labelRemotePost.height + anchors.topMargin + anchors.bottomMargin
83−
84− anchors {
85− left: remoteSourceIconContainer.visible ? remoteSourceIconContainer.right : parent.left
86− right: parent.right
87− top: remoteSourceIconContainer.visible ? parent.top : undefined
88− verticalCenter: remoteSourceIconContainer.visible ? undefined : parent.verticalCenter
89− margins: units.gu(1)
90− }
91−
92− Label {
93− id: labelName
94−
95− width: parent.width
96− text: dataModel.name ? dataModel.name : ""
97− color: "white"
98− fontSize: "x-small"
99− elide: Text.ElideRight
100− font.weight: Font.Bold
101− onTextChanged: checkSizeForRemoteDetails()
102− }
103−
104− Label {
105− id: labelRemotePost
106−
107− width: parent.width
108− text: dataModel.remotePost ? dataModel.remotePost : ""
109− color: "white"
110− opacity: 0.8
111− fontSize: "xx-small"
112− elide: Text.ElideRight
113− maximumLineCount: 2
114− wrapMode: Text.WordWrap
115− onTextChanged: checkSizeForRemoteDetails()
116− }
117−
118− Label {
119− id: labelRemotePostTime
120−
121− width: parent.width
122− text: model.remotePostTime ? model.remotePostTime : ""
123− color: "white"
124− opacity: 0.5
125− fontSize: "xx-small"
126− elide: Text.ElideRight
127− visible: showRemoteDetails
128− onTextChanged: checkSizeForRemoteDetails()
129− }
130− }
131−
132− onHeightChanged: checkSizeForRemoteDetails()
133− onWidthChanged: checkSizeForRemoteDetails()
134− Component.onCompleted: checkSizeForRemoteDetails()
135− }
136− }
137−
138− Loader {
139− id: loader_frame
140−
141− anchors {
142− left: parent.left
143− right: parent.right
144− bottom: parent.bottom
145− }
146− height: item.frameHeight
147− opacity: item.explicitlyScaled ? 1.0 : 0
148−
149− Behavior on opacity {
150− NumberAnimation {
151− duration: 250
152− easing.type: Easing.InOutQuad
153− }
154− }
155−
156− sourceComponent: opacity > 0 ? component_frame : undefined
157− }
158−
159− BorderImage {
160− anchors.centerIn: parent
161− opacity: 0.6
162− source: "../../Components/graphics/non-selected.sci"
163− width: parent.width + units.gu(1.5)
164− height: parent.height + units.gu(1.5)
165− }
166−}
Dash/People/Data.qmldeleted−71
@@ -1,71 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Dee 3.0
19−
20−DeeVariantText {
21− property string uri
22− property string name
23− property url avatar
24− property var emails: ListModel {}
25− property var phones: ListModel {}
26− property string presenceStatus
27− property string presenceMessage
28− property url remoteSourceIcon
29− property string remotePost
30− property bool favorite
31− property bool recent
32− property url statusIcon
33− property string status: remotePost ? remotePost : presenceMessage
34− property url recentIcon
35− property string recentTime
36−
37− statusIcon: switch(presenceStatus) {
38− case "offline": "graphics/icon_offline.png"; break
39− // FIXME random for now, as we don't get actual presence data on the phone
40− case "":
41− var r = Math.random();
42− if (r >= 0.7) "graphics/icon_online.png"
43− else if (r >= 0.4) "graphics/icon_offline.png"
44− else "graphics/icon_unknown.png"
45− break;
46− default: "graphics/icon_online.png"
47− }
48−
49− onValueChanged: {
50− for (var i in value) switch (value[i][0]) {
51− case "presence-message": presenceMessage = value[i][1]; break
52− case "presence-status": presenceStatus = value[i][1]; break
53− case "remote-source-icon": remoteSourceIcon = value[i][1]; break
54− case "remote-post": remotePost = value[i][1]; break
55− case "recent-icon": recentIcon = value[i][1]; break
56− case "recent-time": recentTime = value[i][1]; break
57− case "phone": phones.append({"type": generateType(), "number": value[i][1]}); break
58− case "email": emails.append({"type": generateType(), "address": value[i][1]}); break
59− }
60− }
61−
62− // FIXME: random for now, as we don't have multiple phone numbers in the backend yet
63− function generateType() {
64− var phoneType = "";
65− var r = Math.random();
66− if (r >= 0.7) phoneType = "Private";
67− else if (r >= 0.4) phoneType = "Mobile";
68− else phoneType = "Work";
69− return phoneType;
70− }
71−}
Dash/People/Delegate.qmldeleted−167
@@ -1,167 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import "../../Components"
20−import "../../Components/Time.js" as Time
21−
22−Item {
23− id: peopleView
24−
25− property var dataModel
26−
27− property int __spacing: units.gu(1)
28−
29− /* Select what is shown in the subtitle
30− data: phone number or email address
31− status: social media presence status
32− */
33− property string subtitleType: "data"
34− height: subtitleType == "data" && detailsLabel.lineCount < 2 ? units.gu(10) : units.gu(11.5)
35−
36− Row {
37− id: row
38− anchors {
39− left: parent.left
40− right: parent.right
41− leftMargin: units.gu(2)
42− rightMargin: units.gu(4)
43− top: parent.top
44− topMargin: units.gu(2)
45− }
46− spacing: __spacing
47−
48− UbuntuShape {
49− id: avatar
50− anchors { top: parent.top }
51− width: units.gu(6)
52− height: units.gu(6)
53− image: Image {
54− width: units.gu(6)
55− source: peopleView.dataModel.avatar
56− sourceSize { width: avatar.width; height: avatar.height }
57− fillMode: Image.PreserveAspectCrop
58− smooth: true
59− asynchronous: true
60− cache: false
61− }
62− }
63−
64− Grid {
65− spacing: units.gu(0.5)
66− width: parent.width - x
67− columns: 2
68−
69− Item {
70− height: units.gu(2)
71− width: units.gu(2)
72−
73− Image {
74− id: statusImage
75− source: peopleView.dataModel.statusIcon
76− width: units.gu(1.5)
77− height: units.gu(1.5)
78− fillMode: Image.PreserveAspectFit
79− smooth: true
80− anchors.verticalCenter: parent.verticalCenter
81− }
82− }
83−
84− Label {
85− id: nameLabel
86− elide: Text.ElideRight
87− text: peopleView.dataModel.name
88− color: "#f3f3e7"
89− style: Text.Raised
90− styleColor: "black"
91− font.weight: Font.DemiBold;
92− opacity: 0.9;
93− }
94−
95− Image {
96− source: switch(peopleView.subtitleType) {
97− case "data":
98− return peopleView.dataModel.remoteSourceIcon;
99− case "status":
100− return peopleView.dataModel.recent ? peopleView.dataModel.recentIcon : "";
101− }
102−
103− width: units.gu(1.5)
104− height: units.gu(1.5)
105− fillMode: Image.PreserveAspectFit
106− smooth: true
107− }
108−
109− Label {
110− id: detailsLabel
111− width: parent.width - x
112− elide: Text.ElideRight
113− text: switch (peopleView.subtitleType) {
114− case "data":
115− if (peopleView.dataModel.phones && peopleView.dataModel.phones.count > 0) {
116− return peopleView.dataModel.phones.get(0).number;
117− } else if (peopleView.dataModel.emails && peopleView.dataModel.emails.count > 0) {
118− return peopleView.dataModel.emails.get(0).address;
119− }
120− return "";
121− case "status":
122− return peopleView.dataModel.status;
123− }
124− color: "#f3f3e7"
125− style: Text.Raised
126− styleColor: "black"
127− opacity: 0.7;
128− fontSize: "small";
129− wrapMode: Text.WordWrap;
130− maximumLineCount: 2;
131− }
132−
133− Item {
134− height: units.gu(2)
135− width: units.gu(1.5)
136−
137− // Placeholder
138− }
139−
140− Label {
141− width: parent.width - x
142− elide: Text.ElideRight
143− text: switch (peopleView.subtitleType) {
144− case "data":
145− if (peopleView.dataModel.phones && peopleView.dataModel.phones.count > 0) {
146− return peopleView.dataModel.phones.get(0).type;
147− } else if (peopleView.dataModel.emails && peopleView.dataModel.emails.count > 0) {
148− return peopleView.dataModel.emails.get(0).type;
149− }
150− return "";
151− case "status":
152− if (peopleView.dataModel.recent) {
153− var time = Time.readableFromNow(peopleView.dataModel.recentTime);
154− return time ? time : peopleView.dataModel.recentTime;
155− } else {
156− return peopleView.dataModel.status
157− }
158− }
159− color: "#8f8f88"
160− style: Text.Raised
161− styleColor: "black"
162− opacity: 0.7;
163− fontSize: "x-small";
164− }
165− }
166− }
167−}
Dash/People/PeopleCarousel.qmldeleted−43
@@ -1,43 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import "../../Components"
19−
20−Carousel {
21− id: peopleCarousel
22− tileAspectRatio: 1
23− minimumTileWidth: units.gu(13)
24− itemComponent: carouselDelegatePeople
25− selectedItemScaleFactor: 1.2
26− cacheBuffer: 1404 // 18px * 13gu * 6
27− height: implicitHeight + units.gu(6)
28−
29− Component {
30− id: carouselDelegatePeople
31− CarouselDelegatePeople {
32− dataModel: data
33−
34− Data {
35− id: data
36− uri: model.column_0
37− text: model.column_5
38− name: model.column_4
39− avatar: model.column_1
40− }
41− }
42− }
43−}
Dash/People/PeopleFilterGrid.qmldeleted−74
@@ -1,74 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import "../../Components"
19−import "../../Components/ListItems" as ListItems
20−
21−FilterGrid {
22− id: filterGrid
23−
24− filter: true
25− minimumHorizontalSpacing: 0
26− delegateWidth: units.gu(40)
27− delegateHeight: showStatusMessage ? units.gu(11.5) : units.gu(10)
28− verticalSpacing: 0
29− collapsedRowCount: 50 / columns
30− expandable: false
31−
32− property int categoryId
33− property bool showStatusMessage: categoryId == 1 || categoryId == 2
34−
35− readonly property int columnCount: width / cellWidth
36−
37− signal clicked(int index, variant data, real itemY)
38−
39− delegate: ListItems.Base {
40− id: tile
41− objectName: "delegate" + index
42− width: filterGrid.cellWidth
43− showDivider: index < Math.floor((filterGrid.model.count-1) / filterGrid.columnCount) * filterGrid.columnCount
44−
45− onClicked: {
46− filterGrid.clicked(index, data, tile.y);
47− }
48−
49− Delegate {
50− width: filterGrid.cellWidth
51− height: filterGrid.cellHeight
52− // This caches the Delegate into FBO because:
53− // - People data Delegates are slow because of their item count
54− // - FilterGrid is "height: childrenRect.height" so all delegates are always loaded
55− // TODO: Optimize this by:
56− // - not loading all delegates all the time and remove layer.enabled and/or
57− // - destroy whole scope when not visible/needed to free the GPU memory
58− layer.enabled: true
59−
60− dataModel: data
61− subtitleType: filterGrid.showStatusMessage ? "status" : "data"
62−
63− Data {
64− id: data
65− uri: column_0
66− text: column_5
67− name: column_4
68− avatar: column_1
69− favorite: filterGrid.categoryId == 0
70− recent: filterGrid.showStatusMessage
71− }
72− }
73− }
74−}
Dash/People/PeoplePreview.qmldeleted−124
@@ -1,124 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import "../../Components"
20−import "../../Components/ListItems" as ListItems
21−import ".."
22−import "Preview"
23−
24−DashPreview {
25− id: preview
26−
27− property var model: undefined
28−
29− title: (model && model.displayName) ? model.displayName : ""
30− url: (model && model.avatar) ? model.avatar : ""
31− previewWidthRatio: 0.34
32−
33−
34− description: Grid {
35− spacing: columns > 1 ? units.gu(2) : 0
36− columns: preview.narrowMode || width < units.gu(60) ? 1 : 2
37− property int columnWidth: columns > 1 ? (width - spacing * (columns - 1)) / columns : width
38− anchors {
39− left: parent.left
40− right: parent.right
41− }
42−
43− Status {
44− id: status
45− objectName: "statusField"
46− width: parent.columnWidth
47− visible: preview.model != undefined && preview.model.status != undefined
48− model: preview.model
49− property int index: 1
50− // FIXME that should trigger the action on the scope, when there's support
51− onClicked: shell.activateApplication("/usr/share/applications/%1-webapp.desktop".arg(model.statusService), "--homepage=%1".arg(model.statusPostUri))
52− }
53−
54−
55− Column {
56− id: descriptionColumn
57− width: parent.columnWidth
58−
59−
60− Column {
61− anchors {
62− left: parent.left
63− right: parent.right
64− }
65−
66− Repeater {
67− model: preview.model ? preview.model.phoneNumbers : undefined
68−
69− delegate: Phone {
70− objectName: "phoneField" + index
71− model: preview.model
72− // FIXME these should trigger actions on the scope, when there's support
73− onPhoneClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "call://%1".arg(number.replace(/[^\d\+]/g, "")))
74− onTextClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "message://%1".arg(number.replace(/[^\d\+]/g, "")))
75− }
76− }
77− }
78−
79− Column {
80− anchors {
81− left: parent.left
82− right: parent.right
83− }
84−
85− Repeater {
86− model: preview.model ? preview.model.emailAddresses : undefined
87− delegate: Generic {
88− objectName: "emailField" + index
89− type: "email"
90− }
91− }
92− }
93−
94− Column {
95− anchors {
96− left: parent.left
97− right: parent.right
98− }
99−
100− Repeater {
101− model: preview.model ? preview.model.imAccounts : undefined
102− delegate: Generic {
103− objectName: "imField" + index
104− type: "imAccount"
105− }
106− }
107− }
108−
109− Column {
110− anchors {
111− left: parent.left
112− right: parent.right
113− }
114−
115− Repeater {
116− model: preview.model ? preview.model.addresses : undefined
117− delegate: Address {
118− objectName: "addressField" + index
119− }
120− }
121− }
122− }
123− }
124−}
Dash/People/Preview/Address.qmldeleted−74
@@ -1,74 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Base {
21− id: root
22−
23− Item {
24− anchors {
25− left: parent.left
26− right: parent.right
27− leftMargin: units.gu(2)
28− rightMargin: units.gu(4)
29− }
30− height: childrenRect.height + units.gu(2.5)
31−
32− Label {
33− id: typeLabel
34− anchors {
35− top: parent.top
36− topMargin: units.gu(1)
37− }
38− text: type
39− elide: Text.ElideRight
40− color: "#f3f3e7"
41− style: Text.Raised
42− styleColor: "black"
43− font.capitalization: Font.Capitalize
44− opacity: 0.7;
45− fontSize: "small"
46− }
47−
48− Label {
49− id: contentLabel
50− anchors {
51− left: parent.left
52− right: parent.right
53− top: typeLabel.bottom
54− topMargin: units.gu(0.5)
55− }
56− text: {
57− var fields = [street, poBox, extension, locality, region, postalCode, country, addressFormat]
58− var parts = []
59− for (var k in fields) {
60− if (fields[k]) parts.push(fields[k])
61− }
62− return parts.join("\n")
63− }
64− elide: Text.ElideRight
65− color: "#f3f3e7"
66− style: Text.Raised
67− styleColor: "black"
68− opacity: 0.9;
69− fontSize: "large"
70− wrapMode: Text.WordWrap
71− font.weight: Font.Light
72− }
73− }
74−}
Dash/People/Preview/Base.qmldeleted−22
@@ -1,22 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import "../../../Components/ListItems"
19−
20−Base {
21− property var model
22−}
Dash/People/Preview/Generic.qmldeleted−80
@@ -1,80 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Base {
21− id: root
22−
23− property string type
24−
25− Item {
26− anchors {
27− left: parent.left
28− right: parent.right
29− leftMargin: units.gu(2)
30− rightMargin: units.gu(4)
31− }
32− height: childrenRect.height + units.gu(2.5)
33−
34− Label {
35− id: typeLabel
36− anchors {
37− top: parent.top
38− topMargin: units.gu(1)
39− }
40− text: switch (root.type) {
41− case "email":
42− case "address": type; break
43− case "imAccount": protocol; break
44− default: type
45− }
46− elide: Text.ElideRight
47− color: "#f3f3e7"
48− style: Text.Raised
49− styleColor: "black"
50− font.capitalization: Font.Capitalize
51− opacity: 0.7;
52− fontSize: "small"
53− }
54−
55− Label {
56− id: contentLabel
57− anchors {
58− left: parent.left
59− right: parent.right
60− top: typeLabel.bottom
61− topMargin: units.gu(0.5)
62− }
63− text: switch (root.type) {
64− case "email":
65− case "address":
66− case "imAccount": address; break
67− default: text
68− }
69− elide: Text.ElideRight
70− color: "#f3f3e7"
71− style: Text.Raised
72− styleColor: "black"
73− opacity: 0.9;
74− fontSize: "large"
75− wrapMode: Text.WordWrap
76− maximumLineCount: 2
77− font.weight: Font.Light
78− }
79− }
80−}
Dash/People/Preview/Phone.qmldeleted−108
@@ -1,108 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import "../../../Components/ListItems" as ListItems
20−
21−Base {
22− id: root
23− highlightWhenPressed: false
24−
25− signal phoneClicked
26− signal textClicked
27−
28− Row {
29− height: phoneButton.height
30− anchors {
31− left: parent.left
32− right: parent.right
33− }
34− AbstractButton {
35− id: phoneButton
36− width: parent.width - units.gu(7)
37− height: Math.max(units.gu(8), phoneColumn.height + units.gu(2))
38− Column {
39− id: phoneColumn
40− spacing: units.gu(0.5)
41− anchors {
42− top: parent.top
43− topMargin: units.gu(1)
44− left: parent.left
45− leftMargin: units.gu(2)
46− right: parent.right
47− }
48− Label {
49− text: {
50− var parts = []
51− if (location) parts.push(location)
52− if (type && type != "voice") parts.push(type)
53− if (parts.length == 0) return "other"
54− return parts.join(" ")
55− }
56− elide: Text.ElideRight
57− color: "#f3f3e7"
58− style: Text.Raised
59− styleColor: "black"
60− font.capitalization: Font.Capitalize
61− opacity: 0.7;
62− fontSize: "small"
63− }
64− Label {
65− width: parent.width
66− text: number
67− elide: Text.ElideRight
68− color: "#f3f3e7"
69− style: Text.Raised
70− styleColor: "black"
71− opacity: 0.9;
72− fontSize: "large"
73− wrapMode: Text.WordWrap
74− maximumLineCount: 2
75− font.weight: Font.Light
76− }
77− }
78−
79− ListItems.Highlight {
80− anchors.fill: parent
81− pressed: phoneButton.pressed
82− }
83−
84− onClicked: phoneClicked()
85− }
86−
87− AbstractButton {
88− id: textButton
89− width: units.gu(7)
90− height: parent.height
91−
92− Image {
93− anchors.centerIn: parent
94− width: units.gu(4)
95− height: units.gu(4)
96− source: "../graphics/icon_write_text.png"
97− fillMode: Image.PreserveAspectFit
98− }
99−
100− ListItems.Highlight {
101− anchors.fill: parent
102− pressed: textButton.pressed
103− }
104−
105− onClicked: textClicked()
106− }
107− }
108−}
Dash/People/Preview/Status.qmldeleted−97
@@ -1,97 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import "../../../Components/Time.js" as Time
20−
21−Base {
22− id: root
23−
24− Item {
25− anchors {
26− left: parent.left
27− right: parent.right
28− leftMargin: units.gu(2)
29− rightMargin: units.gu(4)
30− }
31− height: childrenRect.height
32−
33− Label {
34− id: typeLabel
35− anchors {
36− top: parent.top
37− topMargin: units.gu(1)
38− }
39− text: "Status"
40− elide: Text.ElideRight
41− color: "#f3f3e7"
42− style: Text.Raised
43− styleColor: "black"
44− font.capitalization: Font.Capitalize
45− opacity: 0.7;
46− fontSize: "small"
47− }
48−
49− Label {
50− id: contentLabel
51− anchors {
52− left: parent.left
53− right: parent.right
54− top: typeLabel.bottom
55− topMargin: units.gu(0.5)
56− }
57− text: root.model ? root.model.status : ""
58− elide: Text.ElideRight
59− color: "#f3f3e7"
60− style: Text.Raised
61− styleColor: "black"
62− opacity: 0.9;
63− fontSize: "large"
64− wrapMode: Text.WordWrap
65− maximumLineCount: 6
66− font.weight: Font.Light
67− }
68−
69− Row {
70− anchors {
71− top: contentLabel.bottom
72− topMargin: units.gu(1)
73− }
74− height: statusText.height + units.gu(2.5)
75− spacing: units.gu(1)
76− Image {
77− width: units.gu(2)
78− height: units.gu(2)
79− fillMode: Image.PreserveAspectFit
80− source: root.model ? root.model.statusServiceIcon : ""
81− }
82− Label {
83− id: statusText
84− text: if (root.model) {
85− var time = Time.readableFromNow(root.model.statusTime);
86− return time ? time : root.model.statusTime;
87− } else return "";
88− elide: Text.ElideRight
89− color: "#f3f3e7"
90− style: Text.Raised
91− styleColor: "black"
92− opacity: 0.7;
93− fontSize: "small"
94− }
95− }
96− }
97−}
Dash/People/graphics/bottomshape@18.pngdeleted

Binary file not shown.

Dash/People/graphics/bottomshape@18.scideleted−5
@@ -1,5 +0,0 @@
1−border.left: 54
2−border.top: 60
3−border.bottom: 60
4−border.right: 54
5−source: bottomshape@18.png
Dash/People/graphics/icon_facebook@18.pngdeleted

Binary file not shown.

Dash/People/graphics/icon_offline@18.pngdeleted

Binary file not shown.

Dash/People/graphics/icon_online@18.pngdeleted

Binary file not shown.

Dash/People/graphics/icon_twitter@18.pngdeleted

Binary file not shown.

Dash/People/graphics/icon_unknown@18.pngdeleted

Binary file not shown.

Dash/People/graphics/icon_write_text@18.pngdeleted

Binary file not shown.

Dash/People/graphics/star_favourite@18.pngdeleted

Binary file not shown.

Dash/People/graphics/star_not_favourite@18.pngdeleted

Binary file not shown.

debian/control−1
@@ -38,7 +38,6 @@ Replaces: qml-phone-shell (<< 7.80~)
3838Breaks: qml-phone-shell (<< 7.80~)
3939Architecture: amd64 armhf i386
4040Depends: indicators-client (>= 0.6.1),
41− libunity-core-6.0-5 (>= 7.0.0daily13.06.07),
4241 qtdeclarative5-dee-plugin,
4342 qtdeclarative5-ubuntu-ui-toolkit-plugin,
4443 qtdeclarative5-xmllistmodel-plugin,
tests/qmltests/CMakeLists.txt−2
@@ -43,11 +43,9 @@ add_qml_test(Dash DashContent IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
4343add_qml_test(Dash DashPreview)
4444add_qml_test(Dash GenericLensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
4545add_qml_test(Dash LensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins)
46−add_qml_test(Dash PeoplePreview)
4746add_qml_test(Dash FilterGrids IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins
4847 ${CMAKE_BINARY_DIR}/tests/mocks)
4948add_qml_test(Dash/Apps RunningApplicationsGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
50−add_qml_test(Dash/People PeopleFilterGrid IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
5149add_qml_test(Greeter Lockscreen IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks
5250 PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
5351add_qml_test(Greeter Tablet IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks
tests/qmltests/Dash/People/tst_PeopleFilterGrid.qmldeleted−154
@@ -1,154 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import ".."
20−import "../.."
21−import "../../../../Dash/People"
22−import Ubuntu.Components 0.1
23−import Unity.Test 0.1 as UT
24−
25−Item {
26− id: root
27− width: units.gu(120)
28− height: units.gu(40)
29−
30− PeopleFilterGrid {
31− id: peopleFilterGrid
32− anchors.fill: parent
33− model: mockModel
34− }
35−
36− SignalSpy {
37− id: signalSpy
38− target: peopleFilterGrid
39− signalName: "clicked"
40− }
41−
42− ListModel {
43− id: mockModel
44−
45− ListElement {
46− column_0: 'user://001'
47− column_1: "gtk-apply"
48− column_2: ""
49− column_3: ""
50− column_4: "User 1"
51− column_5: "Text 1"
52− }
53−
54− ListElement {
55− column_0: 'user://002'
56− column_1: "gtk-apply"
57− column_2: ""
58− column_3: ""
59− column_4: "User 2"
60− column_5: "Text 2"
61− }
62−
63− ListElement {
64− column_0: 'user://003'
65− column_1: "gtk-apply"
66− column_2: ""
67− column_3: ""
68− column_4: "User 3"
69− column_5: "Text 3"
70− }
71−
72− ListElement {
73− column_0: 'user://004'
74− column_1: "gtk-apply"
75− column_2: ""
76− column_3: ""
77− column_4: "User 4"
78− column_5: "Text 4"
79− }
80−
81− ListElement {
82− column_0: 'user://005'
83− column_1: "gtk-apply"
84− column_2: ""
85− column_3: ""
86− column_4: "User 5"
87− column_5: "Text 5"
88− }
89−
90− }
91−
92− UT.UnityTestCase {
93− id: testCase
94− name: "DashPeopleFilterGrid"
95− when: windowShown
96−
97− function init() {
98− }
99−
100− function test_clickCell_data() {
101− return [
102− {
103− x: peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth/2,
104− y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
105− index: 0,
106− uri: "user://001"
107− },
108− {
109− x: 2*peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
110− y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
111− index: 1,
112− uri: "user://002"
113− },
114− {
115− x: 3*peopleFilterGrid.minimumHorizontalSpacing+2*peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
116− y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
117− index: 2,
118− uri: "user://003"
119− },
120− {
121− x: peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth/2,
122− y: 2*peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight+peopleFilterGrid.cellHeight/2,
123− index: 3,
124− uri: "user://004"
125− },
126− {
127− x: 2*peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
128− y: 2*peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight+peopleFilterGrid.cellHeight/2,
129− index: 4,
130− uri: "user://005"
131− },
132− ]
133− }
134−
135− function test_columns() {
136− compare(peopleFilterGrid.columns,3)
137− }
138−
139− function test_clickCell(data) {
140− tryCompare(peopleFilterGrid, "flicking", false)
141− tryCompare(peopleFilterGrid, "moving", false)
142− signalSpy.clear()
143− wait(peopleFilterGrid.pressDelay > 0 ? peopleFilterGrid.pressDelay : 5)
144− mouseClick(peopleFilterGrid, data.x, data.y)
145− tryCompare(peopleFilterGrid, "flicking", false)
146− tryCompare(peopleFilterGrid, "moving", false)
147− compare(signalSpy.count, 1)
148− compare(signalSpy.signalArguments.length, 1, "signalArguments.length != 1")
149− compare(signalSpy.signalArguments[0][0], data.index)
150− compare(signalSpy.signalArguments[0][1]["uri"], data.uri)
151− }
152−
153− }
154−}
tests/qmltests/Dash/tst_FilterGrids.qml−1
@@ -108,7 +108,6 @@ Rectangle {
108108 function test_clicked_signal_data() {
109109 return [
110110 {tag: "VideosFilterGrid", component: "Video/VideosFilterGrid.qml"},
111− {tag: "PeopleFilterGrid", component: "People/PeopleFilterGrid.qml"},
112111 {tag: "MusicFilterGrid", component: "Music/MusicFilterGrid.qml"},
113112 {tag: "ApplicationsFilterGrid", component: "Apps/ApplicationsFilterGrid.qml"}
114113 ]
tests/qmltests/Dash/tst_PeoplePreview.qmldeleted−254
@@ -1,254 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import ".."
20−import "../../../Dash/People"
21−import Ubuntu.Components 0.1
22−import Unity.Test 0.1 as UT
23−
24−Item {
25− id: root
26− width: units.gu(140)
27− height: units.gu(100)
28−
29− property bool helper: false
30−
31− PeoplePreview {
32− id: preview
33− anchors.fill: parent
34− anchors.rightMargin: units.gu(20)
35− }
36−
37− Column {
38− anchors {
39− left: preview.right
40− top: parent.top
41− right: parent.right
42− bottom: parent.bottom
43− margins: units.gu(1)
44− }
45− spacing: units.gu(1)
46−
47− Button {
48− text: "Clear all"
49− anchors { left: parent.left; right: parent.right }
50− onClicked: mockModel.clear();
51− }
52− Repeater {
53− model: testCase.test_click_items_data()
54− Button {
55− text: testCase.test_click_items_data()[index].tag
56− anchors { left: parent.left; right: parent.right }
57− onClicked: testCase.fillModel(testCase.test_click_items_data()[index]);
58− }
59− }
60− }
61−
62− ListModel {
63− id: mockModel
64− }
65−
66− SignalSpy {
67− id: clickSpy
68− signalName: "clicked"
69− }
70−
71− UT.UnityTestCase {
72− id: testCase
73− name: "PeoplePreview"
74− when: windowShown
75−
76− function fillModel(data) {
77− mockModel.clear();
78− mockModel.append(data);
79− preview.model = mockModel.get(0);
80− wait(0);
81− }
82−
83− function test_click_items_data() {
84− return [
85− {
86− tag: "All Data",
87− displayName: "Round Robin",
88− avatar: "../../graphics/clock.png",
89− status: "very busy",
90− statusTime: "1/6/2013 16:19:01",
91− statusServiceIcon: "../../../graphics/clock.png",
92− phoneNumbers: [{number:"123456", type: "voice", location: "Mars"}, {number: "654321"}],
93− emailAddresses: [{address:"robin@ntp.org"}, {address: "sirspamalot@foo.com"}],
94− imAccounts: [{address:"rr@jabber.org", protocol: "xmpp"}, {address: "sirspamalot@foo.com", protocol: "secret service messenger"}],
95− addresses: [
96− {street: "Middle of nowhere", poBox: 1, extension: "none", locality: "Mars", region: "all of it", postalCode: "٣٤٥٦", country: "There is only one on mars", addressFormat: "unreadable for you"},
97− {street: "Blue fin building"}
98− ]
99− },
100− {
101− tag: "Only Status",
102− status: "very busy",
103− statusTime: "1/6/2013 16:19:01",
104− statusServiceIcon: "../../../graphics/clock.png",
105− },
106− {
107− tag: "One Number",
108− phoneNumbers: [{number:"123456", type: "voice", location: "Mars"}],
109− },
110− {
111− tag: "Three Numbers",
112− phoneNumbers: [{number:"123456", type: "voice", location: "Mars"}, {number: "654321"}, {number: "666", type: "voice", location: "h3ll"}],
113− },
114− {
115− tag: "Only Mails",
116− emailAddresses: [{address:"robin@ntp.org"}, {address: "sirspamalot@foo.com"}],
117− },
118− {
119− tag: "Only IM",
120− imAccounts: [{address:"rr@jabber.org", protocol: "xmpp"}, {address: "sirspamalot@foo.com", protocol: "secret service messenger"}],
121− },
122− {
123− tag: "Only Address",
124− addresses: [
125− {street: "Middle of nowhere", poBox: 1, extension: "none", locality: "Mars", region: "all of it", postalCode: "٣٤٥٦", country: "There is only one on mars", addressFormat: "unreadable for you"},
126− ]
127− },
128− {
129− tag: "Std Contact",
130− displayName: "Round Robin",
131− avatar: "../../graphics/clock.png",
132− phoneNumbers: [{number:"123456", type: "voice", location: "Mars"}],
133− emailAddresses: [{address:"robin@ntp.org"}],
134− addresses: [
135− {street: "Middle of nowhere", poBox: 1, extension: "none", locality: "Mars", region: "all of it", postalCode: "٣٤٥٦", country: "There is only one on mars", addressFormat: "unreadable for you"},
136− {street: "Blue fin building"}
137− ]
138− },
139− {
140− tag: "Std + Status",
141− displayName: "Round Robin",
142− avatar: "../../graphics/clock.png",
143− status: "very busy",
144− statusTime: "1/6/2013 16:19:01",
145− statusServiceIcon: "../../../graphics/clock.png",
146− phoneNumbers: [{number:"123456", type: "voice", location: "Mars"}],
147− emailAddresses: [{address:"robin@ntp.org"}],
148− addresses: [
149− {street: "Middle of nowhere", poBox: 1, extension: "none", locality: "Mars", region: "all of it", postalCode: "٣٤٥٦", country: "There is only one on mars", addressFormat: "unreadable for you"},
150− {street: "Blue fin building"}
151− ]
152− },
153− ]
154− }
155−
156− function test_click_items(data) {
157− fillModel(data)
158−
159− // Check if status field is visible
160− var field = findChild(preview, "statusField");
161− if (data.status != undefined) {
162− compare(field.visible, true, "status field is not visible");
163− verifyClick(field);
164− } else {
165− compare(field.visible, false, "status field is visible while it should not");
166− }
167−
168− // Check if there are phoneNumber.count phone fields
169− var i = 0;
170− if (data.phoneNumbers != undefined) {
171− for (; i < data.phoneNumbers.length; ++i) {
172− var field = findChild(preview, "phoneField" + i);
173− verify(field != undefined);
174− verifyPhoneNumberClick(field);
175− }
176− i++;
177− }
178− // Check if there are no more phone fields
179− var field = findChild(preview, "phoneField" + i);
180− compare(field, undefined, "There is a phone number field too much!");
181−
182−
183− // Check if email adresses are here
184− var i = 0;
185− if (data.emailAddresses != undefined) {
186− for (; i < data.emailAddresses.length; ++i) {
187− var field = findChild(preview, "emailField" + i);
188− verify(field != undefined);
189− verifyClick(field);
190− }
191− i++;
192− }
193− // Check if there are no more email fields
194− var field = findChild(preview, "emailField" + i);
195− compare(field, undefined, "There is a email field too much!");
196−
197−
198− // Check if IM accounts are here
199− var i = 0;
200− if (data.imAccounts != undefined) {
201− for (; i < data.imAccounts.length; ++i) {
202− var field = findChild(preview, "imField" + i);
203− verify(field != undefined);
204− verifyClick(field);
205− }
206− i++;
207− }
208− // Check if there are no more IM fields
209− var field = findChild(preview, "imField" + i);
210− compare(field, undefined, "There is a IM field too much!");
211−
212− // Check if email adresses are here
213− var i = 0;
214− if (data.addresses != undefined) {
215− for (; i < data.addresses.length; ++i) {
216− var field = findChild(preview, "addressField" + i);
217− verify(field != undefined);
218− verifyClick(field);
219− }
220− i++;
221− }
222− // Check if there are no more fields fields
223− var field = findChild(preview, "addressField" + i);
224− compare(field, undefined, "There is an address field too much!");
225− }
226−
227− function verifyClick(field) {
228− waitForRendering(field)
229− clickSpy.signalName = "" // Get rid of a warning if new target doesn't support previous signal name
230− clickSpy.target = field;
231− clickSpy.clear();
232− clickSpy.signalName = "clicked";
233− compare(clickSpy.count, 0, "Could not reset signal spy");
234− mouseClick(field, field.width / 2, field.height / 2);
235− compare(clickSpy.count, 1, "Could not click on field " + field);
236− }
237−
238− function verifyPhoneNumberClick(field) {
239− waitForRendering(field)
240− clickSpy.target = field;
241− clickSpy.clear();
242− clickSpy.signalName = "phoneClicked";
243− compare(clickSpy.count, 0, "Could not reset signal spy");
244− mouseClick(field, 1 , field.height / 2);
245− compare(clickSpy.count, 1, "Could not click on phone field");
246−
247− clickSpy.clear();
248− clickSpy.signalName = "textClicked";
249− compare(clickSpy.count, 0, "Could not reset signal spy");
250− mouseClick(field, field.width - 1 , field.height / 2);
251− compare(clickSpy.count, 1, "Could not click on Message field");
252− }
253− }
254−}