@@ -151,14 +151,14 @@ Popup {
151151 readonly property real paddingColumns: 0.3
152152 readonly property int horizontalPadding: contentRoot .width * paddingColumns
153153 anchors .fill : parent
154-
154+ property bool createdEmptyPage : false
155155
156156 function checkDragMove () {
157157 if (drag .x < horizontalPadding) {
158158 pageIntent = - 1
159159 } else if (drag .x > (width - horizontalPadding)) {
160160 let isLastPage = folderPagesView .currentIndex === folderPagesView .count - 1
161- if (isLastPage) {
161+ if (isLastPage && folderPageDropArea . createdEmptyPage ) {
162162 return
163163 }
164164 pageIntent = 1
@@ -181,6 +181,7 @@ Popup {
181181 let dragId = drop .getDataAsString (" text/x-dde-launcher-dnd-desktopId" )
182182 dropOnPage (dragId, " internal/folders/" + folderLoader .currentFolderId , folderPagesView .currentIndex )
183183 pageIntent = 0
184+ createdEmptyPage = false
184185 }
185186 onExited: {
186187 pageIntent = 0
@@ -198,7 +199,16 @@ Popup {
198199 interval: 1000
199200 onTriggered: {
200201 if (parent .pageIntent > 0 ) {
201- incrementPageIndex (folderPagesView)
202+ let isLastPage = (folderPagesView .currentIndex === folderPagesView .count - 1 )
203+ if (isLastPage && ! folderPageDropArea .createdEmptyPage ) {
204+ let newPageIndex = ItemArrangementProxyModel .creatEmptyPage (folderLoader .currentFolderId )
205+ folderPageDropArea .createdEmptyPage = true
206+ folderPagesView .setCurrentIndex (newPageIndex)
207+ parent .pageIntent = 0
208+ return
209+ }else {
210+ incrementPageIndex (folderPagesView)
211+ }
202212 } else if (parent .pageIntent < 0 ) {
203213 decrementPageIndex (folderPagesView)
204214 }
@@ -240,6 +250,14 @@ Popup {
240250
241251 currentIndex: folderPageIndicator .currentIndex
242252
253+ Connections {
254+ target: ItemArrangementProxyModel
255+ function onFolderPageCountChanged (folderId ) {
256+ if (folderId === folderLoader .currentFolderId ) {
257+ gridViews .model = ItemArrangementProxyModel .pageCount (folderId)
258+ }
259+ }
260+ }
243261 Repeater {
244262 id: gridViews
245263 model: ItemArrangementProxyModel .pageCount (folderLoader .currentFolderId ) // FIXME: should be a property?
0 commit comments