mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-02-17 14:07:28 +08:00
feat: remote printer (#11231)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -3789,3 +3789,29 @@ void updateTextAndPreserveSelection(
|
||||
baseOffset: 0, extentOffset: controller.value.text.length);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> getPrinterNames() {
|
||||
final printerNamesJson = bind.mainGetPrinterNames();
|
||||
if (printerNamesJson.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
final List<dynamic> printerNamesList = jsonDecode(printerNamesJson);
|
||||
final appPrinterName = '$appName Printer';
|
||||
return printerNamesList
|
||||
.map((e) => e.toString())
|
||||
.where((name) => name != appPrinterName)
|
||||
.toList();
|
||||
} catch (e) {
|
||||
debugPrint('failed to parse printer names, err: $e');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
String _appName = '';
|
||||
String get appName {
|
||||
if (_appName.isEmpty) {
|
||||
_appName = bind.mainGetAppNameSync();
|
||||
}
|
||||
return _appName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user