Move restart to tab right menu, and remove some items
This commit is contained in:
parent
5124cc49b3
commit
26ba25d2ae
@ -129,7 +129,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
|||||||
} else {
|
} else {
|
||||||
final opt = "enable-confirm-closing-tabs";
|
final opt = "enable-confirm-closing-tabs";
|
||||||
final bool res;
|
final bool res;
|
||||||
if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
|
if (!option2bool(opt, bind.mainGetLocalOption(key: opt))) {
|
||||||
res = true;
|
res = true;
|
||||||
} else {
|
} else {
|
||||||
res = await closeConfirmDialog();
|
res = await closeConfirmDialog();
|
||||||
|
@ -19,6 +19,8 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:bot_toast/bot_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
|
||||||
|
import '../../common/widgets/dialog.dart';
|
||||||
|
import '../../common/widgets/toolbar.dart';
|
||||||
import '../../models/platform_model.dart';
|
import '../../models/platform_model.dart';
|
||||||
|
|
||||||
class _MenuTheme {
|
class _MenuTheme {
|
||||||
@ -45,16 +47,17 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
static const IconData unselectedIcon = Icons.desktop_windows_outlined;
|
static const IconData unselectedIcon = Icons.desktop_windows_outlined;
|
||||||
|
|
||||||
late ToolbarState _toolbarState;
|
late ToolbarState _toolbarState;
|
||||||
|
String? peerId;
|
||||||
|
|
||||||
var connectionMap = RxList<Widget>.empty(growable: true);
|
var connectionMap = RxList<Widget>.empty(growable: true);
|
||||||
|
|
||||||
_ConnectionTabPageState(Map<String, dynamic> params) {
|
_ConnectionTabPageState(Map<String, dynamic> params) {
|
||||||
_toolbarState = ToolbarState();
|
_toolbarState = ToolbarState();
|
||||||
RemoteCountState.init();
|
RemoteCountState.init();
|
||||||
final peerId = params['id'];
|
peerId = params['id'];
|
||||||
final sessionId = params['session_id'];
|
final sessionId = params['session_id'];
|
||||||
if (peerId != null) {
|
if (peerId != null) {
|
||||||
ConnectionTypeState.init(peerId);
|
ConnectionTypeState.init(peerId!);
|
||||||
tabController.onSelected = (id) {
|
tabController.onSelected = (id) {
|
||||||
final remotePage = tabController.widget(id);
|
final remotePage = tabController.widget(id);
|
||||||
if (remotePage is RemotePage) {
|
if (remotePage is RemotePage) {
|
||||||
@ -66,14 +69,14 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
UnreadChatCountState.find(id).value = 0;
|
UnreadChatCountState.find(id).value = 0;
|
||||||
};
|
};
|
||||||
tabController.add(TabInfo(
|
tabController.add(TabInfo(
|
||||||
key: peerId,
|
key: peerId!,
|
||||||
label: peerId,
|
label: peerId!,
|
||||||
selectedIcon: selectedIcon,
|
selectedIcon: selectedIcon,
|
||||||
unselectedIcon: unselectedIcon,
|
unselectedIcon: unselectedIcon,
|
||||||
onTabCloseButton: () => tabController.closeBy(peerId),
|
onTabCloseButton: () => tabController.closeBy(peerId),
|
||||||
page: RemotePage(
|
page: RemotePage(
|
||||||
key: ValueKey(peerId),
|
key: ValueKey(peerId),
|
||||||
id: peerId,
|
id: peerId!,
|
||||||
sessionId: sessionId == null ? null : SessionID(sessionId),
|
sessionId: sessionId == null ? null : SessionID(sessionId),
|
||||||
password: params['password'],
|
password: params['password'],
|
||||||
toolbarState: _toolbarState,
|
toolbarState: _toolbarState,
|
||||||
@ -213,6 +216,9 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
}
|
}
|
||||||
var msgFingerprint = '${translate('Fingerprint')}:\n';
|
var msgFingerprint = '${translate('Fingerprint')}:\n';
|
||||||
var fingerprint = FingerprintState.find(key).value;
|
var fingerprint = FingerprintState.find(key).value;
|
||||||
|
if (fingerprint.isEmpty) {
|
||||||
|
fingerprint = 'N/A';
|
||||||
|
}
|
||||||
if (fingerprint.length > 5 * 8) {
|
if (fingerprint.length > 5 * 8) {
|
||||||
var first = fingerprint.substring(0, 39);
|
var first = fingerprint.substring(0, 39);
|
||||||
var second = fingerprint.substring(40);
|
var second = fingerprint.substring(40);
|
||||||
@ -285,17 +291,6 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
final perms = ffi.ffiModel.permissions;
|
final perms = ffi.ffiModel.permissions;
|
||||||
final sessionId = ffi.sessionId;
|
final sessionId = ffi.sessionId;
|
||||||
menu.addAll([
|
menu.addAll([
|
||||||
MenuEntryButton<String>(
|
|
||||||
childBuilder: (TextStyle? style) => Text(
|
|
||||||
translate('Close'),
|
|
||||||
style: style,
|
|
||||||
),
|
|
||||||
proc: () {
|
|
||||||
tabController.closeBy(key);
|
|
||||||
cancelFunc();
|
|
||||||
},
|
|
||||||
padding: padding,
|
|
||||||
),
|
|
||||||
MenuEntryButton<String>(
|
MenuEntryButton<String>(
|
||||||
childBuilder: (TextStyle? style) => Obx(() => Text(
|
childBuilder: (TextStyle? style) => Obx(() => Text(
|
||||||
translate(
|
translate(
|
||||||
@ -308,27 +303,8 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
},
|
},
|
||||||
padding: padding,
|
padding: padding,
|
||||||
),
|
),
|
||||||
MenuEntryDivider<String>(),
|
|
||||||
RemoteMenuEntry.viewStyle(
|
|
||||||
key,
|
|
||||||
ffi,
|
|
||||||
padding,
|
|
||||||
dismissFunc: cancelFunc,
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!ffi.canvasModel.cursorEmbedded &&
|
|
||||||
!ffi.ffiModel.viewOnly &&
|
|
||||||
!pi.is_wayland) {
|
|
||||||
menu.add(MenuEntryDivider<String>());
|
|
||||||
menu.add(RemoteMenuEntry.showRemoteCursor(
|
|
||||||
key,
|
|
||||||
sessionId,
|
|
||||||
padding,
|
|
||||||
dismissFunc: cancelFunc,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tabController.state.value.tabs.length > 1) {
|
if (tabController.state.value.tabs.length > 1) {
|
||||||
final splitAction = MenuEntryButton<String>(
|
final splitAction = MenuEntryButton<String>(
|
||||||
childBuilder: (TextStyle? style) => Text(
|
childBuilder: (TextStyle? style) => Text(
|
||||||
@ -336,8 +312,8 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
style: style,
|
style: style,
|
||||||
),
|
),
|
||||||
proc: () async {
|
proc: () async {
|
||||||
await DesktopMultiWindow.invokeMethod(
|
await DesktopMultiWindow.invokeMethod(kMainWindowId,
|
||||||
kMainWindowId, kWindowEventMoveTabToNewWindow, '${windowId()},$key,$sessionId');
|
kWindowEventMoveTabToNewWindow, '${windowId()},$key,$sessionId');
|
||||||
cancelFunc();
|
cancelFunc();
|
||||||
},
|
},
|
||||||
padding: padding,
|
padding: padding,
|
||||||
@ -345,31 +321,49 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
menu.insert(1, splitAction);
|
menu.insert(1, splitAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (perms['keyboard'] != false && !ffi.ffiModel.viewOnly) {
|
if (perms['restart'] != false &&
|
||||||
if (perms['clipboard'] != false) {
|
(pi.platform == kPeerPlatformLinux ||
|
||||||
menu.add(RemoteMenuEntry.disableClipboard(sessionId, padding,
|
pi.platform == kPeerPlatformWindows ||
|
||||||
dismissFunc: cancelFunc));
|
pi.platform == kPeerPlatformMacOS)) {
|
||||||
}
|
menu.add(MenuEntryButton<String>(
|
||||||
|
childBuilder: (TextStyle? style) => Text(
|
||||||
menu.add(RemoteMenuEntry.insertLock(sessionId, padding,
|
translate('Restart Remote Device'),
|
||||||
dismissFunc: cancelFunc));
|
style: style,
|
||||||
|
),
|
||||||
if (pi.platform == kPeerPlatformLinux || pi.sasEnabled) {
|
proc: () => showRestartRemoteDevice(
|
||||||
menu.add(RemoteMenuEntry.insertCtrlAltDel(sessionId, padding,
|
pi, peerId ?? '', sessionId, ffi.dialogManager),
|
||||||
dismissFunc: cancelFunc));
|
padding: padding,
|
||||||
}
|
dismissOnClicked: true,
|
||||||
|
dismissCallback: cancelFunc,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.add(MenuEntryButton<String>(
|
if (perms['keyboard'] != false && !ffi.ffiModel.viewOnly) {}
|
||||||
childBuilder: (TextStyle? style) => Text(
|
|
||||||
translate('Copy Fingerprint'),
|
menu.addAll([
|
||||||
style: style,
|
MenuEntryDivider<String>(),
|
||||||
|
MenuEntryButton<String>(
|
||||||
|
childBuilder: (TextStyle? style) => Text(
|
||||||
|
translate('Copy Fingerprint'),
|
||||||
|
style: style,
|
||||||
|
),
|
||||||
|
proc: () => onCopyFingerprint(FingerprintState.find(key).value),
|
||||||
|
padding: padding,
|
||||||
|
dismissOnClicked: true,
|
||||||
|
dismissCallback: cancelFunc,
|
||||||
),
|
),
|
||||||
proc: () => onCopyFingerprint(FingerprintState.find(key).value),
|
MenuEntryButton<String>(
|
||||||
padding: padding,
|
childBuilder: (TextStyle? style) => Text(
|
||||||
dismissOnClicked: true,
|
translate('Close'),
|
||||||
dismissCallback: cancelFunc,
|
style: style,
|
||||||
));
|
),
|
||||||
|
proc: () {
|
||||||
|
tabController.closeBy(key);
|
||||||
|
cancelFunc();
|
||||||
|
},
|
||||||
|
padding: padding,
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
|
||||||
return mod_menu.PopupMenu<String>(
|
return mod_menu.PopupMenu<String>(
|
||||||
items: menu
|
items: menu
|
||||||
@ -405,7 +399,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
} else {
|
} else {
|
||||||
final opt = "enable-confirm-closing-tabs";
|
final opt = "enable-confirm-closing-tabs";
|
||||||
final bool res;
|
final bool res;
|
||||||
if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
|
if (!option2bool(opt, bind.mainGetLocalOption(key: opt))) {
|
||||||
res = true;
|
res = true;
|
||||||
} else {
|
} else {
|
||||||
res = await closeConfirmDialog();
|
res = await closeConfirmDialog();
|
||||||
|
@ -254,7 +254,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
|
|||||||
} else {
|
} else {
|
||||||
final opt = "enable-confirm-closing-tabs";
|
final opt = "enable-confirm-closing-tabs";
|
||||||
final bool res;
|
final bool res;
|
||||||
if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
|
if (!option2bool(opt, bind.mainGetLocalOption(key: opt))) {
|
||||||
res = true;
|
res = true;
|
||||||
} else {
|
} else {
|
||||||
res = await closeConfirmDialog();
|
res = await closeConfirmDialog();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user