on xenial help sign in
Don't move the list contentY unless there's a preview to show
88ffb54Albert Astals
qml/Dash/DashContent.qml+1−1
@@ -149,7 +149,7 @@ Item {
149 ignoreUnknownSignals: true
149 ignoreUnknownSignals: true
150 onEndReached: contentEndReached()
150 onEndReached: contentEndReached()
151 }
151 }
152−
152+Component.onCompleted: console.log("SDFDFSD", scope.id)
153 Component.onDestruction: active = false
153 Component.onDestruction: active = false
154 }
154 }
155 }
155 }
qml/Dash/GenericScopeView.qml+4−4
@@ -186,10 +186,10 @@ FocusScope {
186 onClicked: {
186 onClicked: {
187 // Prepare the preview in case activate() triggers a preview only
187 // Prepare the preview in case activate() triggers a preview only
188 openEffect.positionPx = Math.max(mapToItem(categoryView, 0, itemY).y, pageHeader.height + categoryView.stickyHeaderHeight);
188 openEffect.positionPx = Math.max(mapToItem(categoryView, 0, itemY).y, pageHeader.height + categoryView.stickyHeaderHeight);
189+ previewListView.needsInit = true;
189 previewListView.categoryId = categoryId
190 previewListView.categoryId = categoryId
190 previewListView.categoryDelegate = rendererLoader.item
191 previewListView.categoryDelegate = rendererLoader.item
191 previewListView.model = target.model;
192 previewListView.model = target.model;
192− previewListView.init = true;
193 previewListView.currentIndex = index;
193 previewListView.currentIndex = index;
194
194
195 var item = target.model.get(index);
195 var item = target.model.get(index);
@@ -207,10 +207,10 @@ FocusScope {
207 }
207 }
208 onPressAndHold: {
208 onPressAndHold: {
209 openEffect.positionPx = Math.max(mapToItem(categoryView, 0, itemY).y, pageHeader.height + categoryView.stickyHeaderHeight);
209 openEffect.positionPx = Math.max(mapToItem(categoryView, 0, itemY).y, pageHeader.height + categoryView.stickyHeaderHeight);
210+ previewListView.needsInit = true;
210 previewListView.categoryId = categoryId
211 previewListView.categoryId = categoryId
211 previewListView.categoryDelegate = rendererLoader.item
212 previewListView.categoryDelegate = rendererLoader.item
212 previewListView.model = target.model;
213 previewListView.model = target.model;
213− previewListView.init = true;
214 previewListView.currentIndex = index;
214 previewListView.currentIndex = index;
215 previewListView.open = true
215 previewListView.open = true
216
216
@@ -364,7 +364,7 @@ FocusScope {
364 Connections {
364 Connections {
365 target: scopeView.scope
365 target: scopeView.scope
366 onPreviewReady: {
366 onPreviewReady: {
367− if (previewListView.init) {
367+ if (previewListView.needsInit) {
368 // Preview was triggered because of a click on the item. Need to expand now.
368 // Preview was triggered because of a click on the item. Need to expand now.
369 if (!previewListView.open) {
369 if (!previewListView.open) {
370 previewListView.open = true
370 previewListView.open = true
@@ -372,8 +372,8 @@ FocusScope {
372
372
373 var index = previewListView.currentIndex
373 var index = previewListView.currentIndex
374 previewListView.currentIndex = -1
374 previewListView.currentIndex = -1
375+ previewListView.needsInit = false
375 previewListView.currentIndex = index
376 previewListView.currentIndex = index
376− previewListView.init = false
377 }
377 }
378 previewListView.currentItem.previewData = preview
378 previewListView.currentItem.previewData = preview
379 }
379 }
qml/Dash/PreviewListView.qml+7−3
@@ -28,7 +28,7 @@ Item {
28 property alias onScreen: previewListView.onScreen
28 property alias onScreen: previewListView.onScreen
29 property alias categoryId: previewListView.categoryId
29 property alias categoryId: previewListView.categoryId
30 property alias categoryDelegate: previewListView.categoryDelegate
30 property alias categoryDelegate: previewListView.categoryDelegate
31− property alias init: previewListView.init
31+ property alias needsInit: previewListView.needsInit
32 property alias model: previewListView.model
32 property alias model: previewListView.model
33 property alias currentIndex: previewListView.currentIndex
33 property alias currentIndex: previewListView.currentIndex
34 property alias currentItem: previewListView.currentItem
34 property alias currentItem: previewListView.currentItem
@@ -81,13 +81,17 @@ Item {
81 // because the ListView is built asynchronous, setting the
81 // because the ListView is built asynchronous, setting the
82 // currentIndex directly won't work. We need to refresh it
82 // currentIndex directly won't work. We need to refresh it
83 // when the first preview is ready to be displayed.
83 // when the first preview is ready to be displayed.
84− property bool init: true
84+ property bool needsInit: true
85
85
86 PreviewDelegateMapper {
86 PreviewDelegateMapper {
87 id: previewDelegateMapper
87 id: previewDelegateMapper
88 }
88 }
89
89
90 onCurrentIndexChanged: {
90 onCurrentIndexChanged: {
91+ if (needsInit) {
92+ return;
93+ }
94+
91 var row = Math.floor(currentIndex / categoryDelegate.columns);
95 var row = Math.floor(currentIndex / categoryDelegate.columns);
92 if (categoryDelegate.collapsedRowCount <= row) {
96 if (categoryDelegate.collapsedRowCount <= row) {
93 categoryView.expandedCategoryId = categoryId
97 categoryView.expandedCategoryId = categoryId
@@ -97,7 +101,7 @@ Item {
97 categoryDelegate.highlightIndex = currentIndex
101 categoryDelegate.highlightIndex = currentIndex
98 }
102 }
99
103
100− if (!init && model !== undefined) {
104+ if (model !== undefined) {
101 var item = model.get(currentIndex)
105 var item = model.get(currentIndex)
102 scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
106 scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
103 }
107 }