Title bar: Export button next to Save

The Export dialog had no visible control: the native menu bar that lists
Export… is not installed, so only the command palette reached it. The
quick access row now has an Export button (the existing Export icon)
that opens the export dialog, enabled when a presentation is open.
This commit is contained in:
pierrevbc
2026-10-13 11:26:44 +02:00
parent 1660982e58
commit 7812c77cf3
2 changed files with 25 additions and 0 deletions
+22
View File
@@ -1299,6 +1299,28 @@ mod tests {
assert!(size(&mut harness).unwrap_or(f64::MAX) < after, "Ctrl+[ shrinks");
}
/// Export… had no visible control: only the command palette reached it.
#[test]
fn title_bar_export_opens_the_export_dialog() {
let mut harness = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state(
|ui, app: &mut SlideApp| {
app.logic(ui.ctx());
app.ui(ui);
},
SlideApp::new(Session::with_new(), Services::default()),
);
harness.run_steps(2);
assert!(harness.state().dialog.is_none());
// Quick access: Home, Save, Export, each 24 points wide with 2 between, from x = 10.
let pos = egui::pos2(10.0 + 2.0 * 26.0 + 12.0, ribbon::TITLE_H / 2.0);
harness.hover_at(pos);
harness.run_steps(1);
harness.event(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE });
harness.event(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE });
harness.run_steps(2);
assert_eq!(harness.state().dialog.as_ref().map(|d| d.id.as_str()), Some("export"));
}
#[test]
fn home_needs_an_open_presentation() {
let mut app = SlideApp::new(Session::new(), Services::default());
+3
View File
@@ -53,6 +53,9 @@ pub fn title_bar(app: &mut SlideApp, ui: &mut Ui) {
if icon_toggle(&mut child, Icon::Save, "Save (⌘S)", has_doc, false).clicked() {
app.save();
}
if icon_toggle(&mut child, Icon::Export, "Export…", has_doc, false).clicked() {
let _ = app.run("app.exportDialog", json!({}));
}
if icon_toggle(&mut child, Icon::Undo, "Undo (⌘Z)", enabled(app, "edit.undo"), false).clicked() {
run(app, "edit.undo", json!({}));
}