commit
38d4f29e51
@ -11,6 +11,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_hbb/common/formatter/id_formatter.dart';
|
||||||
import 'package:flutter_hbb/desktop/widgets/refresh_wrapper.dart';
|
import 'package:flutter_hbb/desktop/widgets/refresh_wrapper.dart';
|
||||||
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
||||||
import 'package:flutter_hbb/main.dart';
|
import 'package:flutter_hbb/main.dart';
|
||||||
@ -1842,6 +1843,14 @@ connect(
|
|||||||
bool isRDP = false,
|
bool isRDP = false,
|
||||||
}) async {
|
}) async {
|
||||||
if (id == '') return;
|
if (id == '') return;
|
||||||
|
if (!isDesktop || desktopType == DesktopType.main) {
|
||||||
|
try {
|
||||||
|
if (Get.isRegistered<IDTextEditingController>()) {
|
||||||
|
final idController = Get.find<IDTextEditingController>();
|
||||||
|
idController.text = formatID(id);
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
id = id.replaceAll(' ', '');
|
id = id.replaceAll(' ', '');
|
||||||
final oldId = id;
|
final oldId = id;
|
||||||
id = await bind.mainHandleRelayId(id: id);
|
id = await bind.mainHandleRelayId(id: id);
|
||||||
|
@ -35,6 +35,11 @@ class IDTextInputFormatter extends TextInputFormatter {
|
|||||||
|
|
||||||
String formatID(String id) {
|
String formatID(String id) {
|
||||||
String id2 = id.replaceAll(' ', '');
|
String id2 = id.replaceAll(' ', '');
|
||||||
|
String suffix = '';
|
||||||
|
if (id2.endsWith(r'\r') || id2.endsWith(r'/r')) {
|
||||||
|
suffix = id2.substring(id2.length - 2, id2.length);
|
||||||
|
id2 = id2.substring(0, id2.length - 2);
|
||||||
|
}
|
||||||
if (int.tryParse(id2) == null) return id;
|
if (int.tryParse(id2) == null) return id;
|
||||||
String newID = '';
|
String newID = '';
|
||||||
if (id2.length <= 3) {
|
if (id2.length <= 3) {
|
||||||
@ -47,7 +52,7 @@ String formatID(String id) {
|
|||||||
newID += " ${id2.substring(i, i + 3)}";
|
newID += " ${id2.substring(i, i + 3)}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newID;
|
return newID + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
String trimID(String id) {
|
String trimID(String id) {
|
||||||
|
@ -1352,7 +1352,7 @@ customImageQualityDialog(SessionID sessionId, String id, FFI ffi) async {
|
|||||||
msgBoxCommon(ffi.dialogManager, 'Custom Image Quality', content, [btnClose]);
|
msgBoxCommon(ffi.dialogManager, 'Custom Image Quality', content, [btnClose]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deletePeerConfirmDialog(Function onSubmit) async {
|
void deletePeerConfirmDialog(Function onSubmit, String title) async {
|
||||||
gFFI.dialogManager.show(
|
gFFI.dialogManager.show(
|
||||||
(setState, close, context) {
|
(setState, close, context) {
|
||||||
submit() async {
|
submit() async {
|
||||||
@ -1368,8 +1368,10 @@ void deletePeerConfirmDialog(Function onSubmit) async {
|
|||||||
Icons.delete_rounded,
|
Icons.delete_rounded,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
),
|
),
|
||||||
Text(translate('Delete')).paddingOnly(
|
Expanded(
|
||||||
left: 10,
|
child: Text(title, overflow: TextOverflow.ellipsis).paddingOnly(
|
||||||
|
left: 10,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -542,8 +542,8 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
_openInTabsAction(String id) async =>
|
_openInTabsAction(String id) async =>
|
||||||
await _openNewConnInAction(id, 'Open in New Tab', kOptionOpenInTabs);
|
await _openNewConnInAction(id, 'Open in New Tab', kOptionOpenInTabs);
|
||||||
|
|
||||||
_openInWindowsAction(String id) async =>
|
_openInWindowsAction(String id) async => await _openNewConnInAction(
|
||||||
await _openNewConnInAction(id, 'Open in New Window', kOptionOpenInWindows);
|
id, 'Open in New Window', kOptionOpenInWindows);
|
||||||
|
|
||||||
_openNewConnInOptAction(String id) async =>
|
_openNewConnInOptAction(String id) async =>
|
||||||
mainGetLocalBoolOptionSync(kOptionOpenNewConnInTabs)
|
mainGetLocalBoolOptionSync(kOptionOpenNewConnInTabs)
|
||||||
@ -636,7 +636,8 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePeerConfirmDialog(onSubmit);
|
deletePeerConfirmDialog(onSubmit,
|
||||||
|
'${translate('Delete')} "${peer.alias.isEmpty ? formatID(peer.id) : peer.alias}"?');
|
||||||
},
|
},
|
||||||
padding: menuPadding,
|
padding: menuPadding,
|
||||||
dismissOnClicked: true,
|
dismissOnClicked: true,
|
||||||
|
@ -312,7 +312,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
showToast(translate('Successful'));
|
showToast(translate('Successful'));
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePeerConfirmDialog(onSubmit);
|
deletePeerConfirmDialog(onSubmit, translate('Delete'));
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: translate('Delete'),
|
message: translate('Delete'),
|
||||||
|
@ -68,6 +68,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
_idController.selection = TextSelection(
|
_idController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: _idController.value.text.length);
|
baseOffset: 0, extentOffset: _idController.value.text.length);
|
||||||
});
|
});
|
||||||
|
Get.put<IDTextEditingController>(_idController);
|
||||||
windowManager.addListener(this);
|
windowManager.addListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
_idController.addListener(() {
|
_idController.addListener(() {
|
||||||
_idEmpty.value = _idController.text.isEmpty;
|
_idEmpty.value = _idController.text.isEmpty;
|
||||||
});
|
});
|
||||||
|
Get.put<IDTextEditingController>(_idController);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1209,6 +1209,10 @@ impl LoginConfigHandler {
|
|||||||
/// * `k` - key of option
|
/// * `k` - key of option
|
||||||
/// * `v` - value of option
|
/// * `v` - value of option
|
||||||
pub fn save_ui_flutter(&mut self, k: String, v: String) {
|
pub fn save_ui_flutter(&mut self, k: String, v: String) {
|
||||||
|
if self.version == 0 && k == "wm_" {
|
||||||
|
log::info!("skip saving {k}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
let mut config = self.load_config();
|
let mut config = self.load_config();
|
||||||
config.ui_flutter.insert(k, v);
|
config.ui_flutter.insert(k, v);
|
||||||
self.save_config(config);
|
self.save_config(config);
|
||||||
|
@ -850,6 +850,11 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn sync_jobs_status_to_local(&mut self) -> bool {
|
pub async fn sync_jobs_status_to_local(&mut self) -> bool {
|
||||||
|
let peer_version = self.handler.lc.read().unwrap().version;
|
||||||
|
if peer_version == 0 {
|
||||||
|
log::info!("skip saving job status");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
log::info!("sync transfer job status");
|
log::info!("sync transfer job status");
|
||||||
let mut config: PeerConfig = self.handler.load_config();
|
let mut config: PeerConfig = self.handler.load_config();
|
||||||
let mut transfer_metas = TransferSerde::default();
|
let mut transfer_metas = TransferSerde::default();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user