fix(editor): prompt before closing unsaved SQL tabs
Co-authored-by: staff <staff@qimaos-MacBook-Pro.local>
This commit is contained in:
1 parent
23b9228f82
commit
4efff9a190
26 files changed
+1273
-100
No files matched your search
@@ -4,10 +4,12 @@ use std::{
|
||||
};
|
||||
|
||||
use dbx_core::storage::DesktopSettings;
|
||||
use tauri::{AppHandle, Manager, State};
|
||||
use tauri::{AppHandle, Manager, State, Window};
|
||||
|
||||
use super::connection::AppState;
|
||||
use crate::{apply_debug_log_level, apply_desktop_settings};
|
||||
use crate::{
|
||||
apply_debug_log_level, apply_desktop_settings, hide_main_window_for_close, request_app_close, CloseBehaviorState,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct DriverStoreMigrationResult {
|
||||
@@ -39,6 +41,29 @@ pub async fn save_desktop_settings(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn complete_app_close(app: AppHandle, window: Window, action: String) -> Result<(), String> {
|
||||
match action.as_str() {
|
||||
"quit" => {
|
||||
if let Some(state) = app.try_state::<CloseBehaviorState>() {
|
||||
state.allow_next_exit();
|
||||
}
|
||||
app.exit(0);
|
||||
}
|
||||
"hide" => {
|
||||
hide_main_window_for_close(&app, &window);
|
||||
}
|
||||
_ => return Err(format!("unsupported close action: {action}")),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn request_app_close_from_window_controls(app: AppHandle) -> Result<(), String> {
|
||||
request_app_close(&app, "settings");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn load_pinned_tree_node_ids(state: State<'_, Arc<AppState>>) -> Result<Vec<String>, String> {
|
||||
state.storage.load_pinned_tree_node_ids().await
|
||||
|
||||
Reference in new issue
Block a user