~aleteoryx/muditaos

01001aa303b347ed3bd2f918caf97c01b040dab8 — Bartosz Cichocki 4 years ago 1b2dbc8
[EGD-7988] Fix 'forget' HF in BT devices window

Fixes HF when forgetting more than available devices
M module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.cpp => module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.cpp +4 -0
@@ 144,3 144,7 @@ auto BluetoothSettingsModel::getStatus() const -> const BluetoothStatus
{
    return status;
}
auto BluetoothSettingsModel::isDeviceListEmpty() const -> bool
{
    return devices.empty();
}

M module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.hpp => module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.hpp +1 -0
@@ 39,6 39,7 @@ class BluetoothSettingsModel
    auto getDevices() -> std::vector<Devicei> &;
    auto isDeviceConnecting() -> bool;
    auto getStatus() const -> const BluetoothStatus;
    auto isDeviceListEmpty() const -> bool;

  private:
    std::vector<Devicei> devices{};

M module-apps/application-settings/windows/bluetooth/AllDevicesWindow.cpp => module-apps/application-settings/windows/bluetooth/AllDevicesWindow.cpp +6 -1
@@ 67,7 67,7 @@ namespace gui
                                          utils::translate("app_settings_bluetooth_searching_devices")}));
            return true;
        }
        if (inputEvent.is(KeyCode::KEY_LF)) {
        if (inputEvent.is(KeyCode::KEY_LF) && !bluetoothSettingsModel->isDeviceListEmpty()) {
            navBar->setActive(nav_bar::Side::Left, false);
            navBar->setActive(nav_bar::Side::Center, false);
            auto selectedDevice = bluetoothSettingsModel->getSelectedDevice();


@@ 85,6 85,11 @@ namespace gui
        navBar->setActive(nav_bar::Side::Center, !bluetoothSettingsModel->getDevices().empty());
        std::list<gui::Option> optionsList;

        if (bluetoothSettingsModel->isDeviceListEmpty()) {
            this->navBar->setActive(nav_bar::Side::Left, false);
            return optionsList;
        }

        for (const auto &device : bluetoothSettingsModel->getDevices()) {
            UTF8 textOnCenter                  = getTextOnCenter(device.deviceState);
            option::SettingRightItem rightItem = getRightItem(device.deviceState);