Focus text input when in NetworkAuth modal
Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
parent
f43f500302
commit
c89d877b52
1 changed files with 53 additions and 42 deletions
95
src/app.rs
95
src/app.rs
|
|
@ -2212,6 +2212,7 @@ impl Application for App {
|
||||||
auth,
|
auth,
|
||||||
auth_tx,
|
auth_tx,
|
||||||
});
|
});
|
||||||
|
return widget::text_input::focus(self.dialog_text_input.clone());
|
||||||
}
|
}
|
||||||
Message::NetworkDriveInput(input) => {
|
Message::NetworkDriveInput(input) => {
|
||||||
self.network_drive_input = input;
|
self.network_drive_input = input;
|
||||||
|
|
@ -3689,61 +3690,71 @@ impl Application for App {
|
||||||
} => {
|
} => {
|
||||||
//TODO: use URI!
|
//TODO: use URI!
|
||||||
let mut controls = Vec::with_capacity(4);
|
let mut controls = Vec::with_capacity(4);
|
||||||
|
let mut id_assigned = false;
|
||||||
|
|
||||||
if let Some(username) = &auth.username_opt {
|
if let Some(username) = &auth.username_opt {
|
||||||
//TODO: what should submit do?
|
//TODO: what should submit do?
|
||||||
controls.push(
|
let mut input = widget::text_input(fl!("username"), username)
|
||||||
widget::text_input(fl!("username"), username)
|
.on_input(move |value| {
|
||||||
.on_input(move |value| {
|
Message::DialogUpdate(DialogPage::NetworkAuth {
|
||||||
Message::DialogUpdate(DialogPage::NetworkAuth {
|
mounter_key: *mounter_key,
|
||||||
mounter_key: *mounter_key,
|
uri: uri.clone(),
|
||||||
uri: uri.clone(),
|
auth: MounterAuth {
|
||||||
auth: MounterAuth {
|
username_opt: Some(value),
|
||||||
username_opt: Some(value),
|
..auth.clone()
|
||||||
..auth.clone()
|
},
|
||||||
},
|
auth_tx: auth_tx.clone(),
|
||||||
auth_tx: auth_tx.clone(),
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.into(),
|
});
|
||||||
);
|
if !id_assigned {
|
||||||
|
input = input.id(self.dialog_text_input.clone());
|
||||||
|
id_assigned = true;
|
||||||
|
}
|
||||||
|
controls.push(input.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(domain) = &auth.domain_opt {
|
if let Some(domain) = &auth.domain_opt {
|
||||||
//TODO: what should submit do?
|
//TODO: what should submit do?
|
||||||
controls.push(
|
let mut input = widget::text_input(fl!("domain"), domain)
|
||||||
widget::text_input(fl!("domain"), domain)
|
.on_input(move |value| {
|
||||||
.on_input(move |value| {
|
Message::DialogUpdate(DialogPage::NetworkAuth {
|
||||||
Message::DialogUpdate(DialogPage::NetworkAuth {
|
mounter_key: *mounter_key,
|
||||||
mounter_key: *mounter_key,
|
uri: uri.clone(),
|
||||||
uri: uri.clone(),
|
auth: MounterAuth {
|
||||||
auth: MounterAuth {
|
domain_opt: Some(value),
|
||||||
domain_opt: Some(value),
|
..auth.clone()
|
||||||
..auth.clone()
|
},
|
||||||
},
|
auth_tx: auth_tx.clone(),
|
||||||
auth_tx: auth_tx.clone(),
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.into(),
|
});
|
||||||
);
|
if !id_assigned {
|
||||||
|
input = input.id(self.dialog_text_input.clone());
|
||||||
|
id_assigned = true;
|
||||||
|
}
|
||||||
|
controls.push(input.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(password) = &auth.password_opt {
|
if let Some(password) = &auth.password_opt {
|
||||||
//TODO: what should submit do?
|
//TODO: what should submit do?
|
||||||
//TODO: button for showing password
|
//TODO: button for showing password
|
||||||
controls.push(
|
let mut input = widget::secure_input(fl!("password"), password, None, true)
|
||||||
widget::secure_input(fl!("password"), password, None, true)
|
.on_input(move |value| {
|
||||||
.on_input(move |value| {
|
Message::DialogUpdate(DialogPage::NetworkAuth {
|
||||||
Message::DialogUpdate(DialogPage::NetworkAuth {
|
mounter_key: *mounter_key,
|
||||||
mounter_key: *mounter_key,
|
uri: uri.clone(),
|
||||||
uri: uri.clone(),
|
auth: MounterAuth {
|
||||||
auth: MounterAuth {
|
password_opt: Some(value),
|
||||||
password_opt: Some(value),
|
..auth.clone()
|
||||||
..auth.clone()
|
},
|
||||||
},
|
auth_tx: auth_tx.clone(),
|
||||||
auth_tx: auth_tx.clone(),
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.into(),
|
});
|
||||||
);
|
if !id_assigned {
|
||||||
|
input = input.id(self.dialog_text_input.clone());
|
||||||
|
}
|
||||||
|
controls.push(input.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(remember) = &auth.remember_opt {
|
if let Some(remember) = &auth.remember_opt {
|
||||||
//TODO: what should submit do?
|
//TODO: what should submit do?
|
||||||
//TODO: button for showing password
|
//TODO: button for showing password
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue