diff options
-rw-r--r-- | src/c_lhosts.go | 7 | ||||
-rw-r--r-- | src/i_events.go | 19 | ||||
-rw-r--r-- | src/i_info.go | 2 | ||||
-rw-r--r-- | src/i_insert.go | 4 | ||||
-rw-r--r-- | src/i_ui.go | 2 |
5 files changed, 18 insertions, 16 deletions
diff --git a/src/c_lhosts.go b/src/c_lhosts.go index 877135c..04595e8 100644 --- a/src/c_lhosts.go +++ b/src/c_lhosts.go @@ -158,10 +158,3 @@ func (lhost *HostList) count() int { } return count } - -func (host *HostNode) protocol_str() string { - if host.Protocol > PROTOCOL_MAX { - return "" - } - return PROTOCOL_STR[host.Protocol] -} diff --git a/src/i_events.go b/src/i_events.go index 35f7a4c..63463bf 100644 --- a/src/i_events.go +++ b/src/i_events.go @@ -658,6 +658,19 @@ func i_events(data *HardData) { ui.s.HideCursor() i_set_protocol_defaults(data, data.insert) } + case INS_RDP_QUALITY: + if event.Rune() < '1' || event.Rune() > '3' { + data.ui.insert_sel_ok = false + ui.buff = "" + ui.s.HideCursor() + break + } else { + data.insert.Quality = uint8(event.Rune() - 48 - 1) + data.ui.insert_sel_ok = false + ui.s.HideCursor() + } + // tmp, _ := strconv.Atoi(ui.buff) + // data.insert.Quality = uint8(tmp) case INS_SSH_HOST, INS_SSH_PORT, INS_SSH_USER, @@ -673,8 +686,7 @@ func i_events(data *HardData) { INS_RDP_DOMAIN, INS_RDP_USER, INS_RDP_PASS, - INS_RDP_FILE, - INS_RDP_QUALITY: + INS_RDP_FILE: if event.Key() == tcell.KeyEnter { switch data.ui.insert_sel { case INS_SSH_HOST, @@ -713,9 +725,6 @@ func i_events(data *HardData) { data.insert.Domain = ui.buff case INS_RDP_FILE: data.insert.RDPFile = ui.buff - case INS_RDP_QUALITY: - tmp, _ := strconv.Atoi(ui.buff) - data.insert.Quality = uint8(tmp) } data.ui.insert_sel_ok = false ui.buff = "" diff --git a/src/i_info.go b/src/i_info.go index 7efd683..dc1d70b 100644 --- a/src/i_info.go +++ b/src/i_info.go @@ -86,7 +86,7 @@ func i_info_dirs(ui HardUI, dir *DirsNode) { func i_info_name_type(ui HardUI, host *HostNode) int { line := 2 if line > ui.dim[H] - 3 { return line } - host_type := host.protocol_str() + host_type := PROTOCOL_STR[host.Protocol] // name, type i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, diff --git a/src/i_insert.go b/src/i_insert.go index 0e08f6c..1b87b3a 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -287,8 +287,8 @@ func i_draw_insert_panel(ui HardUI, in *HostNode) { " Insert - " + in.Name + " ", true) line := 2 if win.T + line >= win.B { return } - i_draw_text_box(ui, win.T + line, win, "Connection type", in.protocol_str(), - 0, ui.insert_sel, false) + i_draw_text_box(ui, win.T + line, win, "Connection type", + PROTOCOL_STR[in.Protocol], 0, ui.insert_sel, false) line += 2 var end_line int fp := [PROTOCOL_MAX + 1]draw_insert_func{ diff --git a/src/i_ui.go b/src/i_ui.go index f8cb2aa..251e3ff 100644 --- a/src/i_ui.go +++ b/src/i_ui.go @@ -707,7 +707,7 @@ func i_ui(data_dir string) { case INS_RDP_FILE: i_prompt_generic(data.ui, "RDP file: ", false, home_dir) case INS_RDP_QUALITY: - i_prompt_list(data.ui, "hey", "Quality:", + i_prompt_list(data.ui, "Quality", "Quality:", RDP_QUALITY[:]) } } else if data.insert_err != nil { |