Changeset View
Changeset View
Standalone View
Standalone View
src/controls/PagePoolAction.qml
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 17 | Kirigami.Action { | |||
---|---|---|---|---|---|
44 | 44 | | |||
45 | /** | 45 | /** | ||
46 | * basePage: Kirigami.Page | 46 | * basePage: Kirigami.Page | ||
47 | * The page of pageStack new pages will be pushed after. | 47 | * The page of pageStack new pages will be pushed after. | ||
48 | * All pages present after the given basePage will be removed from the pageStack | 48 | * All pages present after the given basePage will be removed from the pageStack | ||
49 | */ | 49 | */ | ||
50 | property Controls.Page basePage | 50 | property Controls.Page basePage | ||
51 | 51 | | |||
52 | /** | ||||
53 | * initialProperties: JavaScript Object | ||||
54 | * The properties object specifies a map of initial property values for the created page | ||||
55 | * when it is pushed onto the Kirigami.PagePool. | ||||
56 | */ | ||||
57 | property var initialProperties | ||||
mart: initialProperties | |||||
58 | | ||||
52 | checked: pagePool && pagePool.resolvedUrl(page) == pagePool.lastLoadedUrl | 59 | checked: pagePool && pagePool.resolvedUrl(page) == pagePool.lastLoadedUrl | ||
53 | onTriggered: { | 60 | onTriggered: { | ||
54 | if (page.length == 0 || !pagePool || !pageStack) { | 61 | if (page.length == 0 || !pagePool || !pageStack) { | ||
55 | return; | 62 | return; | ||
56 | } | 63 | } | ||
57 | 64 | | |||
58 | if (pagePool.resolvedUrl(page) == pagePool.lastLoadedUrl) { | 65 | if (pagePool.resolvedUrl(page) == pagePool.lastLoadedUrl) { | ||
59 | return; | 66 | return; | ||
60 | } | 67 | } | ||
61 | 68 | | |||
62 | if (!pageStack.hasOwnProperty("pop") || typeof pageStack.pop !== "function" || !pageStack.hasOwnProperty("push") || typeof pageStack.push !== "function") { | 69 | if (!pageStack.hasOwnProperty("pop") || typeof pageStack.pop !== "function" || !pageStack.hasOwnProperty("push") || typeof pageStack.push !== "function") { | ||
63 | return; | 70 | return; | ||
64 | } | 71 | } | ||
65 | 72 | | |||
66 | if (pagePool.isLocalUrl(page)) { | 73 | if (pagePool.isLocalUrl(page)) { | ||
67 | if (basePage) { | 74 | if (basePage) { | ||
68 | pageStack.pop(basePage); | 75 | pageStack.pop(basePage); | ||
69 | } else { | 76 | } else { | ||
70 | pageStack.clear(); | 77 | pageStack.clear(); | ||
71 | } | 78 | } | ||
72 | pageStack.push(pagePool.loadPage(page)); | 79 | | ||
80 | pageStack.push(properties ? | ||||
81 | pagePool.loadPageWithProperties(page, properties) : | ||||
82 | pagePool.loadPage(page)); | ||||
73 | } else { | 83 | } else { | ||
74 | pagePool.loadPage(page, function(item) { | 84 | pagePool.loadPage(page, function(item) { | ||
75 | if (basePage) { | 85 | if (basePage) { | ||
76 | pageStack.pop(basePage); | 86 | pageStack.pop(basePage); | ||
77 | } else { | 87 | } else { | ||
78 | pageStack.clear(); | 88 | pageStack.clear(); | ||
79 | } | 89 | } | ||
80 | pageStack.push(item); | 90 | pageStack.push(item); | ||
81 | }); | 91 | }); | ||
82 | } | 92 | } | ||
83 | } | 93 | } | ||
84 | } | 94 | } |
initialProperties