From 451c7afff04da88b71bdc9cb004a1c45fb5fd518 Mon Sep 17 00:00:00 2001 From: talksik Date: Sun, 1 Feb 2026 13:50:45 -0800 Subject: [PATCH] feat: save and load vault directory from local settings --- mainwindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 541bab2..924343f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) @@ -20,6 +21,7 @@ MainWindow::MainWindow(QWidget *parent) { ui = new Ui::MainWindow; ui->setupUi(this); + setWindowTitle("flowy.adhd"); m_listModel = new SessionsListModel(m_service, this); ui->listView->setModel(m_listModel); @@ -46,6 +48,16 @@ MainWindow::MainWindow(QWidget *parent) // Set initial state: no active session ui->activeStackedWidget->setCurrentIndex(0); + + // Load saved vault directory from settings + QSettings settings("flowy", "adhd"); + QString savedVaultPath = settings.value("vaultDirectory").toString(); + if (!savedVaultPath.isEmpty() && QDir(savedVaultPath).exists()) { + m_service->setVaultDirectory(savedVaultPath); + ui->vaultLabel->setText(savedVaultPath); + // Switch to Sessions tab if we have a valid vault + ui->tabWidget->setCurrentIndex(1); + } } MainWindow::~MainWindow() {} @@ -60,6 +72,10 @@ void MainWindow::on_selectVaultButton_clicked() m_service->setVaultDirectory(dir); ui->tabWidget->setCurrentIndex(1); ui->vaultLabel->setText(dir); + + // Save to settings for next launch + QSettings settings("flowy", "adhd"); + settings.setValue("vaultDirectory", dir); } }