An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
rename tag
21pagesdb45552a05ab
diff --git a/flutter/lib/common/widgets/address_book.dart b/flutter/lib/common/widgets/address_book.dartindex c62a88421..fa7d15b73 100644--- a/flutter/lib/common/widgets/address_book.dart+++ b/flutter/lib/common/widgets/address_book.dart@@ -9,6 +9,7 @@ import '../../desktop/widgets/material_mod_popup_menu.dart' as mod_menu;import 'package:get/get.dart';import '../../common.dart';+import 'dialog.dart';import 'login.dart';final hideAbTagsPanel = false.obs;@@ -473,6 +474,29 @@ class AddressBookTag extends StatelessWidget {void _showMenu(BuildContext context, RelativeRect pos) {final items = [+ getEntry(translate("Rename"), () {+ renameDialog(+ oldName: name,+ validator: (String? newName) {+ if (newName == null || newName.isEmpty) {+ return translate('Can not be empty');+ }+ if (newName != name && gFFI.abModel.tags.contains(newName)) {+ return translate('Already exists');+ }+ return null;+ },+ onSubmit: (String newName) {+ if (name != newName) {+ gFFI.abModel.renameTag(name, newName);+ gFFI.abModel.pushAb();+ }+ Future.delayed(Duration.zero, () => Get.back());+ },+ onCancel: () {+ Future.delayed(Duration.zero, () => Get.back());+ });+ }),getEntry(translate("Delete"), () {gFFI.abModel.deleteTag(name);gFFI.abModel.pushAb();diff --git a/flutter/lib/common/widgets/dialog.dart b/flutter/lib/common/widgets/dialog.dartindex 77307418a..40f0901aa 100644--- a/flutter/lib/common/widgets/dialog.dart+++ b/flutter/lib/common/widgets/dialog.dart@@ -1448,3 +1448,74 @@ void editAbTagDialog();});}++void renameDialog(+ {required String oldName,+ FormFieldValidator<String>? validator,+ required ValueChanged<String> onSubmit,+ Function? onCancel}) async {+ RxBool isInProgress = false.obs;+ var controller = TextEditingController(text: oldName);+ final formKey = GlobalKey<FormState>();+ gFFI.dialogManager.show((setState, close, context) {+ submit() async {+ String text = controller.text.trim();+ if (validator != null && formKey.currentState?.validate() == false) {+ return;+ }+ isInProgress.value = true;+ onSubmit(text);+ close();+ isInProgress.value = false;+ }++ cancel() {+ onCancel?.call();+ close();+ }++ return CustomAlertDialog(+ title: Row(+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ Icon(Icons.edit_rounded, color: MyTheme.accent),+ Text(translate('Rename')).paddingOnly(left: 10),+ ],+ ),+ content: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Container(+ child: Form(+ key: formKey,+ child: TextFormField(+ controller: controller,+ autofocus: true,+ decoration: InputDecoration(labelText: translate('Name')),+ validator: validator,+ ),+ ),+ ),+ Obx(() => Offstage(+ offstage: isInProgress.isFalse,+ child: const LinearProgressIndicator())),+ ],+ ),+ actions: [+ dialogButton(+ "Cancel",+ icon: Icon(Icons.close_rounded),+ onPressed: cancel,+ isOutline: true,+ ),+ dialogButton(+ "OK",+ icon: Icon(Icons.done_rounded),+ onPressed: submit,+ ),+ ],+ onSubmit: submit,+ onCancel: cancel,+ );+ });+}diff --git a/flutter/lib/common/widgets/peer_card.dart b/flutter/lib/common/widgets/peer_card.dartindex f12c15160..4d49bd496 100644--- a/flutter/lib/common/widgets/peer_card.dart+++ b/flutter/lib/common/widgets/peer_card.dart@@ -139,9 +139,10 @@ class _PeerCardState extends State<_PeerCard>);},child: GestureDetector(- onDoubleTap: peerTabModel.multiSelectionMode- ? null- : () => widget.connect(context, peer.id),+ onDoubleTap:+ peerTabModel.multiSelectionMode || peerTabModel.isShiftDown+ ? null+ : () => widget.connect(context, peer.id),onTap: () => peerTabModel.select(peer),onLongPress: () => peerTabModel.select(peer),child: Obx(() => peerCardUiType.value == PeerUiType.grid@@ -600,8 +601,16 @@ abstract class BasePeerCard extends StatelessWidget {translate('Rename'),style: style,),- proc: () {- _rename(id);+ proc: () async {+ String oldName = await _getAlias(id);+ renameDialog(+ oldName: oldName,+ onSubmit: (String newName) async {+ if (newName != oldName) {+ await bind.mainSetPeerAlias(id: id, alias: newName);+ _update();+ }+ });},padding: menuPadding,dismissOnClicked: true,@@ -771,64 +780,6 @@ abstract class BasePeerCard extends StatelessWidget {Future<String> _getAlias(String id) async =>await bind.mainGetPeerOption(id: id, key: 'alias');- void _rename(String id) async {- RxBool isInProgress = false.obs;- String name = await _getAlias(id);- var controller = TextEditingController(text: name);- gFFI.dialogManager.show((setState, close, context) {- submit() async {- isInProgress.value = true;- String name = controller.text.trim();- await bind.mainSetPeerAlias(id: id, alias: name);- _update();- close();- isInProgress.value = false;- }-- return CustomAlertDialog(- title: Row(- mainAxisAlignment: MainAxisAlignment.center,- children: [- Icon(Icons.edit_rounded, color: MyTheme.accent),- Text(translate('Rename')).paddingOnly(left: 10),- ],- ),- content: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Container(- child: Form(- child: TextFormField(- controller: controller,- autofocus: true,- decoration: InputDecoration(labelText: translate('Name')),- ),- ),- ),- Obx(() => Offstage(- offstage: isInProgress.isFalse,- child: const LinearProgressIndicator())),- ],- ),- 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,- );- });- }-@protectedvoid _update();}diff --git a/flutter/lib/models/ab_model.dart b/flutter/lib/models/ab_model.dartindex 5bbbc0f9f..be801a141 100644--- a/flutter/lib/models/ab_model.dart+++ b/flutter/lib/models/ab_model.dart@@ -223,6 +223,33 @@ class AbModel {}}+ void renameTag(String oldTag, String newTag) {+ if (tags.contains(newTag)) return;+ tags.value = tags.map((e) {+ if (e == oldTag) {+ return newTag;+ } else {+ return oldTag;+ }+ }).toList();+ selectedTags.value = selectedTags.map((e) {+ if (e == oldTag) {+ return newTag;+ } else {+ return oldTag;+ }+ }).toList();+ for (var peer in peers) {+ peer.tags = peer.tags.map((e) {+ if (e == oldTag) {+ return newTag;+ } else {+ return oldTag;+ }+ }).toList();+ }+ }+void unsetSelectedTags() {selectedTags.clear();}diff --git a/src/lang/ca.rs b/src/lang/ca.rsindex b3d913b62..23914b810 100644--- a/src/lang/ca.rs+++ b/src/lang/ca.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/cn.rs b/src/lang/cn.rsindex 83060c6af..6c4565fe7 100644--- a/src/lang/cn.rs+++ b/src/lang/cn.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "对标签进行排序"),("Open connection in new tab", "在选项卡中打开新连接"),("Move tab to new window", "将标签页移至新窗口"),+ ("Can not be empty", "不能为空"),+ ("Already exists", "已经存在"),].iter().cloned().collect();}diff --git a/src/lang/cs.rs b/src/lang/cs.rsindex 2d7a7ce16..b2a304c39 100644--- a/src/lang/cs.rs+++ b/src/lang/cs.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/da.rs b/src/lang/da.rsindex 0a10551d3..df3aecc45 100644--- a/src/lang/da.rs+++ b/src/lang/da.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/de.rs b/src/lang/de.rsindex ffb62a45f..c33510135 100644--- a/src/lang/de.rs+++ b/src/lang/de.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "Tags sortieren"),("Open connection in new tab", "Verbindung in neuem Tab öffnen"),("Move tab to new window", "Tab in neues Fenster verschieben"),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/el.rs b/src/lang/el.rsindex 33f4d74b8..846c632c7 100644--- a/src/lang/el.rs+++ b/src/lang/el.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/eo.rs b/src/lang/eo.rsindex 8b29e418e..aec715f72 100644--- a/src/lang/eo.rs+++ b/src/lang/eo.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/es.rs b/src/lang/es.rsindex 27752e989..dcd39c9a7 100644--- a/src/lang/es.rs+++ b/src/lang/es.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "Ordenar etiquetas"),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/fa.rs b/src/lang/fa.rsindex 0b56e073f..7cda61f82 100644--- a/src/lang/fa.rs+++ b/src/lang/fa.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/fr.rs b/src/lang/fr.rsindex 8a2baef55..3acbdf800 100644--- a/src/lang/fr.rs+++ b/src/lang/fr.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/hu.rs b/src/lang/hu.rsindex 36c43fec9..44158db0d 100644--- a/src/lang/hu.rs+++ b/src/lang/hu.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/id.rs b/src/lang/id.rsindex c65eee87d..dac33d1f0 100644--- a/src/lang/id.rs+++ b/src/lang/id.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/it.rs b/src/lang/it.rsindex 5a655ce5a..8dac0ba73 100644--- a/src/lang/it.rs+++ b/src/lang/it.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "Ordina etichette"),("Open connection in new tab", "Apri connessione in una nuova scheda"),("Move tab to new window", "Sposta scheda nella finestra successiva"),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/ja.rs b/src/lang/ja.rsindex 6ece9d5c9..5099a8387 100644--- a/src/lang/ja.rs+++ b/src/lang/ja.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/ko.rs b/src/lang/ko.rsindex 6ea9b94ea..43cc3526b 100644--- a/src/lang/ko.rs+++ b/src/lang/ko.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/kz.rs b/src/lang/kz.rsindex e5d035b03..ea08bfc58 100644--- a/src/lang/kz.rs+++ b/src/lang/kz.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/lt.rs b/src/lang/lt.rsindex 47b70acfd..4cbf215a4 100644--- a/src/lang/lt.rs+++ b/src/lang/lt.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/nl.rs b/src/lang/nl.rsindex 08934cea0..312def157 100644--- a/src/lang/nl.rs+++ b/src/lang/nl.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "Labels sorteren"),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/pl.rs b/src/lang/pl.rsindex 84f13c617..cdab09c7c 100644--- a/src/lang/pl.rs+++ b/src/lang/pl.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "Znaczniki sortowania"),("Open connection in new tab", ""),("Move tab to new window", "Przenieś zakładkę do nowego okna"),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rsindex b9e155364..7bfad8a10 100644--- a/src/lang/pt_PT.rs+++ b/src/lang/pt_PT.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rsindex 81fd68ac6..df0e922bd 100644--- a/src/lang/ptbr.rs+++ b/src/lang/ptbr.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/ro.rs b/src/lang/ro.rsindex ddd141fa4..0e280496d 100644--- a/src/lang/ro.rs+++ b/src/lang/ro.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/ru.rs b/src/lang/ru.rsindex c0f129ab0..ea51c660f 100644--- a/src/lang/ru.rs+++ b/src/lang/ru.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "Сортировка меток"),("Open connection in new tab", "Открыть подключение в новой вкладке"),("Move tab to new window", "Переместить вкладку в отдельное окно"),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/sk.rs b/src/lang/sk.rsindex afe52f4ad..487edfbfd 100644--- a/src/lang/sk.rs+++ b/src/lang/sk.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/sl.rs b/src/lang/sl.rsindex dc79f9e44..dc51191ba 100755--- a/src/lang/sl.rs+++ b/src/lang/sl.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/sq.rs b/src/lang/sq.rsindex 86f3f3544..7ac82ee65 100644--- a/src/lang/sq.rs+++ b/src/lang/sq.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/sr.rs b/src/lang/sr.rsindex 06667f4c5..686d0c66c 100644--- a/src/lang/sr.rs+++ b/src/lang/sr.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/sv.rs b/src/lang/sv.rsindex 2e8ea8713..072baf201 100644--- a/src/lang/sv.rs+++ b/src/lang/sv.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/template.rs b/src/lang/template.rsindex ed3f41efc..ff87844cd 100644--- a/src/lang/template.rs+++ b/src/lang/template.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/th.rs b/src/lang/th.rsindex 09ade050f..4f462ef6a 100644--- a/src/lang/th.rs+++ b/src/lang/th.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/tr.rs b/src/lang/tr.rsindex 629a144fd..b184dff21 100644--- a/src/lang/tr.rs+++ b/src/lang/tr.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/tw.rs b/src/lang/tw.rsindex 80e4f31c2..2f374329e 100644--- a/src/lang/tw.rs+++ b/src/lang/tw.rs@@ -529,5 +529,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", "排序標籤"),("Open connection in new tab", "在新分頁開啟連線"),("Move tab to new window", "移動標籤到新視窗"),+ ("Can not be empty", "不能為空"),+ ("Already exists", "已經存在"),].iter().cloned().collect();}diff --git a/src/lang/ua.rs b/src/lang/ua.rsindex a12e2fd10..ac5e0b672 100644--- a/src/lang/ua.rs+++ b/src/lang/ua.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}diff --git a/src/lang/vn.rs b/src/lang/vn.rsindex 0db48584e..335f25a58 100644--- a/src/lang/vn.rs+++ b/src/lang/vn.rs@@ -526,5 +526,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("Sort tags", ""),("Open connection in new tab", ""),("Move tab to new window", ""),+ ("Can not be empty", ""),+ ("Already exists", ""),].iter().cloned().collect();}