@@ -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,9 +181,11 @@ 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
188+ createdEmptyPage = false
187189 }
188190 onPageIntentChanged: {
189191 if (pageIntent !== 0 ) {
@@ -198,7 +200,16 @@ Popup {
198200 interval: 1000
199201 onTriggered: {
200202 if (parent .pageIntent > 0 ) {
201- incrementPageIndex (folderPagesView)
203+ let isLastPage = (folderPagesView .currentIndex === folderPagesView .count - 1 )
204+ if (isLastPage && ! folderPageDropArea .createdEmptyPage ) {
205+ let newPageIndex = ItemArrangementProxyModel .creatEmptyPage (folderLoader .currentFolderId )
206+ folderPageDropArea .createdEmptyPage = true
207+ folderPagesView .setCurrentIndex (newPageIndex)
208+ parent .pageIntent = 0
209+ return
210+ }else {
211+ incrementPageIndex (folderPagesView)
212+ }
202213 } else if (parent .pageIntent < 0 ) {
203214 decrementPageIndex (folderPagesView)
204215 }
@@ -240,6 +251,14 @@ Popup {
240251
241252 currentIndex: folderPageIndicator .currentIndex
242253
254+ Connections {
255+ target: ItemArrangementProxyModel
256+ function onFolderPageCountChanged (folderId ) {
257+ if (folderId === folderLoader .currentFolderId ) {
258+ gridViews .model = ItemArrangementProxyModel .pageCount (folderId)
259+ }
260+ }
261+ }
243262 Repeater {
244263 id: gridViews
245264 model: ItemArrangementProxyModel .pageCount (folderLoader .currentFolderId ) // FIXME: should be a property?
0 commit comments