@@ -19,136 +19,15 @@ import Ubuntu.Components 0.1
19import Utils 0.1
19import Utils 0.1
20import "../Components"
20import "../Components"
21import "../Components/ListItems"
21import "../Components/ListItems"
22−import "../Applications"
23import "Apps"
22import "Apps"
27−ScopeView {
24+GenericScopeView {
29 objectName: "DashHome"
26 objectName: "DashHome"
31− onMovementStarted: listView.showHeader()
34− id: categoryListModel
35− // specifies page's content categories, type of delegate and model used in each category
36− ListElement { category: "Frequent Apps"; component: "Apps/ApplicationsFilterGrid.qml"; modelName: "AppsModel" }
37− ListElement { category: "Recent Music"; component: "Music/MusicFilterGrid.qml"; modelName: "MusicModel" }
38− ListElement { category: "Videos Popular Online"; component: "Video/VideosFilterGrid.qml"; modelName: "VideosModel" }
39− function getCategory(category1) {
40− if (category1 === "Frequent Apps") {
41− return i18n.tr("Frequent Apps");
43− if (category1 === "Recent Music") {
44− return i18n.tr("Recent Music");
46− if (category1 === "Videos Popular Online") {
47− return i18n.tr("Videos Popular Online");
53 FrequentlyUsedAppsModel { id: appsModel }
28 FrequentlyUsedAppsModel { id: appsModel }
55− // FIXME this should be handled by the backends by populating the global search model
30+ onScopeChanged: {
56− property var musicModel: null
31+ root.scope.categories.overrideCategory("applications.scope", appsModel.model);
57− property var videosModel: null
63− Component.onCompleted: if (index == 1) musicModel = Qt.binding(function() { return model.results; });
71− Component.onCompleted: if (index == 3) videosModel = Qt.binding(function() { return model.results; });
75− Component.onCompleted: {
76− var scope = dashContent.scopes.get("mockmusicmaster.scope")
78− musicRepeater.model = dashContent.scopes.get("mockmusicmaster.scope").categories
80− scope = dashContent.scopes.get("mockvideosmaster.scope")
82− videosRepeater.model = dashContent.scopes.get("mockvideosmaster.scope").categories
88− onScopeLoaded: switch (scopeId) {
89− case "mockmusicmaster.scope":
90− musicRepeater.model = dashContent.scopes.get("mockmusicmaster.scope").categories
92− case "mockvideosmaster.scope":
93− videosRepeater.model = dashContent.scopes.get("mockvideosmaster.scope").categories
98− property var categoryModels: {"AppsModel": appsModel,
99− "MusicModel": musicModel,
100− "VideosModel": videosModel,
105− anchors.fill: parent
106− model: categoryListModel
108− onAtYEndChanged: if (atYEnd) endReached()
109− onMovingChanged: if (moving && atYEnd) endReached()
113− highlightWhenPressed: false
114− width: listView.width
117− anchors { top: parent.top; left: parent.left; right: parent.right }
120− item.model = Qt.binding(function() { return categoryModels[modelName]; });
122− //FIXME: workaround for lack of previews for videos in Home scope.
123− //Need to connect to the clicked() signal here and act upon it here instead.
124− if (modelName === "VideosModel") {
125− function playVideo(index, data) {
127− shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', "/usr/share/demo-assets/videos/" + data.fileUri);
131− item.clicked.connect(playVideo);
132− } else if (modelName === "AppsModel") {
133− function activateApplication(index, data) {
134− shell.activateApplication(data);
137− item.objectName = "dashHomeApplicationsGrid";
138− item.clicked.connect(activateApplication);
144− sectionProperty: "category"
145− sectionDelegate: Header {
146− width: listView.width
147− text: listView.model.getCategory(section)
149− pageHeader: PageHeader {
150− width: listView.width
151− text: i18n.tr("Home")