copy id/password on double tap, some menu divider

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-08-03 09:08:10 +08:00
parent 043a3e5f34
commit 2a2017df67
19 changed files with 51 additions and 23 deletions

View File

@ -127,11 +127,16 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
})
],
),
TextFormField(
GestureDetector(
onDoubleTap: () {
Clipboard.setData(
ClipboardData(text: model.serverId.text));
showToast(translate("Copied"));
},
child: TextFormField(
controller: model.serverId,
enableInteractiveSelection: true,
readOnly: true,
),
)),
],
),
),
@ -151,7 +156,7 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
},
onTap: () async {
final userName = await gFFI.userModel.getUserName();
var menu = [
var menu = <PopupMenuEntry>[
genEnablePopupMenuItem(
translate("Enable Keyboard/Mouse"),
'enable-keyboard',
@ -169,6 +174,7 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
'enable-tunnel',
),
genAudioInputPopupMenuItem(),
PopupMenuDivider(),
PopupMenuItem(
child: Text(translate("ID/Relay Server")),
value: 'custom-server',
@ -181,7 +187,7 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
child: Text(translate("Socks5 Proxy")),
value: 'socks5-proxy',
),
// sep
PopupMenuDivider(),
genEnablePopupMenuItem(
translate("Enable Service"),
'stop-service',
@ -195,6 +201,7 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
translate("Start ID/relay service"),
'stop-rendezvous-service',
),
PopupMenuDivider(),
userName.isEmpty
? PopupMenuItem(
child: Text(translate("Login")),
@ -208,6 +215,7 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
child: Text(translate("Change ID")),
value: 'change-id',
),
PopupMenuDivider(),
genEnablePopupMenuItem(
translate("Dark Theme"),
'allow-darktheme',
@ -252,12 +260,18 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
Row(
children: [
Expanded(
child: GestureDetector(
onDoubleTap: () {
Clipboard.setData(
ClipboardData(text: model.serverPasswd.text));
showToast(translate("Copied"));
},
child: TextFormField(
controller: model.serverPasswd,
enableInteractiveSelection: true,
readOnly: true,
),
),
),
IconButton(
icon: Icon(Icons.refresh),
onPressed: () {
@ -307,15 +321,15 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
),
],
),
value: value,
onTap: () => gFFI.serverModel.verificationMethod = value,
);
final temporary_enabled =
gFFI.serverModel.verificationMethod != kUsePermanentPassword;
var menu = [
var menu = <PopupMenuEntry>[
method(translate("Use temporary password"), kUseTemporaryPassword),
method(translate("Use permanent password"), kUsePermanentPassword),
method(translate("Use both passwords"), kUseBothPasswords),
PopupMenuDivider(),
PopupMenuItem(
child: Text(translate("Set permanent password")),
value: 'set-permanent-password',
@ -323,7 +337,10 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
kUseTemporaryPassword),
PopupMenuItem(
child: PopupMenuButton(
child: Text("Set temporary password length"),
padding: EdgeInsets.zero,
child: Text(
translate("Set temporary password length"),
),
itemBuilder: (context) => ["6", "8", "10"]
.map((e) => PopupMenuItem(
child: Row(
@ -338,7 +355,6 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
),
],
),
value: e,
onTap: () {
if (gFFI.serverModel.temporaryPasswordLength !=
e) {
@ -350,16 +366,13 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener {
.toList(),
enabled: temporary_enabled,
),
value: 'set-temporary-password-length',
enabled: temporary_enabled),
];
final v =
await showMenu(context: context, position: position, items: menu);
if (v != null) {
if (v == "set-permanent-password") {
setPasswordDialog();
}
}
},
child: Icon(Icons.edit));
}
@ -1372,9 +1385,6 @@ void setPasswordDialog() {
),
],
),
SizedBox(
height: 4.0,
),
],
),
),

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "确定要重启"),
("Restarting Remote Device", "正在重启远程设备"),
("remote_restarting_tip", "远程设备正在重启, 请关闭当前提示框, 并在一段时间后使用永久密码重新连接"),
("Copied", "已复制"),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Möchten Sie das entfernte Gerät wirklich neu starten?"),
("Restarting Remote Device", "Entferntes Gerät wird neu gestartet"),
("remote_restarting_tip", "Entferntes Gerät startet neu, bitte schließen Sie diese Meldung und verbinden Sie sich mit dem dauerhaften Passwort erneut."),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Esta Seguro que desea reiniciar?"),
("Restarting Remote Device", "Reiniciando dispositivo remoto"),
("remote_restarting_tip", "Dispositivo remoto reiniciando, favor de cerrar este mensaje y reconectarse con la contraseña permamente despues de un momento."),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Apakah Anda yakin untuk memulai ulang"),
("Restarting Remote Device", "Memulai Ulang Perangkat Jarak Jauh"),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -300,5 +300,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Activate onetime password", "Aktywuj hasło jednorazowe"),
("Set security password", "Ustaw hasło zabezpieczające"),
("Connection not allowed", "Połączenie niedozwolone"),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Вы уверены, что хотите выполнить перезапуск?"),
("Restarting Remote Device", "Перезагрузка удаленного устройства"),
("remote_restarting_tip", "Удаленное устройство перезапускается. Пожалуйста, закройте это сообщение и через некоторое время переподключитесь, используя постоянный пароль."),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", ""),
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Yeniden başlatmak istediğinize emin misin?"),
("Restarting Remote Device", "Uzaktan yeniden başlatılıyor"),
("remote_restarting_tip", ""),
("Copied", ""),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "确定要重启"),
("Restarting Remote Device", "正在重啓遠程設備"),
("remote_restarting_tip", "遠程設備正在重啓,請關閉當前提示框,並在一段時間後使用永久密碼重新連接"),
("Copied", "已複製"),
].iter().cloned().collect();
}

View File

@ -299,5 +299,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Bạn có chắc bạn muốn khởi động lại không"),
("Restarting Remote Device", "Đang khởi động lại thiết bị từ xa"),
("remote_restarting_tip", "Thiết bị từ xa đang khởi động lại, hãy đóng cửa sổ tin nhắn này và kết nối lại với mật khẩu vĩnh viễn sau một khoảng thời gian"),
("Copied", ""),
].iter().cloned().collect();
}