diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 909ab41..5a584b2 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -22,7 +22,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" rusqlite = { version = "0.32", features = ["bundled"] } chrono = { version = "0.4", features = ["serde"] } -directories = "5" +tauri-plugin-window-state = "2" log = "0.4" env_logger = "0.11" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 1f6390d..f69dab4 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,8 +1,7 @@ use rusqlite::Connection; -use serde::{Deserialize, Serialize}; use std::sync::Mutex; -use tauri::{Manager, State}; use std::path::PathBuf; +use tauri::Manager; mod database; mod commands; @@ -13,8 +12,7 @@ pub struct AppState { fn get_data_dir() -> PathBuf { let exe_path = std::env::current_exe().unwrap(); - let exe_dir = exe_path.parent().unwrap(); - let data_dir = exe_dir.join("data"); + let data_dir = exe_path.parent().unwrap().join("data"); std::fs::create_dir_all(&data_dir).ok(); data_dir } @@ -30,6 +28,7 @@ pub fn run() { database::init_db(&conn).expect("Failed to initialize database"); tauri::Builder::default() + .plugin(tauri_plugin_window_state::Builder::new().build()) .plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_fs::init()) @@ -54,8 +53,12 @@ pub fn run() { commands::get_reports, commands::create_invoice, commands::get_invoices, + commands::update_invoice, + commands::delete_invoice, commands::get_settings, commands::update_settings, + commands::export_data, + commands::clear_all_data, ]) .setup(|app| { #[cfg(desktop)] @@ -69,7 +72,7 @@ pub fn run() { let _tray = TrayIconBuilder::new() .menu(&menu) - .menu_on_left_click(false) + .show_menu_on_left_click(false) .on_menu_event(|app, event| { match event.id.as_ref() { "quit" => {