[app] Make pulley menus initially invisible
They will be made visible by BooksMainPage when needed.
This commit is contained in:
parent
b74d57291c
commit
6c2354d2e5
3 changed files with 16 additions and 10 deletions
|
@ -134,6 +134,8 @@ Item {
|
||||||
PullDownMenu {
|
PullDownMenu {
|
||||||
id: menu
|
id: menu
|
||||||
|
|
||||||
|
visible: false // BooksMainPage will make it visible when it's needed
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
//: Pulley menu item
|
//: Pulley menu item
|
||||||
//% "Settings"
|
//% "Settings"
|
||||||
|
|
|
@ -47,23 +47,26 @@ Page {
|
||||||
|
|
||||||
Component.onCompleted: createBookViewIfNeeded()
|
Component.onCompleted: createBookViewIfNeeded()
|
||||||
|
|
||||||
onCurrentViewChanged: setPullDownMenu(currentView ? currentView.pullDownMenu : null)
|
onCurrentViewChanged: updatePullDownMenu()
|
||||||
|
|
||||||
function createBookViewIfNeeded() {
|
function createBookViewIfNeeded() {
|
||||||
if (Settings.currentBook && !bookView) {
|
if (Settings.currentBook && !bookView) {
|
||||||
bookView = bookViewComponent.createObject(flickable.contentItem)
|
bookView = bookViewComponent.createObject(flickable.contentItem)
|
||||||
|
updatePullDownMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPullDownMenu(menu) {
|
function updatePullDownMenu() {
|
||||||
|
var menu = currentView ? currentView.pullDownMenu : null
|
||||||
|
if (menu) {
|
||||||
|
menu.visible = true
|
||||||
|
}
|
||||||
if (flickable.pullDownMenu !== menu) {
|
if (flickable.pullDownMenu !== menu) {
|
||||||
if (flickable.pullDownMenu) {
|
var prevMenu = flickable.pullDownMenu
|
||||||
flickable.pullDownMenu.visible = false
|
|
||||||
}
|
|
||||||
if (menu) {
|
|
||||||
menu.visible = true
|
|
||||||
}
|
|
||||||
flickable.pullDownMenu = menu
|
flickable.pullDownMenu = menu
|
||||||
|
if (prevMenu) {
|
||||||
|
prevMenu.visible = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +77,7 @@ Page {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: currentView
|
target: currentView
|
||||||
onPullDownMenuChanged: setPullDownMenu(currentView.pullDownMenu)
|
onPullDownMenuChanged: updatePullDownMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
SilicaFlickable {
|
SilicaFlickable {
|
||||||
|
@ -83,7 +86,6 @@ Page {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
flickableDirection: Flickable.VerticalFlick
|
flickableDirection: Flickable.VerticalFlick
|
||||||
interactive: currentView && currentView.viewInteractive
|
interactive: currentView && currentView.viewInteractive
|
||||||
pullDownMenu: currentView ? currentView.pullDownMenu : null
|
|
||||||
|
|
||||||
BooksStorageView {
|
BooksStorageView {
|
||||||
id: storageView
|
id: storageView
|
||||||
|
|
|
@ -96,6 +96,8 @@ Item {
|
||||||
PullDownMenu {
|
PullDownMenu {
|
||||||
id: menu
|
id: menu
|
||||||
|
|
||||||
|
visible: false // BooksMainPage will make it visible when it's needed
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
//: Pulley menu item
|
//: Pulley menu item
|
||||||
//% "Settings"
|
//% "Settings"
|
||||||
|
|
Loading…
Reference in a new issue