Add opt-in title bar note switcher

This commit is contained in:
Yuri Karamian
2026-08-07 00:56:54 +02:00
parent bdf94e2494
commit 1cbdf704bd
9 changed files with 608 additions and 6 deletions
+2
View File
@@ -1459,6 +1459,7 @@ pub fn set_general_settings(
close_to_tray: bool,
enable_wiki_links: bool,
show_note_dates: bool,
show_note_switcher: bool,
startup_view: StartupView,
restore_last_session: bool,
show_all_notes: bool,
@@ -1470,6 +1471,7 @@ pub fn set_general_settings(
let mut config = state.config.lock().map_err(|e| e.to_string())?;
config.compact_notes = compact_notes;
config.show_note_dates = show_note_dates;
config.show_note_switcher = show_note_switcher;
config.startup_view = startup_view;
config.restore_last_session = restore_last_session;
config.show_all_notes = show_all_notes;
+18
View File
@@ -137,6 +137,8 @@ pub struct AppConfig {
#[serde(default = "default_true")]
pub show_note_dates: bool,
#[serde(default)]
pub show_note_switcher: bool,
#[serde(default)]
pub time_format: String,
#[serde(default = "default_week_start")]
pub week_start: String,
@@ -300,6 +302,7 @@ impl Default for AppConfig {
content_width: None,
compact_notes: false,
show_note_dates: true,
show_note_switcher: false,
time_format: "relative".to_string(),
week_start: "monday".to_string(),
daily_title_format: "localized".to_string(),
@@ -539,4 +542,19 @@ mod startup_view_tests {
assert_eq!(config.system_light_theme, "light");
assert_eq!(config.system_dark_theme, "dark");
}
#[test]
fn note_switcher_is_opt_in_for_new_and_existing_configs() {
let config = AppConfig::default();
assert!(!config.show_note_switcher);
let mut value = serde_json::to_value(config).unwrap();
value
.as_object_mut()
.unwrap()
.remove("show_note_switcher");
let config: AppConfig = serde_json::from_value(value).unwrap();
assert!(!config.show_note_switcher);
}
}