Skip to content

Commit

Permalink
feat: add copy id context menu
Browse files Browse the repository at this point in the history
closes #4
  • Loading branch information
rfuzzo committed Jun 4, 2023
1 parent 434146f commit e30f5de
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/views/records_list_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ impl TemplateApp {

// add headers and subitems
let tag_header = egui::CollapsingHeader::new(tag.clone()).show(ui, |ui| {
// add records
// sort

for id in ids_by_tag.iter() {
// annotations
let mut label = id.to_string();
Expand All @@ -91,8 +88,19 @@ impl TemplateApp {
let response = ui.add(w);
// context menu
response.clone().context_menu(|ui| {
// copy id
if ui.button("Copy ID").clicked() {
ui.output_mut(|o| {
// unwrap is save here since we always preprend the fourcc to all ids
o.copied_text = id.clone().get(5..).unwrap().to_string();
});
ui.close_menu();
}

ui.separator();

// delete a record
if ui.button("Delete").clicked() {
// delete a record
record_ids_to_delete.push(id.clone());
ui.close_menu();
}
Expand Down

0 comments on commit e30f5de

Please sign in to comment.