mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-19 21:29:52 -07:00
Add new command for logging out of iamb session (#162)
This commit is contained in:
parent
b2b47ed7a0
commit
3b86be0545
4 changed files with 77 additions and 2 deletions
19
src/main.rs
19
src/main.rs
|
@ -115,12 +115,12 @@ use modalkit::{
|
|||
WindowAction,
|
||||
WindowContainer,
|
||||
},
|
||||
base::{MoveDir1D, OpenTarget, RepeatType},
|
||||
base::{CloseFlags, MoveDir1D, OpenTarget, RepeatType, TabTarget},
|
||||
context::Resolve,
|
||||
key::KeyManager,
|
||||
store::Store,
|
||||
},
|
||||
input::{bindings::BindingMachine, dialog::Pager, key::TerminalKey},
|
||||
input::{bindings::BindingMachine, dialog::Pager, dialog::PromptYesNo, key::TerminalKey},
|
||||
widgets::{
|
||||
cmdbar::CommandBarState,
|
||||
screen::{FocusList, Screen, ScreenState, TabLayoutDescription},
|
||||
|
@ -571,6 +571,21 @@ impl Application {
|
|||
|
||||
Ok(vec![(action.into(), ctx)])
|
||||
},
|
||||
HomeserverAction::Logout(user, true) => {
|
||||
self.worker.logout(user)?;
|
||||
let flags = CloseFlags::QUIT | CloseFlags::FORCE;
|
||||
let act = TabAction::Close(TabTarget::All, flags);
|
||||
|
||||
Ok(vec![(act.into(), ctx)])
|
||||
},
|
||||
HomeserverAction::Logout(user, false) => {
|
||||
let msg = "Would you like to logout?";
|
||||
let act = IambAction::from(HomeserverAction::Logout(user, true));
|
||||
let prompt = PromptYesNo::new(msg, vec![Action::from(act)]);
|
||||
let prompt = Box::new(prompt);
|
||||
|
||||
Err(UIError::NeedConfirm(prompt))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue