Merge pull request #1983 from 21pages/cm
add missing cm close window handler
This commit is contained in:
commit
d89c1d3093
@ -134,6 +134,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
|
|||||||
showMaximize: false,
|
showMaximize: false,
|
||||||
showMinimize: true,
|
showMinimize: true,
|
||||||
showClose: true,
|
showClose: true,
|
||||||
|
onWindowCloseButton: handleWindowCloseButton,
|
||||||
controller: serverModel.tabController,
|
controller: serverModel.tabController,
|
||||||
maxLabelWidth: 100,
|
maxLabelWidth: 100,
|
||||||
tail: buildScrollJumper(),
|
tail: buildScrollJumper(),
|
||||||
@ -206,6 +207,27 @@ class ConnectionManagerState extends State<ConnectionManager> {
|
|||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> handleWindowCloseButton() async {
|
||||||
|
var tabController = gFFI.serverModel.tabController;
|
||||||
|
final connLength = tabController.length;
|
||||||
|
if (connLength <= 1) {
|
||||||
|
windowManager.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
final opt = "enable-confirm-closing-tabs";
|
||||||
|
final bool res;
|
||||||
|
if (!option2bool(opt, await bind.mainGetOption(key: opt))) {
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
res = await closeConfirmDialog();
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
windowManager.close();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildConnectionCard(Client client) {
|
Widget buildConnectionCard(Client client) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user