Re-implement file opening

This commit is contained in:
2024-02-02 23:02:07 +01:00
parent 0fe6bf1db2
commit 60649fe633
4 changed files with 45 additions and 16 deletions

View File

@@ -21,15 +21,16 @@ pub enum SheetListingInput {
ListBoxRowClicked(i32),
}
#[derive(Debug)]
pub struct SheetModelSelected {
sheet_model_type: SheetModelType,
pub sheet_model_type: SheetModelType,
}
#[relm4::component(pub)]
impl SimpleComponent for SheetListingModel {
type Init = Vec<SheetModelType>;
type Input = SheetListingInput;
type Output = ();
type Output = SheetModelSelected;
view! {
#[root]
@@ -63,7 +64,7 @@ impl SimpleComponent for SheetListingModel {
ComponentParts { model, widgets }
}
fn update(&mut self, message: Self::Input, _sender: ComponentSender<Self>) {
fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>) {
match message {
SheetListingInput::Query(query) => {
self.sheets.broadcast(OnQueryUpdate { query });
@@ -71,6 +72,11 @@ impl SimpleComponent for SheetListingModel {
SheetListingInput::ListBoxRowClicked(index) => {
let x = self.sheets.get(index as usize).unwrap();
debug!("clicked: {}!!!!!", x.label);
sender
.output(SheetModelSelected {
sheet_model_type: x.sheet_model_type.clone(),
})
.unwrap();
}
}
}