mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 19:17:58 +00:00
@@ -9,7 +9,7 @@ import '../../models/model.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
|
||||
void clientClose(String id, OverlayDialogManager dialogManager) {
|
||||
msgBox(id, '', 'Close', 'Are you sure to close the connection?', '',
|
||||
msgBox(id, 'info', 'Close', 'Are you sure to close the connection?', '',
|
||||
dialogManager);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,10 @@ void showRestartRemoteDevice(
|
||||
]),
|
||||
content: Text(
|
||||
"${translate('Are you sure you want to restart')} \n${pi.username}@${pi.hostname}($id) ?"),
|
||||
onCancel: close,
|
||||
onSubmit: () => close(true),
|
||||
actions: [
|
||||
dialogButton("Cancel", onPressed: () => close(), isOutline: true),
|
||||
dialogButton("Cancel", onPressed: close, isOutline: true),
|
||||
dialogButton("OK", onPressed: () => close(true)),
|
||||
],
|
||||
));
|
||||
@@ -48,6 +50,18 @@ void setPermanentPasswordDialog(OverlayDialogManager dialogManager) async {
|
||||
var validateLength = false;
|
||||
var validateSame = false;
|
||||
dialogManager.show((setState, close) {
|
||||
submit() async {
|
||||
close();
|
||||
dialogManager.showLoading(translate("Waiting"));
|
||||
if (await gFFI.serverModel.setPermanentPassword(p0.text)) {
|
||||
dialogManager.dismissAll();
|
||||
showSuccess();
|
||||
} else {
|
||||
dialogManager.dismissAll();
|
||||
showError();
|
||||
}
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate('Set your own password')),
|
||||
content: Form(
|
||||
@@ -94,29 +108,17 @@ void setPermanentPasswordDialog(OverlayDialogManager dialogManager) async {
|
||||
},
|
||||
),
|
||||
])),
|
||||
onCancel: close,
|
||||
onSubmit: (validateLength && validateSame) ? submit : null,
|
||||
actions: [
|
||||
dialogButton(
|
||||
'Cancel',
|
||||
onPressed: () {
|
||||
close();
|
||||
},
|
||||
onPressed: close,
|
||||
isOutline: true,
|
||||
),
|
||||
dialogButton(
|
||||
'OK',
|
||||
onPressed: (validateLength && validateSame)
|
||||
? () async {
|
||||
close();
|
||||
dialogManager.showLoading(translate("Waiting"));
|
||||
if (await gFFI.serverModel.setPermanentPassword(p0.text)) {
|
||||
dialogManager.dismissAll();
|
||||
showSuccess();
|
||||
} else {
|
||||
dialogManager.dismissAll();
|
||||
showError();
|
||||
}
|
||||
}
|
||||
: null,
|
||||
onPressed: (validateLength && validateSame) ? submit : null,
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -205,26 +207,36 @@ void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
|
||||
});
|
||||
}
|
||||
|
||||
void wrongPasswordDialog(String id, OverlayDialogManager dialogManager) {
|
||||
dialogManager.show((setState, close) => CustomAlertDialog(
|
||||
title: Text(translate('Wrong Password')),
|
||||
content: Text(translate('Do you want to enter again?')),
|
||||
actions: [
|
||||
dialogButton(
|
||||
'Cancel',
|
||||
onPressed: () {
|
||||
close();
|
||||
closeConnection();
|
||||
},
|
||||
isOutline: true,
|
||||
),
|
||||
dialogButton(
|
||||
'Retry',
|
||||
onPressed: () {
|
||||
enterPasswordDialog(id, dialogManager);
|
||||
},
|
||||
),
|
||||
]));
|
||||
void wrongPasswordDialog(
|
||||
String id, OverlayDialogManager dialogManager, type, title, text) {
|
||||
dialogManager.dismissAll();
|
||||
dialogManager.show((setState, close) {
|
||||
cancel() {
|
||||
close();
|
||||
closeConnection();
|
||||
}
|
||||
|
||||
submit() {
|
||||
enterPasswordDialog(id, dialogManager);
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
title: null,
|
||||
content: msgboxContent(type, title, text),
|
||||
onSubmit: submit,
|
||||
onCancel: cancel,
|
||||
actions: [
|
||||
dialogButton(
|
||||
'Cancel',
|
||||
onPressed: cancel,
|
||||
isOutline: true,
|
||||
),
|
||||
dialogButton(
|
||||
'Retry',
|
||||
onPressed: submit,
|
||||
),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
void showServerSettingsWithValue(
|
||||
@@ -352,13 +364,15 @@ void showServerSettingsWithValue(
|
||||
});
|
||||
}
|
||||
|
||||
void showWaitUacDialog(String id, OverlayDialogManager dialogManager) {
|
||||
void showWaitUacDialog(
|
||||
String id, OverlayDialogManager dialogManager, String type) {
|
||||
dialogManager.dismissAll();
|
||||
dialogManager.show(
|
||||
tag: '$id-wait-uac',
|
||||
(setState, close) => CustomAlertDialog(
|
||||
title: Text(translate('Wait')),
|
||||
content: Text(translate('wait_accept_uac_tip')).marginAll(10),
|
||||
title: null,
|
||||
content: msgboxContent(type, 'Wait', 'wait_accept_uac_tip')
|
||||
.marginOnly(bottom: 10),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -516,16 +530,6 @@ void showOnBlockDialog(
|
||||
dialogManager.existing('$id-request-elevation')) {
|
||||
return;
|
||||
}
|
||||
var content = Column(children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
"${translate(text)}${type.contains('uac') ? '\n' : '\n\n'}${translate('request_elevation_tip')}",
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(fontWeight: FontWeight.w400),
|
||||
).marginSymmetric(vertical: 15),
|
||||
),
|
||||
]);
|
||||
dialogManager.show(tag: '$id-$type', (setState, close) {
|
||||
void submit() {
|
||||
close();
|
||||
@@ -533,12 +537,11 @@ void showOnBlockDialog(
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate(title)),
|
||||
content: content,
|
||||
title: null,
|
||||
content: msgboxContent(type, title,
|
||||
"${translate(text)}${type.contains('uac') ? '\n' : '\n\n'}${translate('request_elevation_tip')}"),
|
||||
actions: [
|
||||
dialogButton('Wait', onPressed: () {
|
||||
close();
|
||||
}, isOutline: true),
|
||||
dialogButton('Wait', onPressed: close, isOutline: true),
|
||||
dialogButton('Request Elevation', onPressed: submit),
|
||||
],
|
||||
onSubmit: submit,
|
||||
@@ -556,8 +559,8 @@ void showElevationError(String id, String type, String title, String text,
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate(title)),
|
||||
content: Text(translate(text)),
|
||||
title: null,
|
||||
content: msgboxContent(type, title, text),
|
||||
actions: [
|
||||
dialogButton('Cancel', onPressed: () {
|
||||
close();
|
||||
@@ -570,6 +573,25 @@ void showElevationError(String id, String type, String title, String text,
|
||||
});
|
||||
}
|
||||
|
||||
void showWaitAcceptDialog(String id, String type, String title, String text,
|
||||
OverlayDialogManager dialogManager) {
|
||||
dialogManager.dismissAll();
|
||||
dialogManager.show((setState, close) {
|
||||
onCancel() {
|
||||
closeConnection();
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
title: null,
|
||||
content: msgboxContent(type, title, text),
|
||||
actions: [
|
||||
dialogButton('Cancel', onPressed: onCancel, isOutline: true),
|
||||
],
|
||||
onCancel: onCancel,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Future<String?> validateAsync(String value) async {
|
||||
value = value.trim();
|
||||
if (value.isEmpty) {
|
||||
|
||||
Reference in New Issue
Block a user