feat(calendar): remember .pst path, add auto-sync-on-launch toggle

Prefills the file path from settings once loaded (without clobbering
an in-progress browse/edit) and persists it after a successful import,
so the user doesn't have to re-browse to the same file every launch.
The new checkbox just flips pst_auto_sync, which lib.rs's one-shot
startup pass reads.
This commit is contained in:
iamdoubz committed 2026-07-06 14:55:49 -05:00
1 parent e6a2109c9c
commit 00de9d3f68
1 file changed
+24
+24
View File
@@ -194,6 +194,14 @@
}),
);
// Prefills the remembered path once settings load, without clobbering
// whatever the user is actively typing/browsing to.
$effect(() => {
if (!pstPath && settings.settings.pst_last_path) {
pstPath = settings.settings.pst_last_path;
}
});
async function pickPstFile() {
const path = await open({ filters: [{ name: "Outlook data file", extensions: ["pst"] }] });
if (typeof path === "string") pstPath = path;
@@ -202,6 +210,10 @@
if (!pstPath) return;
await calendar.importPst(pstPath, pstPassword || undefined);
pstPassword = "";
if (!calendar.importError) await settings.patch({ pst_last_path: pstPath });
}
function onToggleAutoSync(e: Event) {
settings.patch({ pst_auto_sync: (e.target as HTMLInputElement).checked });
}
function formatEventDate(unixSecs: number | null): string {
if (!unixSecs) return "";
@@ -717,6 +729,18 @@
>
{/if}
</div>
<label class="row">
<input
type="checkbox"
checked={settings.settings.pst_auto_sync}
onchange={onToggleAutoSync}
/>
<span>Re-import this file automatically on launch</span>
</label>
<p class="muted small">
Runs once at startup, not on a timer — re-import is safe to repeat (existing events are
matched and updated, not duplicated).
</p>
{#if calendar.importError}
<p class="error">
Import failed: {calendar.importError} — the file itself is untouched; check the path and try