mirror of
https://github.com/veeso/termscp.git
synced 2026-04-05 09:41:53 -07:00
Removed docs headers
This commit is contained in:
committed by
Christian Visintin
parent
2e0322bc0e
commit
027545f14c
@@ -35,8 +35,6 @@ use tuirealm::tui::style::Color;
|
||||
use tuirealm::{State, StateValue};
|
||||
|
||||
impl SetupActivity {
|
||||
/// ### action_on_esc
|
||||
///
|
||||
/// On <ESC>, if there are changes in the configuration, the quit dialog must be shown, otherwise
|
||||
/// we can exit without any problem
|
||||
pub(super) fn action_on_esc(&mut self) {
|
||||
@@ -47,8 +45,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### action_save_all
|
||||
///
|
||||
/// Save all configurations. If current tab can load values, they will be loaded, otherwise they'll just be saved.
|
||||
/// Once all the configuration has been changed, set config_changed to false
|
||||
pub(super) fn action_save_all(&mut self) -> Result<(), String> {
|
||||
@@ -59,8 +55,6 @@ impl SetupActivity {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// ### action_save_config
|
||||
///
|
||||
/// Save configuration
|
||||
fn action_save_config(&mut self) -> Result<(), String> {
|
||||
// Collect input values if in setup form
|
||||
@@ -70,8 +64,6 @@ impl SetupActivity {
|
||||
self.save_config()
|
||||
}
|
||||
|
||||
/// ### action_save_theme
|
||||
///
|
||||
/// Save configuration
|
||||
fn action_save_theme(&mut self) -> Result<(), String> {
|
||||
// Collect input values if in theme form
|
||||
@@ -83,8 +75,6 @@ impl SetupActivity {
|
||||
self.save_theme()
|
||||
}
|
||||
|
||||
/// ### action_change_tab
|
||||
///
|
||||
/// Change view tab and load input values in order not to lose them
|
||||
pub(super) fn action_change_tab(&mut self, new_tab: ViewLayout) -> Result<(), String> {
|
||||
// load values for current tab first
|
||||
@@ -100,8 +90,6 @@ impl SetupActivity {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// ### action_reset_config
|
||||
///
|
||||
/// Reset configuration input fields
|
||||
pub(super) fn action_reset_config(&mut self) -> Result<(), String> {
|
||||
match self.reset_config_changes() {
|
||||
@@ -113,8 +101,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### action_reset_theme
|
||||
///
|
||||
/// Reset configuration input fields
|
||||
pub(super) fn action_reset_theme(&mut self) -> Result<(), String> {
|
||||
match self.reset_theme_changes() {
|
||||
@@ -126,8 +112,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### action_delete_ssh_key
|
||||
///
|
||||
/// delete of a ssh key
|
||||
pub(super) fn action_delete_ssh_key(&mut self) {
|
||||
// Get key
|
||||
@@ -160,8 +144,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### action_new_ssh_key
|
||||
///
|
||||
/// Create a new ssh key
|
||||
pub(super) fn action_new_ssh_key(&mut self) {
|
||||
// get parameters
|
||||
@@ -228,8 +210,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### set_color
|
||||
///
|
||||
/// Given a component and a color, save the color into the theme
|
||||
pub(super) fn action_save_color(&mut self, component: IdTheme, color: Color) {
|
||||
let theme: &mut Theme = self.theme_mut();
|
||||
@@ -319,8 +299,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### collect_styles
|
||||
///
|
||||
/// Collect values from input and put them into the theme.
|
||||
/// If a component has an invalid color, returns Err(component_id)
|
||||
fn collect_styles(&mut self) -> Result<(), Id> {
|
||||
@@ -440,8 +418,6 @@ impl SetupActivity {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// ### get_color
|
||||
///
|
||||
/// Get color from component
|
||||
fn get_color(&self, component: &Id) -> Result<Color, ()> {
|
||||
match self.app.state(component) {
|
||||
|
||||
@@ -32,8 +32,6 @@ use super::SetupActivity;
|
||||
use std::env;
|
||||
|
||||
impl SetupActivity {
|
||||
/// ### save_config
|
||||
///
|
||||
/// Save configuration
|
||||
pub(super) fn save_config(&mut self) -> Result<(), String> {
|
||||
match self.config().write_config() {
|
||||
@@ -42,8 +40,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### reset_config_changes
|
||||
///
|
||||
/// Reset configuration changes; pratically read config from file, overwriting any change made
|
||||
/// since last write action
|
||||
pub(super) fn reset_config_changes(&mut self) -> Result<(), String> {
|
||||
@@ -52,8 +48,6 @@ impl SetupActivity {
|
||||
.map_err(|e| format!("Could not reload configuration: {}", e))
|
||||
}
|
||||
|
||||
/// ### save_theme
|
||||
///
|
||||
/// Save theme to file
|
||||
pub(super) fn save_theme(&mut self) -> Result<(), String> {
|
||||
self.theme_provider()
|
||||
@@ -61,8 +55,6 @@ impl SetupActivity {
|
||||
.map_err(|e| format!("Could not save theme: {}", e))
|
||||
}
|
||||
|
||||
/// ### reset_theme_changes
|
||||
///
|
||||
/// Reset changes committed to theme
|
||||
pub(super) fn reset_theme_changes(&mut self) -> Result<(), String> {
|
||||
self.theme_provider()
|
||||
@@ -70,8 +62,6 @@ impl SetupActivity {
|
||||
.map_err(|e| format!("Could not restore theme: {}", e))
|
||||
}
|
||||
|
||||
/// ### delete_ssh_key
|
||||
///
|
||||
/// Delete ssh key from config cli
|
||||
pub(super) fn delete_ssh_key(&mut self, host: &str, username: &str) -> Result<(), String> {
|
||||
match self.config_mut().del_ssh_key(host, username) {
|
||||
@@ -83,8 +73,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### edit_ssh_key
|
||||
///
|
||||
/// Edit selected ssh key
|
||||
pub(super) fn edit_ssh_key(&mut self, idx: usize) -> Result<(), String> {
|
||||
match self.context.as_mut() {
|
||||
@@ -142,8 +130,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### add_ssh_key
|
||||
///
|
||||
/// Add provided ssh key to config client
|
||||
pub(super) fn add_ssh_key(
|
||||
&mut self,
|
||||
|
||||
@@ -256,8 +256,6 @@ pub enum ViewLayout {
|
||||
Theme,
|
||||
}
|
||||
|
||||
/// ## SetupActivity
|
||||
///
|
||||
/// Setup activity states holder
|
||||
pub struct SetupActivity {
|
||||
app: Application<Id, Msg, NoUserEvent>,
|
||||
@@ -282,15 +280,11 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### context
|
||||
///
|
||||
/// Returns a reference to context
|
||||
fn context(&self) -> &Context {
|
||||
self.context.as_ref().unwrap()
|
||||
}
|
||||
|
||||
/// ### context_mut
|
||||
///
|
||||
/// Returns a mutable reference to context
|
||||
fn context_mut(&mut self) -> &mut Context {
|
||||
self.context.as_mut().unwrap()
|
||||
@@ -316,8 +310,6 @@ impl SetupActivity {
|
||||
self.context_mut().theme_provider_mut()
|
||||
}
|
||||
|
||||
/// ### config_changed
|
||||
///
|
||||
/// Returns whether config has changed
|
||||
fn config_changed(&self) -> bool {
|
||||
self.context()
|
||||
@@ -326,8 +318,6 @@ impl SetupActivity {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// ### set_config_changed
|
||||
///
|
||||
/// Set value for config changed key into the store
|
||||
fn set_config_changed(&mut self, changed: bool) {
|
||||
self.context_mut()
|
||||
@@ -337,8 +327,6 @@ impl SetupActivity {
|
||||
}
|
||||
|
||||
impl Activity for SetupActivity {
|
||||
/// ### on_create
|
||||
///
|
||||
/// `on_create` is the function which must be called to initialize the activity.
|
||||
/// `on_create` must initialize all the data structures used by the activity
|
||||
/// Context is taken from activity manager and will be released only when activity is destroyed
|
||||
@@ -363,8 +351,6 @@ impl Activity for SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### on_draw
|
||||
///
|
||||
/// `on_draw` is the function which draws the graphical interface.
|
||||
/// This function must be called at each tick to refresh the interface
|
||||
fn on_draw(&mut self) {
|
||||
@@ -394,8 +380,6 @@ impl Activity for SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### will_umount
|
||||
///
|
||||
/// `will_umount` is the method which must be able to report to the activity manager, whether
|
||||
/// the activity should be terminated or not.
|
||||
/// If not, the call will return `None`, otherwise return`Some(ExitReason)`
|
||||
@@ -403,8 +387,6 @@ impl Activity for SetupActivity {
|
||||
self.exit_reason.as_ref()
|
||||
}
|
||||
|
||||
/// ### on_destroy
|
||||
///
|
||||
/// `on_destroy` is the function which cleans up runtime variables and data before terminating the activity.
|
||||
/// This function must be called once before terminating the activity.
|
||||
/// This function finally releases the context
|
||||
|
||||
@@ -36,8 +36,6 @@ use super::{
|
||||
use tuirealm::Update;
|
||||
|
||||
impl Update<Msg> for SetupActivity {
|
||||
/// ### update
|
||||
///
|
||||
/// Update auth activity model based on msg
|
||||
/// The function exits when returns None
|
||||
fn update(&mut self, msg: Option<Msg>) -> Option<Msg> {
|
||||
|
||||
@@ -54,8 +54,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### view
|
||||
///
|
||||
/// View gui
|
||||
pub(super) fn view(&mut self) {
|
||||
self.redraw = false;
|
||||
@@ -68,8 +66,6 @@ impl SetupActivity {
|
||||
|
||||
// -- mount
|
||||
|
||||
/// ### mount_error
|
||||
///
|
||||
/// Mount error box
|
||||
pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) {
|
||||
assert!(self
|
||||
@@ -83,15 +79,11 @@ impl SetupActivity {
|
||||
assert!(self.app.active(&Id::Common(IdCommon::ErrorPopup)).is_ok());
|
||||
}
|
||||
|
||||
/// ### umount_error
|
||||
///
|
||||
/// Umount error message
|
||||
pub(super) fn umount_error(&mut self) {
|
||||
let _ = self.app.umount(&Id::Common(IdCommon::ErrorPopup));
|
||||
}
|
||||
|
||||
/// ### mount_quit
|
||||
///
|
||||
/// Mount quit popup
|
||||
pub(super) fn mount_quit(&mut self) {
|
||||
assert!(self
|
||||
@@ -105,15 +97,11 @@ impl SetupActivity {
|
||||
assert!(self.app.active(&Id::Common(IdCommon::QuitPopup)).is_ok());
|
||||
}
|
||||
|
||||
/// ### umount_quit
|
||||
///
|
||||
/// Umount quit
|
||||
pub(super) fn umount_quit(&mut self) {
|
||||
let _ = self.app.umount(&Id::Common(IdCommon::QuitPopup));
|
||||
}
|
||||
|
||||
/// ### mount_save_popup
|
||||
///
|
||||
/// Mount save popup
|
||||
pub(super) fn mount_save_popup(&mut self) {
|
||||
assert!(self
|
||||
@@ -127,15 +115,11 @@ impl SetupActivity {
|
||||
assert!(self.app.active(&Id::Common(IdCommon::SavePopup)).is_ok());
|
||||
}
|
||||
|
||||
/// ### umount_quit
|
||||
///
|
||||
/// Umount quit
|
||||
pub(super) fn umount_save_popup(&mut self) {
|
||||
let _ = self.app.umount(&Id::Common(IdCommon::SavePopup));
|
||||
}
|
||||
|
||||
/// ### mount_help
|
||||
///
|
||||
/// Mount help
|
||||
pub(super) fn mount_help(&mut self) {
|
||||
assert!(self
|
||||
@@ -149,8 +133,6 @@ impl SetupActivity {
|
||||
assert!(self.app.active(&Id::Common(IdCommon::Keybindings)).is_ok());
|
||||
}
|
||||
|
||||
/// ### umount_help
|
||||
///
|
||||
/// Umount help
|
||||
pub(super) fn umount_help(&mut self) {
|
||||
let _ = self.app.umount(&Id::Common(IdCommon::Keybindings));
|
||||
@@ -180,8 +162,6 @@ impl SetupActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/// ### new_app
|
||||
///
|
||||
/// Clean app up and remount common components and global listener
|
||||
fn new_app(&mut self, layout: ViewLayout) {
|
||||
self.app.umount_all();
|
||||
@@ -189,8 +169,6 @@ impl SetupActivity {
|
||||
self.mount_commons(layout);
|
||||
}
|
||||
|
||||
/// ### mount_commons
|
||||
///
|
||||
/// Mount common components
|
||||
fn mount_commons(&mut self, layout: ViewLayout) {
|
||||
// Radio tab
|
||||
@@ -213,8 +191,6 @@ impl SetupActivity {
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
/// ### mount_global_listener
|
||||
///
|
||||
/// Mount global listener
|
||||
fn mount_global_listener(&mut self) {
|
||||
assert!(self
|
||||
@@ -263,8 +239,6 @@ impl SetupActivity {
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
/// ### no_popup_mounted_clause
|
||||
///
|
||||
/// Returns a sub clause which requires that no popup is mounted in order to be satisfied
|
||||
fn no_popup_mounted_clause() -> SubClause<Id> {
|
||||
SubClause::And(
|
||||
|
||||
@@ -40,8 +40,6 @@ use tuirealm::{State, StateValue};
|
||||
impl SetupActivity {
|
||||
// -- view
|
||||
|
||||
/// ### init_setup
|
||||
///
|
||||
/// Initialize setup view
|
||||
pub(super) fn init_setup(&mut self) {
|
||||
// Init view (and mount commons)
|
||||
@@ -153,8 +151,6 @@ impl SetupActivity {
|
||||
self.context = Some(ctx);
|
||||
}
|
||||
|
||||
/// ### load_input_values
|
||||
///
|
||||
/// Load values from configuration into input fields
|
||||
pub(crate) fn load_input_values(&mut self) {
|
||||
// Text editor
|
||||
@@ -267,8 +263,6 @@ impl SetupActivity {
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
/// ### collect_input_values
|
||||
///
|
||||
/// Collect values from input and put them into the configuration
|
||||
pub(crate) fn collect_input_values(&mut self) {
|
||||
if let Ok(State::One(StateValue::String(editor))) =
|
||||
|
||||
@@ -37,8 +37,6 @@ use tuirealm::tui::widgets::Clear;
|
||||
impl SetupActivity {
|
||||
// -- view
|
||||
|
||||
/// ### init_ssh_keys
|
||||
///
|
||||
/// Initialize ssh keys view
|
||||
pub(super) fn init_ssh_keys(&mut self) {
|
||||
// Init view (and mount commons)
|
||||
@@ -99,8 +97,6 @@ impl SetupActivity {
|
||||
|
||||
// -- mount
|
||||
|
||||
/// ### mount_del_ssh_key
|
||||
///
|
||||
/// Mount delete ssh key component
|
||||
pub(crate) fn mount_del_ssh_key(&mut self) {
|
||||
assert!(self
|
||||
@@ -114,15 +110,11 @@ impl SetupActivity {
|
||||
assert!(self.app.active(&Id::Ssh(IdSsh::DelSshKeyPopup)).is_ok());
|
||||
}
|
||||
|
||||
/// ### umount_del_ssh_key
|
||||
///
|
||||
/// Umount delete ssh key
|
||||
pub(crate) fn umount_del_ssh_key(&mut self) {
|
||||
let _ = self.app.umount(&Id::Ssh(IdSsh::DelSshKeyPopup));
|
||||
}
|
||||
|
||||
/// ### mount_new_ssh_key
|
||||
///
|
||||
/// Mount new ssh key prompt
|
||||
pub(crate) fn mount_new_ssh_key(&mut self) {
|
||||
assert!(self
|
||||
@@ -144,16 +136,12 @@ impl SetupActivity {
|
||||
assert!(self.app.active(&Id::Ssh(IdSsh::SshHost)).is_ok());
|
||||
}
|
||||
|
||||
/// ### umount_new_ssh_key
|
||||
///
|
||||
/// Umount new ssh key prompt
|
||||
pub(crate) fn umount_new_ssh_key(&mut self) {
|
||||
let _ = self.app.umount(&Id::Ssh(IdSsh::SshUsername));
|
||||
let _ = self.app.umount(&Id::Ssh(IdSsh::SshHost));
|
||||
}
|
||||
|
||||
/// ### reload_ssh_keys
|
||||
///
|
||||
/// Reload ssh keys
|
||||
pub(crate) fn reload_ssh_keys(&mut self) {
|
||||
let keys: Vec<String> = self
|
||||
|
||||
@@ -35,8 +35,6 @@ use tuirealm::tui::layout::{Constraint, Direction, Layout};
|
||||
impl SetupActivity {
|
||||
// -- view
|
||||
|
||||
/// ### init_theme
|
||||
///
|
||||
/// Initialize thene view
|
||||
pub(super) fn init_theme(&mut self) {
|
||||
// Init view (and mount commons)
|
||||
@@ -298,8 +296,6 @@ impl SetupActivity {
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
/// ### load_styles
|
||||
///
|
||||
/// Load values from theme into input fields
|
||||
pub(crate) fn load_styles(&mut self) {
|
||||
let theme: Theme = self.theme().clone();
|
||||
|
||||
Reference in New Issue
Block a user