aboutsummaryrefslogtreecommitdiff
path: root/src/tui/popup.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tui/popup.rs')
-rw-r--r--src/tui/popup.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tui/popup.rs b/src/tui/popup.rs
index 2a6f18a..a0a61a4 100644
--- a/src/tui/popup.rs
+++ b/src/tui/popup.rs
@@ -26,11 +26,17 @@ use crate::config::BibiConfig;
#[derive(Debug)]
pub enum PopupKind {
Help,
+ /// use for a confirmation message
MessageConfirm,
+ /// use for a warning message
MessageError,
+ /// open a resource connected to the entry
OpenRes,
+ /// select file to append entry to
AppendToFile,
+ /// append entry to a bibfile (selected in `AppendToFile` popup)
AddEntry,
+ /// select an item of the current entry to yank to clipboard
YankItem,
}
@@ -108,6 +114,14 @@ impl PopupArea {
Text::from(helptext)
}
+ /// Creates a popup message. The needed arguments are:
+ ///
+ /// - `message` as `str`: The message displayed in the popup.
+ /// - `object` as `str`: A possible object added to the message. E.g. the content
+ /// which gets copied to the clipboard.
+ /// - `msg_confirm` as `bool`: if `true` its a confirmation message displayed in
+ /// in the set `confirm_color` (default: green), if `false` its a warning
+ /// message displayed in the set `warn_color` (default: red).
pub fn popup_message(&mut self, message: &str, object: &str, msg_confirm: bool) {
if object.is_empty() {
self.popup_message = message.to_owned();
@@ -122,6 +136,9 @@ impl PopupArea {
self.is_popup = true;
}
+ /// Opens a popup with a selectable list
+ ///
+ /// The list items are passed as argument of the kind `Vec<String>`.
pub fn popup_selection(&mut self, items: Vec<String>) {
self.popup_list = items;
// self.popup_kind = Some(PopupKind::SelectRes);