diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index 0a86350d8..6dc5e8f2f 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -127,11 +127,16 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener { }) ], ), - TextFormField( - controller: model.serverId, - enableInteractiveSelection: true, - readOnly: true, - ), + GestureDetector( + onDoubleTap: () { + Clipboard.setData( + ClipboardData(text: model.serverId.text)); + showToast(translate("Copied")); + }, + child: TextFormField( + controller: model.serverId, + 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,10 +260,16 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener { Row( children: [ Expanded( - child: TextFormField( - controller: model.serverPasswd, - enableInteractiveSelection: true, - readOnly: true, + child: GestureDetector( + onDoubleTap: () { + Clipboard.setData( + ClipboardData(text: model.serverPasswd.text)); + showToast(translate("Copied")); + }, + child: TextFormField( + controller: model.serverPasswd, + readOnly: true, + ), ), ), IconButton( @@ -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,15 +366,12 @@ 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(); - } + if (v == "set-permanent-password") { + setPasswordDialog(); } }, child: Icon(Icons.edit)); @@ -1372,9 +1385,6 @@ void setPasswordDialog() { ), ], ), - SizedBox( - height: 4.0, - ), ], ), ), diff --git a/src/lang/cn.rs b/src/lang/cn.rs index bc06828a5..df5cfdfd7 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -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(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 91437b2af..86aada74f 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -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(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 87e687936..8f4861c2a 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -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(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 8acc30991..6af6841b6 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -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(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 1be29dd07..0c68bd569 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -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(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 8ae2feecd..9eef5a5a8 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -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(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 7dd0fb9a9..51d079b03 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -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(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index de9f8922b..5590e0ec9 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -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(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 62cb7b6b5..ef1078175 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -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(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 8058806c2..2834644eb 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -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(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 71b753ac3..8602d0647 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -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(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 0aac8bc8a..75d3af784 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -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(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 0b18683a2..d44751cd8 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -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(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 7f07657eb..f94db252b 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -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(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index e6b2bd01d..ca64b2ac7 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -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(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index b06c0e7f3..cff01dcc8 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -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(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index ce7804a65..79435a69c 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -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(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 014dcb20e..65ffcb61c 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -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(); }