Remove irrelevant menu items (support).

This commit is contained in:
John Preston 2018-10-05 20:08:29 +03:00
parent 052fabcae3
commit eaa50adf75
2 changed files with 38 additions and 28 deletions

View File

@ -602,21 +602,25 @@ void MainWindow::createGlobalMenu() {
psSelectAll = edit->addAction(lang(lng_mac_menu_select_all), this, SLOT(psMacSelectAll()), QKeySequence::SelectAll);
QMenu *window = psMainMenu.addMenu(lang(lng_mac_menu_window));
psContacts = window->addAction(lang(lng_mac_menu_contacts));
connect(psContacts, &QAction::triggered, psContacts, [] {
if (App::wnd() && App::wnd()->isHidden()) App::wnd()->showFromTray();
if (!Auth().supportMode()) {
psContacts = window->addAction(lang(lng_mac_menu_contacts));
connect(psContacts, &QAction::triggered, psContacts, [] {
if (App::wnd() && App::wnd()->isHidden()) App::wnd()->showFromTray();
if (!AuthSession::Exists()) return;
Ui::show(Box<PeerListBox>(std::make_unique<ContactsBoxController>(), [](not_null<PeerListBox*> box) {
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
box->addLeftButton(langFactory(lng_profile_add_contact), [] { App::wnd()->onShowAddContact(); });
}));
});
if (!AuthSession::Exists()) return;
Ui::show(Box<PeerListBox>(std::make_unique<ContactsBoxController>(), [](not_null<PeerListBox*> box) {
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
box->addLeftButton(langFactory(lng_profile_add_contact), [] { App::wnd()->onShowAddContact(); });
}));
});
}
psAddContact = window->addAction(lang(lng_mac_menu_add_contact), App::wnd(), SLOT(onShowAddContact()));
window->addSeparator();
psNewGroup = window->addAction(lang(lng_mac_menu_new_group), App::wnd(), SLOT(onShowNewGroup()));
psNewChannel = window->addAction(lang(lng_mac_menu_new_channel), App::wnd(), SLOT(onShowNewChannel()));
window->addSeparator();
if (!Auth().supportMode()) {
psNewGroup = window->addAction(lang(lng_mac_menu_new_group), App::wnd(), SLOT(onShowNewGroup()));
psNewChannel = window->addAction(lang(lng_mac_menu_new_channel), App::wnd(), SLOT(onShowNewChannel()));
window->addSeparator();
}
psShowTelegram = window->addAction(lang(lng_mac_menu_show), App::wnd(), SLOT(showFromTray()));
updateGlobalMenu();

View File

@ -93,24 +93,30 @@ MainMenu::MainMenu(
void MainMenu::refreshMenu() {
_menu->clearActions();
_menu->addAction(lang(lng_create_group_title), [] {
App::wnd()->onShowNewGroup();
}, &st::mainMenuNewGroup, &st::mainMenuNewGroupOver);
_menu->addAction(lang(lng_create_channel_title), [] {
App::wnd()->onShowNewChannel();
}, &st::mainMenuNewChannel, &st::mainMenuNewChannelOver);
_menu->addAction(lang(lng_menu_contacts), [] {
Ui::show(Box<PeerListBox>(std::make_unique<ContactsBoxController>(), [](not_null<PeerListBox*> box) {
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
box->addLeftButton(langFactory(lng_profile_add_contact), [] { App::wnd()->onShowAddContact(); });
}));
}, &st::mainMenuContacts, &st::mainMenuContactsOver);
if (Global::PhoneCallsEnabled()) {
_menu->addAction(lang(lng_menu_calls), [] {
Ui::show(Box<PeerListBox>(std::make_unique<Calls::BoxController>(), [](not_null<PeerListBox*> box) {
if (!Auth().supportMode()) {
_menu->addAction(lang(lng_create_group_title), [] {
App::wnd()->onShowNewGroup();
}, &st::mainMenuNewGroup, &st::mainMenuNewGroupOver);
_menu->addAction(lang(lng_create_channel_title), [] {
App::wnd()->onShowNewChannel();
}, &st::mainMenuNewChannel, &st::mainMenuNewChannelOver);
_menu->addAction(lang(lng_menu_contacts), [] {
Ui::show(Box<PeerListBox>(std::make_unique<ContactsBoxController>(), [](not_null<PeerListBox*> box) {
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
box->addLeftButton(langFactory(lng_profile_add_contact), [] { App::wnd()->onShowAddContact(); });
}));
}, &st::mainMenuCalls, &st::mainMenuCallsOver);
}, &st::mainMenuContacts, &st::mainMenuContactsOver);
if (Global::PhoneCallsEnabled()) {
_menu->addAction(lang(lng_menu_calls), [] {
Ui::show(Box<PeerListBox>(std::make_unique<Calls::BoxController>(), [](not_null<PeerListBox*> box) {
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
}));
}, &st::mainMenuCalls, &st::mainMenuCallsOver);
}
} else {
_menu->addAction(lang(lng_profile_add_contact), [] {
App::wnd()->onShowAddContact();
}, &st::mainMenuContacts, &st::mainMenuContactsOver);
}
_menu->addAction(lang(lng_menu_settings), [] {
App::wnd()->showSettings();