mobile, edit os account
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
888c851167
commit
8aa5f3a2a7
@ -897,3 +897,149 @@ void showRestartRemoteDevice(
|
|||||||
));
|
));
|
||||||
if (res == true) bind.sessionRestartRemoteDevice(id: id);
|
if (res == true) bind.sessionRestartRemoteDevice(id: id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showSetOSPassword(
|
||||||
|
String id,
|
||||||
|
bool login,
|
||||||
|
OverlayDialogManager dialogManager,
|
||||||
|
) async {
|
||||||
|
final controller = TextEditingController();
|
||||||
|
var password = await bind.sessionGetOption(id: id, arg: 'os-password') ?? '';
|
||||||
|
var autoLogin = await bind.sessionGetOption(id: id, arg: 'auto-login') != '';
|
||||||
|
controller.text = password;
|
||||||
|
dialogManager.show((setState, close) {
|
||||||
|
submit() {
|
||||||
|
var text = controller.text.trim();
|
||||||
|
bind.sessionPeerOption(id: id, name: 'os-password', value: text);
|
||||||
|
bind.sessionPeerOption(
|
||||||
|
id: id, name: 'auto-login', value: autoLogin ? 'Y' : '');
|
||||||
|
if (text != '' && login) {
|
||||||
|
bind.sessionInputOsPassword(id: id, value: text);
|
||||||
|
}
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CustomAlertDialog(
|
||||||
|
title: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.password_rounded, color: MyTheme.accent),
|
||||||
|
Text(translate('OS Password')).paddingOnly(left: 10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
PasswordWidget(controller: controller),
|
||||||
|
CheckboxListTile(
|
||||||
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
dense: true,
|
||||||
|
controlAffinity: ListTileControlAffinity.leading,
|
||||||
|
title: Text(
|
||||||
|
translate('Auto Login'),
|
||||||
|
),
|
||||||
|
value: autoLogin,
|
||||||
|
onChanged: (v) {
|
||||||
|
if (v == null) return;
|
||||||
|
setState(() => autoLogin = v);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
dialogButton(
|
||||||
|
"Cancel",
|
||||||
|
icon: Icon(Icons.close_rounded),
|
||||||
|
onPressed: close,
|
||||||
|
isOutline: true,
|
||||||
|
),
|
||||||
|
dialogButton(
|
||||||
|
"OK",
|
||||||
|
icon: Icon(Icons.done_rounded),
|
||||||
|
onPressed: submit,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onSubmit: submit,
|
||||||
|
onCancel: close,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
showSetOSAccount(
|
||||||
|
String id,
|
||||||
|
OverlayDialogManager dialogManager,
|
||||||
|
) async {
|
||||||
|
final usernameController = TextEditingController();
|
||||||
|
final passwdController = TextEditingController();
|
||||||
|
var username = await bind.sessionGetOption(id: id, arg: 'os-username') ?? '';
|
||||||
|
var password = await bind.sessionGetOption(id: id, arg: 'os-password') ?? '';
|
||||||
|
usernameController.text = username;
|
||||||
|
passwdController.text = password;
|
||||||
|
dialogManager.show((setState, close) {
|
||||||
|
submit() {
|
||||||
|
final username = usernameController.text.trim();
|
||||||
|
final password = usernameController.text.trim();
|
||||||
|
bind.sessionPeerOption(id: id, name: 'os-username', value: username);
|
||||||
|
bind.sessionPeerOption(id: id, name: 'os-password', value: password);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
descWidget(String text) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
text,
|
||||||
|
maxLines: 3,
|
||||||
|
softWrap: true,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CustomAlertDialog(
|
||||||
|
title: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.password_rounded, color: MyTheme.accent),
|
||||||
|
Text(translate('OS Account')).paddingOnly(left: 10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
descWidget(translate("os_account_desk_tip")),
|
||||||
|
DialogTextField(
|
||||||
|
title: translate(DialogTextField.kUsernameTitle),
|
||||||
|
controller: usernameController,
|
||||||
|
prefixIcon: DialogTextField.kUsernameIcon,
|
||||||
|
errorText: null,
|
||||||
|
),
|
||||||
|
PasswordWidget(controller: passwdController),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
dialogButton(
|
||||||
|
"Cancel",
|
||||||
|
icon: Icon(Icons.close_rounded),
|
||||||
|
onPressed: close,
|
||||||
|
isOutline: true,
|
||||||
|
),
|
||||||
|
dialogButton(
|
||||||
|
"OK",
|
||||||
|
icon: Icon(Icons.done_rounded),
|
||||||
|
onPressed: submit,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onSubmit: submit,
|
||||||
|
onCancel: close,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -225,10 +225,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
children: [
|
children: [
|
||||||
Button(
|
Button(
|
||||||
isOutline: true,
|
isOutline: true,
|
||||||
onTap: () => enterUserLoginAndPasswordDialog(
|
onTap: () => onConnect(isFileTransfer: true),
|
||||||
'fdsfd',
|
|
||||||
gFFI.dialogManager,
|
|
||||||
),
|
|
||||||
text: "Transfer File",
|
text: "Transfer File",
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -667,86 +667,7 @@ class _ControlMenu extends StatelessWidget {
|
|||||||
child: Text(translate('OS Account')),
|
child: Text(translate('OS Account')),
|
||||||
trailingIcon: Transform.scale(scale: 0.8, child: Icon(Icons.edit)),
|
trailingIcon: Transform.scale(scale: 0.8, child: Icon(Icons.edit)),
|
||||||
ffi: ffi,
|
ffi: ffi,
|
||||||
onPressed: () => _showSetOSAccount(id, false, ffi.dialogManager));
|
onPressed: () => showSetOSAccount(id, ffi.dialogManager));
|
||||||
}
|
|
||||||
|
|
||||||
_showSetOSAccount(
|
|
||||||
String id, bool login, OverlayDialogManager dialogManager) async {
|
|
||||||
final usernameController = TextEditingController();
|
|
||||||
final passwdController = TextEditingController();
|
|
||||||
var username =
|
|
||||||
await bind.sessionGetOption(id: id, arg: 'os-username') ?? '';
|
|
||||||
var password =
|
|
||||||
await bind.sessionGetOption(id: id, arg: 'os-password') ?? '';
|
|
||||||
usernameController.text = username;
|
|
||||||
passwdController.text = password;
|
|
||||||
dialogManager.show((setState, close) {
|
|
||||||
submit() {
|
|
||||||
final username = usernameController.text.trim();
|
|
||||||
final password = usernameController.text.trim();
|
|
||||||
bind.sessionPeerOption(id: id, name: 'os-username', value: username);
|
|
||||||
bind.sessionPeerOption(id: id, name: 'os-password', value: password);
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
descWidget(String text) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(
|
|
||||||
text,
|
|
||||||
maxLines: 3,
|
|
||||||
softWrap: true,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(fontSize: 16),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CustomAlertDialog(
|
|
||||||
title: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(Icons.password_rounded, color: MyTheme.accent),
|
|
||||||
Text(translate('OS Password')).paddingOnly(left: 10),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
descWidget(translate("os_account_desk_tip")),
|
|
||||||
DialogTextField(
|
|
||||||
title: translate(DialogTextField.kUsernameTitle),
|
|
||||||
controller: usernameController,
|
|
||||||
prefixIcon: DialogTextField.kUsernameIcon,
|
|
||||||
errorText: null,
|
|
||||||
),
|
|
||||||
PasswordWidget(controller: passwdController),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
dialogButton(
|
|
||||||
"Cancel",
|
|
||||||
icon: Icon(Icons.close_rounded),
|
|
||||||
onPressed: close,
|
|
||||||
isOutline: true,
|
|
||||||
),
|
|
||||||
dialogButton(
|
|
||||||
"OK",
|
|
||||||
icon: Icon(Icons.done_rounded),
|
|
||||||
onPressed: submit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onSubmit: submit,
|
|
||||||
onCancel: close,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osPassword() {
|
osPassword() {
|
||||||
@ -754,73 +675,7 @@ class _ControlMenu extends StatelessWidget {
|
|||||||
child: Text(translate('OS Password')),
|
child: Text(translate('OS Password')),
|
||||||
trailingIcon: Transform.scale(scale: 0.8, child: Icon(Icons.edit)),
|
trailingIcon: Transform.scale(scale: 0.8, child: Icon(Icons.edit)),
|
||||||
ffi: ffi,
|
ffi: ffi,
|
||||||
onPressed: () => _showSetOSPassword(id, false, ffi.dialogManager));
|
onPressed: () => showSetOSPassword(id, false, ffi.dialogManager));
|
||||||
}
|
|
||||||
|
|
||||||
_showSetOSPassword(
|
|
||||||
String id, bool login, OverlayDialogManager dialogManager) async {
|
|
||||||
final controller = TextEditingController();
|
|
||||||
var password =
|
|
||||||
await bind.sessionGetOption(id: id, arg: 'os-password') ?? '';
|
|
||||||
var autoLogin =
|
|
||||||
await bind.sessionGetOption(id: id, arg: 'auto-login') != '';
|
|
||||||
controller.text = password;
|
|
||||||
dialogManager.show((setState, close) {
|
|
||||||
submit() {
|
|
||||||
var text = controller.text.trim();
|
|
||||||
bind.sessionPeerOption(id: id, name: 'os-password', value: text);
|
|
||||||
bind.sessionPeerOption(
|
|
||||||
id: id, name: 'auto-login', value: autoLogin ? 'Y' : '');
|
|
||||||
if (text != '' && login) {
|
|
||||||
bind.sessionInputOsPassword(id: id, value: text);
|
|
||||||
}
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CustomAlertDialog(
|
|
||||||
title: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(Icons.password_rounded, color: MyTheme.accent),
|
|
||||||
Text(translate('OS Password')).paddingOnly(left: 10),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
PasswordWidget(controller: controller),
|
|
||||||
CheckboxListTile(
|
|
||||||
contentPadding: const EdgeInsets.all(0),
|
|
||||||
dense: true,
|
|
||||||
controlAffinity: ListTileControlAffinity.leading,
|
|
||||||
title: Text(
|
|
||||||
translate('Auto Login'),
|
|
||||||
),
|
|
||||||
value: autoLogin,
|
|
||||||
onChanged: (v) {
|
|
||||||
if (v == null) return;
|
|
||||||
setState(() => autoLogin = v);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
dialogButton(
|
|
||||||
"Cancel",
|
|
||||||
icon: Icon(Icons.close_rounded),
|
|
||||||
onPressed: close,
|
|
||||||
isOutline: true,
|
|
||||||
),
|
|
||||||
dialogButton(
|
|
||||||
"OK",
|
|
||||||
icon: Icon(Icons.done_rounded),
|
|
||||||
onPressed: submit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onSubmit: submit,
|
|
||||||
onCancel: close,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transferFile(BuildContext context) {
|
transferFile(BuildContext context) {
|
||||||
|
@ -548,7 +548,25 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
more.add(PopupMenuItem<String>(
|
more.add(PopupMenuItem<String>(
|
||||||
child: Text(translate('Refresh')), value: 'refresh'));
|
child: Text(translate('Refresh')), value: 'refresh'));
|
||||||
}
|
}
|
||||||
more.add(PopupMenuItem<String>(
|
if (gFFI.ffiModel.pi.is_headless) {
|
||||||
|
more.add(
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
child: Row(
|
||||||
|
children: ([
|
||||||
|
Text(translate('OS Account')),
|
||||||
|
TextButton(
|
||||||
|
style: flatButtonStyle,
|
||||||
|
onPressed: () {
|
||||||
|
showSetOSAccount(id, gFFI.dialogManager);
|
||||||
|
},
|
||||||
|
child: Icon(Icons.edit, color: MyTheme.accent),
|
||||||
|
)
|
||||||
|
])),
|
||||||
|
value: 'enter_os_account'),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
more.add(
|
||||||
|
PopupMenuItem<String>(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: ([
|
children: ([
|
||||||
Text(translate('OS Password')),
|
Text(translate('OS Password')),
|
||||||
@ -560,7 +578,9 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
child: Icon(Icons.edit, color: MyTheme.accent),
|
child: Icon(Icons.edit, color: MyTheme.accent),
|
||||||
)
|
)
|
||||||
])),
|
])),
|
||||||
value: 'enter_os_password'));
|
value: 'enter_os_password'),
|
||||||
|
);
|
||||||
|
}
|
||||||
if (!isWebDesktop) {
|
if (!isWebDesktop) {
|
||||||
if (perms['keyboard'] != false && perms['clipboard'] != false) {
|
if (perms['keyboard'] != false && perms['clipboard'] != false) {
|
||||||
more.add(PopupMenuItem<String>(
|
more.add(PopupMenuItem<String>(
|
||||||
@ -657,6 +677,8 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
} else {
|
} else {
|
||||||
showSetOSPassword(id, true, gFFI.dialogManager);
|
showSetOSPassword(id, true, gFFI.dialogManager);
|
||||||
}
|
}
|
||||||
|
} else if (value == 'enter_os_account') {
|
||||||
|
showSetOSAccount(id, gFFI.dialogManager);
|
||||||
} else if (value == 'reset_canvas') {
|
} else if (value == 'reset_canvas') {
|
||||||
gFFI.cursorModel.reset();
|
gFFI.cursorModel.reset();
|
||||||
} else if (value == 'restart') {
|
} else if (value == 'restart') {
|
||||||
@ -1071,50 +1093,6 @@ void showOptions(
|
|||||||
}, clickMaskDismiss: true, backDismiss: true);
|
}, clickMaskDismiss: true, backDismiss: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showSetOSPassword(
|
|
||||||
String id, bool login, OverlayDialogManager dialogManager) async {
|
|
||||||
final controller = TextEditingController();
|
|
||||||
var password = await bind.sessionGetOption(id: id, arg: "os-password") ?? "";
|
|
||||||
var autoLogin = await bind.sessionGetOption(id: id, arg: "auto-login") != "";
|
|
||||||
controller.text = password;
|
|
||||||
dialogManager.show((setState, close) {
|
|
||||||
return CustomAlertDialog(
|
|
||||||
title: Text(translate('OS Password')),
|
|
||||||
content: Column(mainAxisSize: MainAxisSize.min, children: [
|
|
||||||
PasswordWidget(controller: controller),
|
|
||||||
CheckboxListTile(
|
|
||||||
contentPadding: const EdgeInsets.all(0),
|
|
||||||
dense: true,
|
|
||||||
controlAffinity: ListTileControlAffinity.leading,
|
|
||||||
title: Text(
|
|
||||||
translate('Auto Login'),
|
|
||||||
),
|
|
||||||
value: autoLogin,
|
|
||||||
onChanged: (v) {
|
|
||||||
if (v == null) return;
|
|
||||||
setState(() => autoLogin = v);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
actions: [
|
|
||||||
dialogButton('Cancel', onPressed: close, isOutline: true),
|
|
||||||
dialogButton(
|
|
||||||
'OK',
|
|
||||||
onPressed: () {
|
|
||||||
var text = controller.text.trim();
|
|
||||||
bind.sessionPeerOption(id: id, name: "os-password", value: text);
|
|
||||||
bind.sessionPeerOption(
|
|
||||||
id: id, name: "auto-login", value: autoLogin ? 'Y' : '');
|
|
||||||
if (text != "" && login) {
|
|
||||||
bind.sessionInputOsPassword(id: id, value: text);
|
|
||||||
}
|
|
||||||
close();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void sendPrompt(bool isMac, String key) {
|
void sendPrompt(bool isMac, String key) {
|
||||||
final old = isMac ? gFFI.inputModel.command : gFFI.inputModel.ctrl;
|
final old = isMac ? gFFI.inputModel.command : gFFI.inputModel.ctrl;
|
||||||
if (isMac) {
|
if (isMac) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user