mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Bookmarks in auth activity (logic)
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
// Sub modules
|
||||
mod bookmarks;
|
||||
mod input;
|
||||
mod layout;
|
||||
|
||||
@@ -34,6 +35,7 @@ extern crate unicode_width;
|
||||
|
||||
// locals
|
||||
use super::{Activity, Context};
|
||||
use crate::bookmarks::UserHosts;
|
||||
use crate::filetransfer::FileTransferProtocol;
|
||||
|
||||
// Includes
|
||||
@@ -91,6 +93,7 @@ pub struct AuthActivity {
|
||||
pub submit: bool, // becomes true after user has submitted fields
|
||||
pub quit: bool, // Becomes true if user has pressed esc
|
||||
context: Option<Context>,
|
||||
bookmarks: Option<UserHosts>,
|
||||
selected_field: InputField, // Selected field in AuthCredentials Form
|
||||
input_mode: InputMode,
|
||||
input_form: InputForm,
|
||||
@@ -118,6 +121,7 @@ impl AuthActivity {
|
||||
submit: false,
|
||||
quit: false,
|
||||
context: None,
|
||||
bookmarks: None,
|
||||
selected_field: InputField::Address,
|
||||
input_mode: InputMode::Form,
|
||||
input_form: InputForm::AuthCredentials,
|
||||
@@ -141,6 +145,10 @@ impl Activity for AuthActivity {
|
||||
// Put raw mode on enabled
|
||||
let _ = enable_raw_mode();
|
||||
self.input_mode = InputMode::Form;
|
||||
// Read bookmarks
|
||||
if self.bookmarks.is_none() {
|
||||
self.read_bookmarks();
|
||||
}
|
||||
}
|
||||
|
||||
/// ### on_draw
|
||||
|
||||
Reference in New Issue
Block a user