| ... | ... | @@ -119,6 +119,7 @@ pub enum Action { |
| 119 | 119 | /// Shows the notebook's recycle bin. |
| 120 | 120 | RecycleBin, |
| 121 | 121 | EmptyRecycleBin, |
| 122 | MarkRead, |
| 122 | 123 | MarkNotebookRead, |
| 123 | 124 | CopyLink, |
| 124 | 125 | NewPage, |
| ... | ... | @@ -162,6 +163,7 @@ impl Action { |
| 162 | 163 | Action::SaveAs => art::SAVE, |
| 163 | 164 | Action::RecycleBin => art::RECYCLE_BIN, |
| 164 | 165 | Action::EmptyRecycleBin => art::EMPTY_RECYCLE_BIN, |
| 166 | Action::MarkRead => art::MARK_READ, |
| 165 | 167 | Action::MarkNotebookRead => art::MARK_NOTEBOOK_READ, |
| 166 | 168 | Action::CopyLink => art::COPY_LINK, |
| 167 | 169 | Action::NewPage => art::NEW_PAGE, |
| ... | ... | @@ -456,11 +458,21 @@ impl State { |
| 456 | 458 | path, |
| 457 | 459 | space, |
| 458 | 460 | } => { |
| 461 | let unread = library |
| 462 | .section_identity(path) |
| 463 | .and_then(|section| self.reads.pages(&library.location, section)) |
| 464 | .is_some_and(|pages| pages.contains(space)); |
| 459 | 465 | let mut actions = vec![ |
| 460 | 466 | item(Action::Rename, "Rename", false, false), |
| 461 | 467 | item(Action::Delete, "Delete", false, false), |
| 462 | 468 | item(Action::Move, "Move to Section", nowhere(), false), |
| 463 | 469 | item(Action::CopyLink, "Copy Link to Page", false, true), |
| 470 | item( |
| 471 | Action::MarkRead, |
| 472 | commands::command(commands::Id::MarkRead).title, |
| 473 | !unread, |
| 474 | true, |
| 475 | ), |
| 464 | 476 | item(Action::NewPage, "New Page", false, true), |
| 465 | 477 | // OneNote offers this beside New Page, which is a plain + here. |
| 466 | 478 | item(Action::NewSubpage, "New Subpage", false, false), |
| ... | ... | @@ -521,6 +533,16 @@ impl State { |
| 521 | 533 | if section { |
| 522 | 534 | let link = self.section_link(library, path).is_none(); |
| 523 | 535 | actions.push(item(Action::CopyLink, "Copy Link to Section", link, true)); |
| 536 | let unread = library |
| 537 | .section_identity(path) |
| 538 | .and_then(|section| self.reads.pages(&library.location, section)) |
| 539 | .is_some_and(|pages| !pages.is_empty()); |
| 540 | actions.push(item( |
| 541 | Action::MarkRead, |
| 542 | commands::command(commands::Id::MarkRead).title, |
| 543 | !unread, |
| 544 | true, |
| 545 | )); |
| 524 | 546 | } |
| 525 | 547 | if section { |
| 526 | 548 | let [mut first, rest] = new; |
| ... | ... | @@ -807,6 +829,26 @@ impl State { |
| 807 | 829 | } |
| 808 | 830 | (Target::NewPage(title), _) => Some(Command::NewPage { under: None, title }), |
| 809 | 831 | (Target::Text(text), _) => Some(Command::Text(text)), |
| 832 | ( |
| 833 | Target::Page { |
| 834 | library, |
| 835 | path, |
| 836 | space, |
| 837 | }, |
| 838 | Action::MarkRead, |
| 839 | ) => { |
| 840 | if let Some(section) = library.section_identity(&path) { |
| 841 | self.reads |
| 842 | .mark_read(&library.location, section, Some(space)); |
| 843 | } |
| 844 | None |
| 845 | } |
| 846 | (Target::Section { library, path }, Action::MarkRead) => { |
| 847 | if let Some(section) = library.section_identity(&path) { |
| 848 | self.reads.mark_read(&library.location, section, None); |
| 849 | } |
| 850 | None |
| 851 | } |
| 810 | 852 | ( |
| 811 | 853 | Target::Page { |
| 812 | 854 | library, |