on xenial help sign in
need to pass the categoryId when calling preview()
86ca82aAlbert Astals Cid
qml/Dash/GenericScopeView.qml+13−3
@@ -71,12 +71,14 @@ FocusScope {
71 property var maybePreviewIndex;
71 property var maybePreviewIndex;
72 property var maybePreviewResultsModel;
72 property var maybePreviewResultsModel;
73 property var maybePreviewLimitedCategoryItemCount;
73 property var maybePreviewLimitedCategoryItemCount;
74+ property string maybePreviewCategoryId;
74
75
75 function itemClicked(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
76 function itemClicked(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
76 scopeView.maybePreviewResult = result;
77 scopeView.maybePreviewResult = result;
77 scopeView.maybePreviewIndex = index;
78 scopeView.maybePreviewIndex = index;
78 scopeView.maybePreviewResultsModel = resultsModel;
79 scopeView.maybePreviewResultsModel = resultsModel;
79 scopeView.maybePreviewLimitedCategoryItemCount = limitedCategoryItemCount;
80 scopeView.maybePreviewLimitedCategoryItemCount = limitedCategoryItemCount;
81+ scopeView.maybePreviewCategoryId = categoryId;
80
82
81 scope.activate(result, categoryId);
83 scope.activate(result, categoryId);
82 }
84 }
@@ -86,13 +88,14 @@ FocusScope {
86 scopeView.maybePreviewIndex = undefined;
88 scopeView.maybePreviewIndex = undefined;
87 scopeView.maybePreviewResultsModel = undefined;
89 scopeView.maybePreviewResultsModel = undefined;
88 scopeView.maybePreviewLimitedCategoryItemCount = undefined;
90 scopeView.maybePreviewLimitedCategoryItemCount = undefined;
91+ scopeView.maybePreviewCategoryId = undefined;
89
92
90 if (scope.preview(result, categoryId)) {
93 if (scope.preview(result, categoryId)) {
91− openPreview(index, resultsModel, limitedCategoryItemCount);
94+ openPreview(index, resultsModel, limitedCategoryItemCount, categoryId);
92 }
95 }
93 }
96 }
94
97
95− function openPreview(index, resultsModel, limitedCategoryItemCount) {
98+ function openPreview(index, resultsModel, limitedCategoryItemCount, categoryId) {
96 if (limitedCategoryItemCount > 0) {
99 if (limitedCategoryItemCount > 0) {
97 previewLimitModel.model = resultsModel;
100 previewLimitModel.model = resultsModel;
98 previewLimitModel.limit = limitedCategoryItemCount;
101 previewLimitModel.limit = limitedCategoryItemCount;
@@ -102,6 +105,7 @@ FocusScope {
102 }
105 }
103 subPageLoader.initialIndex = -1;
106 subPageLoader.initialIndex = -1;
104 subPageLoader.initialIndex = index;
107 subPageLoader.initialIndex = index;
108+ subPageLoader.categoryId = categoryId;
105 subPageLoader.openSubPage("preview");
109 subPageLoader.openSubPage("preview");
106 }
110 }
107
111
@@ -151,10 +155,14 @@ FocusScope {
151 onPreviewRequested: { // (QVariant const& result)
155 onPreviewRequested: { // (QVariant const& result)
152 if (result === scopeView.maybePreviewResult) {
156 if (result === scopeView.maybePreviewResult) {
153 scopeView.maybePreviewResult = undefined;
157 scopeView.maybePreviewResult = undefined;
158+ openPreview(scopeView.maybePreviewIndex,
159+ scopeView.maybePreviewResultsModel,
154− openPreview(scopeView.maybePreviewIndex, scopeView.maybePreviewResultsModel, scopeView.maybePreviewLimitedCategoryItemCount);
160+ scopeView.maybePreviewLimitedCategoryItemCount,
161+ scopeView.maybePreviewCategoryId);
155 scopeView.maybePreviewIndex = undefined;
162 scopeView.maybePreviewIndex = undefined;
156 scopeView.maybePreviewResultsModel = undefined;
163 scopeView.maybePreviewResultsModel = undefined;
157 scopeView.maybePreviewLimitedCategoryItemCount = undefined;
164 scopeView.maybePreviewLimitedCategoryItemCount = undefined;
165+ scopeView.maybePreviewCategoryId = undefined;
158 }
166 }
159 }
167 }
160 }
168 }
@@ -737,6 +745,7 @@ FocusScope {
737 property var scope: scopeView.scope
745 property var scope: scopeView.scope
738 property var scopeStyle: scopeView.scopeStyle
746 property var scopeStyle: scopeView.scopeStyle
739 property int initialIndex: -1
747 property int initialIndex: -1
748+ property string categoryId
740 property var model: null
749 property var model: null
741
750
742 readonly property bool processing: item && item.processing || false
751 readonly property bool processing: item && item.processing || false
@@ -768,6 +777,7 @@ FocusScope {
768 item.open = Qt.binding(function() { return subPageLoader.open; } )
777 item.open = Qt.binding(function() { return subPageLoader.open; } )
769 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
778 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
770 item.model = Qt.binding(function() { return subPageLoader.model; } )
779 item.model = Qt.binding(function() { return subPageLoader.model; } )
780+ item.categoryId = Qt.binding(function() { return subPageLoader.categoryId; } )
771 }
781 }
772 open = true;
782 open = true;
773 }
783 }
qml/Dash/PreviewListView.qml+2−1
@@ -26,6 +26,7 @@ Item {
26 property int initialIndex: -1
26 property int initialIndex: -1
27 property var scope: null
27 property var scope: null
28 property var scopeStyle: null
28 property var scopeStyle: null
29+ property string categoryId
29
30
30 property alias showSignatureLine: header.showSignatureLine
31 property alias showSignatureLine: header.showSignatureLine
31
32
@@ -99,7 +100,7 @@ Item {
99 isCurrent: ListView.isCurrentItem
100 isCurrent: ListView.isCurrentItem
100
101
101 previewModel: {
102 previewModel: {
102− var previewStack = root.scope.preview(result);
103+ var previewStack = root.scope.preview(result, root.categoryId);
103 return previewStack.getPreviewModel(0);
104 return previewStack.getPreviewModel(0);
104 }
105 }
105 scopeStyle: root.scopeStyle
106 scopeStyle: root.scopeStyle