mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Moved edit folders button from folders menu to context menu.
This commit is contained in:
@@ -3587,6 +3587,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
"lng_filters_restore" = "Undo";
|
"lng_filters_restore" = "Undo";
|
||||||
"lng_filters_new" = "New Folder";
|
"lng_filters_new" = "New Folder";
|
||||||
"lng_filters_edit" = "Edit Folder";
|
"lng_filters_edit" = "Edit Folder";
|
||||||
|
"lng_filters_setup_menu" = "Edit Folders";
|
||||||
"lng_filters_new_name" = "Folder name";
|
"lng_filters_new_name" = "Folder name";
|
||||||
"lng_filters_add_chats" = "Add chats";
|
"lng_filters_add_chats" = "Add chats";
|
||||||
"lng_filters_remove_chats" = "Remove chats";
|
"lng_filters_remove_chats" = "Remove chats";
|
||||||
|
@@ -320,17 +320,7 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
|
|||||||
} else if (id >= 0) {
|
} else if (id >= 0) {
|
||||||
_session->setActiveChatsFilter(id);
|
_session->setActiveChatsFilter(id);
|
||||||
} else {
|
} else {
|
||||||
const auto filters = &_session->session().data().chatsFilters();
|
openFiltersSettings();
|
||||||
if (filters->suggestedLoaded()) {
|
|
||||||
_session->showSettings(Settings::Folders::Id());
|
|
||||||
} else if (!_waitingSuggested) {
|
|
||||||
_waitingSuggested = true;
|
|
||||||
filters->requestSuggested();
|
|
||||||
filters->suggestedUpdated(
|
|
||||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
|
||||||
_session->showSettings(Settings::Folders::Id());
|
|
||||||
}, _outer.lifetime());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (id >= 0) {
|
if (id >= 0) {
|
||||||
@@ -368,6 +358,20 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FiltersMenu::openFiltersSettings() {
|
||||||
|
const auto filters = &_session->session().data().chatsFilters();
|
||||||
|
if (filters->suggestedLoaded()) {
|
||||||
|
_session->showSettings(Settings::Folders::Id());
|
||||||
|
} else if (!_waitingSuggested) {
|
||||||
|
_waitingSuggested = true;
|
||||||
|
filters->requestSuggested();
|
||||||
|
filters->suggestedUpdated(
|
||||||
|
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||||
|
_session->showSettings(Settings::Folders::Id());
|
||||||
|
}, _outer.lifetime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FiltersMenu::showMenu(QPoint position, FilterId id) {
|
void FiltersMenu::showMenu(QPoint position, FilterId id) {
|
||||||
if (_popupMenu) {
|
if (_popupMenu) {
|
||||||
_popupMenu = nullptr;
|
_popupMenu = nullptr;
|
||||||
@@ -418,6 +422,11 @@ void FiltersMenu::showMenu(QPoint position, FilterId id) {
|
|||||||
[=] { return _session->session().data().chatsList(); },
|
[=] { return _session->session().data().chatsList(); },
|
||||||
addAction,
|
addAction,
|
||||||
std::move(customUnreadState));
|
std::move(customUnreadState));
|
||||||
|
|
||||||
|
addAction(
|
||||||
|
tr::lng_filters_setup_menu(tr::now),
|
||||||
|
[=] { openFiltersSettings(); },
|
||||||
|
&st::menuIconEdit);
|
||||||
}
|
}
|
||||||
if (_popupMenu->empty()) {
|
if (_popupMenu->empty()) {
|
||||||
_popupMenu = nullptr;
|
_popupMenu = nullptr;
|
||||||
|
@@ -52,6 +52,7 @@ private:
|
|||||||
void showRemoveBox(FilterId id);
|
void showRemoveBox(FilterId id);
|
||||||
void remove(FilterId id, std::vector<not_null<PeerData*>> leave = {});
|
void remove(FilterId id, std::vector<not_null<PeerData*>> leave = {});
|
||||||
void scrollToButton(not_null<Ui::RpWidget*> widget);
|
void scrollToButton(not_null<Ui::RpWidget*> widget);
|
||||||
|
void openFiltersSettings();
|
||||||
|
|
||||||
const not_null<SessionController*> _session;
|
const not_null<SessionController*> _session;
|
||||||
const not_null<Ui::RpWidget*> _parent;
|
const not_null<Ui::RpWidget*> _parent;
|
||||||
|
Reference in New Issue
Block a user