diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index c0a2f4762..c69ba186a 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -61,9 +61,13 @@ class DesktopSettingPage extends StatefulWidget { final SettingsTabKey initialTabkey; static final List tabKeys = [ SettingsTabKey.general, - if (!bind.isOutgoingOnly() && !bind.isDisableSettings()) + if (!bind.isOutgoingOnly() && + !bind.isDisableSettings() && + bind.mainGetLocalOption(key: "hide-security-settings") != 'Y') SettingsTabKey.safety, - if (!bind.isDisableSettings()) SettingsTabKey.network, + if (!bind.isDisableSettings() && + bind.mainGetLocalOption(key: "hide-network-settings") != 'Y') + SettingsTabKey.network, if (!bind.isIncomingOnly()) SettingsTabKey.display, if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) SettingsTabKey.plugin, @@ -173,21 +177,32 @@ class _DesktopSettingPageState extends State } List _children() { - final hideSecurity = - bind.mainGetLocalOption(key: "hide-security-settings") == 'Y'; - final hideNetwork = - bind.mainGetLocalOption(key: "hide-network-settings") == 'Y'; - final children = [ - _General(), - if (!bind.isOutgoingOnly() && !bind.isDisableSettings() && !hideSecurity) - _Safety(), - if (!bind.isDisableSettings() && !hideNetwork) _Network(), - if (!bind.isIncomingOnly()) _Display(), - if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) - _Plugin(), - if (!bind.isDisableAccount()) _Account(), - _About(), - ]; + final children = List.empty(growable: true); + for (final tab in DesktopSettingPage.tabKeys) { + switch (tab) { + case SettingsTabKey.general: + children.add(const _General()); + break; + case SettingsTabKey.safety: + children.add(const _Safety()); + break; + case SettingsTabKey.network: + children.add(const _Network()); + break; + case SettingsTabKey.display: + children.add(const _Display()); + break; + case SettingsTabKey.plugin: + children.add(const _Plugin()); + break; + case SettingsTabKey.account: + children.add(const _Account()); + break; + case SettingsTabKey.about: + children.add(const _About()); + break; + } + } return children; } diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 6f99c5542..51a33a00b 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -2096,7 +2096,7 @@ pub mod keys { pub const OPTION_KEY: &str = "key"; pub const OPTION_PRESET_ADDRESS_BOOK_NAME: &str = "preset-address-book-name"; pub const OPTION_PRESET_ADDRESS_BOOK_TAG: &str = "preset-address-book-tag"; - pub const OPTION_PRESET_USERNAME: &str = "preset-username"; + pub const OPTION_PRESET_USERNAME: &str = "preset-user-name"; pub const OPTION_PRESET_STRATEGY_NAME: &str = "preset-strategy-name"; pub const OPTION_ENABLE_DIRECTX_CAPTURE: &str = "enable-directx-capture"; pub const OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE: &str =