diff --git a/flutter/lib/common/widgets/address_book.dart b/flutter/lib/common/widgets/address_book.dart index 5cc06c7a1..983b2219e 100644 --- a/flutter/lib/common/widgets/address_book.dart +++ b/flutter/lib/common/widgets/address_book.dart @@ -229,6 +229,22 @@ class _AddressBookState extends State { ); } + @protected + MenuEntryBase filterMenuItem() { + return MenuEntrySwitch( + switchType: SwitchType.scheckbox, + text: translate('Filter by intersection'), + getter: () async { + return filterAbTagByIntersection(); + }, + setter: (bool v) async { + bind.mainSetLocalOption(key: filterAbTagOption, value: v ? 'Y' : ''); + gFFI.abModel.filterByIntersection.value = v; + }, + dismissOnClicked: true, + ); + } + void _showMenu(RelativeRect pos) { final items = [ getEntry(translate("Add ID"), abAddId), @@ -236,6 +252,7 @@ class _AddressBookState extends State { getEntry(translate("Unselect all tags"), gFFI.abModel.unsetSelectedTags), sortMenuItem(), syncMenuItem(), + filterMenuItem(), ]; mod_menu.showMenu( diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index 2cf1a45c3..c058dd4dc 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -450,12 +450,21 @@ class AddressBookPeersView extends BasePeersView { if (selectedTags.isEmpty) { return true; } - for (final tag in selectedTags) { - if (idents.contains(tag)) { - return true; + if (gFFI.abModel.filterByIntersection.value) { + for (final tag in selectedTags) { + if (!idents.contains(tag)) { + return false; + } } + return true; + } else { + for (final tag in selectedTags) { + if (idents.contains(tag)) { + return true; + } + } + return false; } - return false; } } diff --git a/flutter/lib/models/ab_model.dart b/flutter/lib/models/ab_model.dart index 8d6bfda2c..4cb76ed6f 100644 --- a/flutter/lib/models/ab_model.dart +++ b/flutter/lib/models/ab_model.dart @@ -23,6 +23,11 @@ bool shouldSortTags() { return bind.mainGetLocalOption(key: sortAbTagsOption).isNotEmpty; } +final filterAbTagOption = 'filter-ab-by-intersection'; +bool filterAbTagByIntersection() { + return bind.mainGetLocalOption(key: filterAbTagOption).isNotEmpty; +} + class AbModel { final abLoading = false.obs; final pullError = "".obs; @@ -31,6 +36,7 @@ class AbModel { final RxMap tagColors = Map.fromEntries([]).obs; final peers = List.empty(growable: true).obs; final sortTags = shouldSortTags().obs; + final filterByIntersection = filterAbTagByIntersection().obs; final retrying = false.obs; bool get emtpy => peers.isEmpty && tags.isEmpty; diff --git a/src/lang/ar.rs b/src/lang/ar.rs index 0533591bc..568513504 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 30eb7babf..9dab79371 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 9b7ef42f4..d41af5467 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "启动时检查软件更新"), ("upgrade_rustdesk_server_pro_to_{}_tip", "请升级专业版服务器到{}或更高版本!"), ("pull_group_failed_tip", "获取组信息失败"), + ("Filter by intersection", "按交集过滤") ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 3b9359df0..728f8bb20 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Kontrola aktualizace softwaru při spuštění"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Aktualizujte prosím RustDesk Server Pro na verzi {} nebo novější!"), ("pull_group_failed_tip", "Nepodařilo se obnovit skupinu"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 57769979e..cc4a3503e 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 2f3f725f0..37d58d633 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Beim Start auf Softwareaktualisierung prüfen"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Bitte aktualisieren Sie RustDesk Server Pro auf die Version {} oder neuer!"), ("pull_group_failed_tip", "Aktualisierung der Gruppe fehlgeschlagen"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index b1818d354..183cae8d2 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 44104f1ae..114009526 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 518ab3ce2..9ca8ae68f 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Comprobar actualización al iniciar"), ("upgrade_rustdesk_server_pro_to_{}_tip", "¡Por favor, actualiza RustDesk Server Pro a la versión {} o superior"), ("pull_group_failed_tip", "No se ha podido refrescar el grupo"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index 1aadddf67..9090dfa6b 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index f61cd3f61..bbc2f6524 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Vérifier la disponibilité des mises à jour au démarrage"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Veuillez mettre à jour RustDesk Server Pro avec la version {} ou une version plus récente !"), ("pull_group_failed_tip", "Échec de l'actualisation du groupe"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 3a91e6058..334bb7435 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 57a6d1f64..b455d005d 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Periksa pembaruan aplikasi saat sistem dinyalakan."), ("upgrade_rustdesk_server_pro_to_{}_tip", "Silahkan perbarui RustDesk Server Pro ke versi {} atau yang lebih baru!"), ("pull_group_failed_tip", "Gagal memperbarui grup"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index d8ce18686..c14d45b63 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "All'avvio verifica presenza aggiornamenti programma"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Aggiorna RustDesk Server Pro alla versione {} o successiva!"), ("pull_group_failed_tip", "Impossibile aggiornare il gruppo"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index dc62f16a4..f730a12df 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index e25f0129f..4c8972f75 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index 23f9955c3..865f8e455 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/lt.rs b/src/lang/lt.rs index b12491237..e0374c70f 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/lv.rs b/src/lang/lv.rs index 9f49ea4a8..2ea614dce 100644 --- a/src/lang/lv.rs +++ b/src/lang/lv.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Startējot pārbaudīt, vai nav programmatūras atjauninājumu"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Lūdzu, jauniniet RustDesk Server Pro uz versiju {} vai jaunāku!"), ("pull_group_failed_tip", "Neizdevās atsvaidzināt grupu"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index bba933000..79cbb1ec4 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Checken voor updates bij opstarten"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Upgrade RustDesk Server Pro naar versie {} of nieuwer!"), ("pull_group_failed_tip", "Vernieuwen van groep mislukt"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index be4f442d9..6dc57366c 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Sprawdź aktualizacje przy starcie programu"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Proszę zaktualizować RustDesk Server Pro do wersji {} lub nowszej!"), ("pull_group_failed_tip", "Błąd odświeżania grup"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index c27536851..c8298a749 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 662257511..3d935dfa7 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 14ca50dcf..03b66f2e5 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index fd6687ed1..e5ffec0ab 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "Проверять обновления программы при запуске"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Обновите RustDesk Server Pro до версии {} или новее!"), ("pull_group_failed_tip", "Невозможно обновить группу"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index f64350e20..11d1cc5e7 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index 71cfa4446..c9ff7d82b 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index 324e19e89..3ead4dc70 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 104399803..67969158f 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 14bc6f750..a3dc77764 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index 1817ea1af..a424ba0f9 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index 5d4f2d11c..361da2446 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", "ตรวจสอบการอัปเดตโปรแกรมเมื่อเริ่มต้นใช้งาน"), ("upgrade_rustdesk_server_pro_to_{}_tip", "กรุณาอัปเดต Rustdesk Server Pro ไปยังเวอร์ชัน {} หรือใหม่กว่า!"), ("pull_group_failed_tip", "การเรียกใช้งานกลุ่มล้มเหลว"), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 733be0066..d5d3859b8 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 277a356f3..cf502f914 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 1f4053a32..a5756b5f2 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 5e8570822..9ed649b32 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -556,5 +556,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Check for software update on startup", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("pull_group_failed_tip", ""), + ("Filter by intersection", "") ].iter().cloned().collect(); }