2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Fixes for three-dots menu in Settings

* Show "Add account" only on main settings page
* Add missing warning about too many accounts
This commit is contained in:
RadRussianRus
2020-07-02 08:38:39 +03:00
parent 960cb03714
commit aa8423649f

View File

@@ -202,11 +202,24 @@ void FillMenu(
tr::lng_settings_bg_theme_create(tr::now),
[=] { window->show(Box(Window::Theme::CreateBox, window)); });
} else {
const auto &list = Core::App().domain().accounts();
if (list.size() < ::Main::Domain::kMaxAccounts) {
addAction(tr::lng_menu_add_account(tr::now), [=] {
Core::App().domain().addActivated(MTP::Environment{});
});
if (type != Type::Kotato) {
const auto &list = Core::App().domain().accounts();
if (list.size() < ::Main::Domain::kMaxAccountsWarn) {
addAction(tr::lng_menu_add_account(tr::now), [=] {
Core::App().domain().addActivated(MTP::Environment{});
});
} else if (list.size() < ::Main::Domain::kMaxAccounts) {
addAction(tr::lng_menu_add_account(tr::now), [=] {
Ui::show(
Box<ConfirmBox>(
tr::ktg_too_many_accounts_warning(tr::now),
tr::ktg_account_add_anyway(tr::now),
[=] {
Core::App().domain().addActivated(MTP::Environment{});
}),
Ui::LayerOption::KeepOther);
});
}
}
const auto customSettingsFile = cWorkingDir() + "tdata/kotato-settings-custom.json";
if (type != Type::Kotato && !controller->session().supportMode()) {