MCPcopy Create free account
hub / github.com/Autoparallel/learner / handle_open_pdf

Method handle_open_pdf

crates/learnerd/src/tui/state.rs:436–451  ·  view source on GitHub ↗

Attempts to open the selected paper's PDF with the system viewer. Shows an error dialog if the PDF file is not found.

(&mut self)

Source from the content-addressed store, hash-verified

434 ///
435 /// Shows an error dialog if the PDF file is not found.
436 fn handle_open_pdf(&mut self) {
437 if let Some(paper) = self.selected_paper() {
438 let pdf_path = format!(
439 "{}/{}.pdf",
440 Database::default_storage_path().display(),
441 format_title(&paper.title, Some(50))
442 );
443
444 if std::path::Path::new(&pdf_path).exists() {
445 self.open_pdf_with_system_viewer(&pdf_path);
446 } else {
447 self.dialog = DialogType::PDFNotFound;
448 self.needs_redraw = true;
449 }
450 }
451 }
452
453 /// Updates the maximum scroll position for the details view.
454 ///

Callers 1

handle_normal_inputMethod · 0.80

Calls 2

selected_paperMethod · 0.80

Tested by

no test coverage detected