Qt: bring over the WebView build's home screen
The WebView build saved its home in its page's localStorage, which stays in the app's data now that the Qt build is dev.ultra.launcher. On first start HomeActivity reads the ultra.home.* keys through a throwaway WebView on the same origin and hands them to QML: apps by component, widgets with their px heights turned into rows, pins kept when the Qt home is still empty. The widget host id goes back to the WebView build's, so its widgets stay bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hiQsCq11CwCPnKPp9D
This commit is contained in:
8 files changed
+130
-2
No files matched your search
@@ -91,6 +91,26 @@ Window {
|
||||
home = out;
|
||||
}
|
||||
|
||||
// Bring over the WebView build's home screen (once, on Android). An empty Qt home
|
||||
// takes it as it was; otherwise whatever isn't here yet goes after it, unpinned.
|
||||
function importLegacy(json) {
|
||||
let kv;
|
||||
try { kv = JSON.parse(json); } catch (e) { return; }
|
||||
const old = L.legacy(kv || {});
|
||||
if (old.length === 0) return;
|
||||
const has = {};
|
||||
for (const s of home) has[s.kind === "widget" ? "w" + s.wid : "a" + s.str] = true;
|
||||
const fresh = home.length === 0;
|
||||
for (const s of old) {
|
||||
if (home.length >= homeCap) break;
|
||||
if (has[s.kind === "widget" ? "w" + s.wid : "a" + s.str]) continue;
|
||||
if (!fresh) { s.x = -1; s.y = -1; }
|
||||
home.push(s);
|
||||
}
|
||||
commit();
|
||||
say("Brought over your home screen");
|
||||
}
|
||||
|
||||
function loadApps() {
|
||||
const list = Host.apps();
|
||||
const rows = {};
|
||||
@@ -391,6 +411,7 @@ Window {
|
||||
}
|
||||
function onWidgetDrop(moved) { root.drop(moved) }
|
||||
function onToast(text) { root.say(text) }
|
||||
function onLegacyHome(json) { root.importLegacy(json) }
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
Reference in new issue
Block a user