Skip to content

Commit

Permalink
Go back to folder afer leaving Homepage & Show current folder in title.
Browse files Browse the repository at this point in the history
Closes #147
  • Loading branch information
DavidLazarescu committed Mar 29, 2024
1 parent df42a9d commit 4143ba3
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/presentation/homePage/MHomePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ Page {
if (!(pageManager.prevPage instanceof MLoginPage)) {
feedbackTimer.start()
}
}

LibraryController.libraryModel.folder = "all"
Component.onDestruction: {
toolbar.selectBooksCheckBoxActivated = false
}

// Add a slight delay to showing the feedback timer
Expand Down Expand Up @@ -188,8 +190,21 @@ Page {
Layout.topMargin: updateBanner.visible ? 24 : 44
//: As in 'Home Page', might be closer to 'Start' in other languages
titleText: qsTr("Home")
descriptionText: qsTr("You have %1 books").arg(
LibraryController.bookCount)
descriptionText: {
let folder = LibraryController.libraryModel.folder
if (folder === "all") {
return qsTr("You have %1 books").arg(
LibraryController.bookCount)
}

let sentence = qsTr("In Folder") + ": "
if (folder === "unsorted") {
return sentence + qsTr("Unsorted")
}

let folderName = FolderController.getFolder(folder).name
return sentence + folderName
}
}

Item {
Expand Down Expand Up @@ -807,8 +822,6 @@ Page {
}
}

Component.onDestruction: toolbar.selectBooksCheckBoxActivated = false

QtObject {
id: internal
property bool libraryIsEmpty: LibraryController.bookCount === 0
Expand Down

0 comments on commit 4143ba3

Please sign in to comment.