Commit d96d748f authored by David Redondo's avatar David Redondo 🏎
Browse files

Switch away from removed pages

When we are showing a page that was deleted or hidden, switch back
either to the starting page or if the starting page would be the
removed page the overview page.
BUG:437499


(cherry picked from commit ca1c8cec)
parent 5ef9aa22
......@@ -224,6 +224,15 @@ Kirigami.ApplicationWindow {
startPage: config.startPage
onAccepted: {
config.startPage = startPage
const currentPage = pageStack.currentItem.pageData.fileName
const indices = pagesModel.match(pagesModel.index(0, 0), Page.PagesModel.FileNameRole, currentPage, 1, Qt.MatchExactly)
if (indices.length == 0 || pagesModel.data(indices[0], Page.PagesModel.HiddenRole)) {
if (config.lastVisitedPage == currentPage) {
config.lastVisitedPage = "overview.page"
}
const startPage = config.startPage || config.lastVisitedPage
Array.prototype.find.call(globalDrawer.actions, action => action.pageData.fileName == startPage).trigger()
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment