Skip to content

Commit

Permalink
Update updateModels logic
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia committed Jul 7, 2021
1 parent 0f48dab commit 4934493
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions contents/ui/MainColumnItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ Item {
property var recommendedModel: plasmoid.configuration.recentGridModel == 0 ? rootModel.modelForRow(1) : plasmoid.configuration.recentGridModel == 1 ? rootModel.modelForRow(0) : globalFavorites
property var allAppsModel: rootModel.modelForRow(2)

function updateModels() {
pinnedModel = plasmoid.configuration.favGridModel == 0 ? globalFavorites : plasmoid.configuration.favGridModel == 1 ? rootModel.modelForRow(0) : rootModel.modelForRow(1)
recommendedModel = plasmoid.configuration.recentGridModel == 0 ? rootModel.modelForRow(1) : plasmoid.configuration.recentGridModel == 1 ? rootModel.modelForRow(0) : globalFavorites
allAppsModel = rootModel.modelForRow(2)
}

function reset() {
if (showRecents) resetPinned.start();
searchField.clear()
Expand All @@ -76,9 +82,9 @@ Item {
function reload() {
mainColumn.visible = false
recentItem.visible = false
globalFavoritesGrid.model = null
documentsFavoritesGrid.model = null
allAppsGrid.model = null
pinnedModel = null
recommendedModel = null
allAppsModel = null
preloadAllAppsTime.done = false
preloadAllAppsTime.defer()
}
Expand Down Expand Up @@ -135,9 +141,7 @@ Item {
if (done) {
return;
}
globalFavoritesGrid.model = plasmoid.configuration.favGridModel == 0 ? globalFavorites : plasmoid.configuration.favGridModel == 1 ? rootModel.modelForRow(0) : rootModel.modelForRow(1)
documentsFavoritesGrid.model = plasmoid.configuration.recentGridModel == 0 ? rootModel.modelForRow(1) : plasmoid.configuration.recentGridModel == 1 ? rootModel.modelForRow(0) : globalFavorites
allAppsGrid.model = rootModel.modelForRow(2)
item.updateModels()
done = true;
mainColumn.visible = true
recentItem.visible = true
Expand Down

0 comments on commit 4934493

Please sign in to comment.