Hide Edit and All Chats from context menu
This commit is contained in:
parent
d4db0e0ec5
commit
f0ceaf56ee
10 changed files with 82 additions and 12 deletions
|
|
@ -2659,4 +2659,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
"ktg_filters_cloud_limit" = "Sorry, you can't create more cloud folders. You can create local folder instead.";
|
"ktg_filters_cloud_limit" = "Sorry, you can't create more cloud folders. You can create local folder instead.";
|
||||||
|
|
||||||
|
"ktg_filters_hide_folder" = "Hide folder";
|
||||||
|
"ktg_filters_hide_button" = "Hide button";
|
||||||
|
|
||||||
|
"ktg_filters_hide_all_chats_toast" = "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.";
|
||||||
|
"ktg_filters_hide_edit_toast" = "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.";
|
||||||
|
|
||||||
// Keys finished
|
// Keys finished
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,10 @@
|
||||||
"ktg_filters_local": "local folder",
|
"ktg_filters_local": "local folder",
|
||||||
"ktg_filters_cloud": "cloud folder",
|
"ktg_filters_cloud": "cloud folder",
|
||||||
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
||||||
|
"ktg_filters_hide_folder": "Hide folder",
|
||||||
|
"ktg_filters_hide_button": "Hide button",
|
||||||
|
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,10 @@
|
||||||
"ktg_filters_local": "local folder",
|
"ktg_filters_local": "local folder",
|
||||||
"ktg_filters_cloud": "cloud folder",
|
"ktg_filters_cloud": "cloud folder",
|
||||||
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
||||||
|
"ktg_filters_hide_folder": "Hide folder",
|
||||||
|
"ktg_filters_hide_button": "Hide button",
|
||||||
|
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,10 @@
|
||||||
"ktg_filters_local": "local folder",
|
"ktg_filters_local": "local folder",
|
||||||
"ktg_filters_cloud": "cloud folder",
|
"ktg_filters_cloud": "cloud folder",
|
||||||
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
||||||
|
"ktg_filters_hide_folder": "Hide folder",
|
||||||
|
"ktg_filters_hide_button": "Hide button",
|
||||||
|
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,10 @@
|
||||||
"ktg_filters_local": "local folder",
|
"ktg_filters_local": "local folder",
|
||||||
"ktg_filters_cloud": "cloud folder",
|
"ktg_filters_cloud": "cloud folder",
|
||||||
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
||||||
|
"ktg_filters_hide_folder": "Hide folder",
|
||||||
|
"ktg_filters_hide_button": "Hide button",
|
||||||
|
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,10 @@
|
||||||
"ktg_filters_local": "локальная папка",
|
"ktg_filters_local": "локальная папка",
|
||||||
"ktg_filters_cloud": "облачная папка",
|
"ktg_filters_cloud": "облачная папка",
|
||||||
"ktg_filters_cloud_limit": "Вы создали максимальное число облачных папок. Вместо этого можно создать локальную папку.",
|
"ktg_filters_cloud_limit": "Вы создали максимальное число облачных папок. Вместо этого можно создать локальную папку.",
|
||||||
|
"ktg_filters_hide_folder": "Скрыть папку",
|
||||||
|
"ktg_filters_hide_button": "Скрыть кнопку",
|
||||||
|
"ktg_filters_hide_all_chats_toast": "Папка «Все чаты» скрыта.\nВы можете включить её обратно в настройках Kotatogram.",
|
||||||
|
"ktg_filters_hide_edit_toast": "Кнопка изменения скрыта.\nВы можете включить её обратно в настройках Kotatogram.",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,10 @@
|
||||||
"ktg_filters_local": "local folder",
|
"ktg_filters_local": "local folder",
|
||||||
"ktg_filters_cloud": "cloud folder",
|
"ktg_filters_cloud": "cloud folder",
|
||||||
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
||||||
|
"ktg_filters_hide_folder": "Hide folder",
|
||||||
|
"ktg_filters_hide_button": "Hide button",
|
||||||
|
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,10 @@
|
||||||
"ktg_filters_local": "local folder",
|
"ktg_filters_local": "local folder",
|
||||||
"ktg_filters_cloud": "cloud folder",
|
"ktg_filters_cloud": "cloud folder",
|
||||||
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
"ktg_filters_cloud_limit": "Sorry, you can't create more cloud folders. You can create local folder instead.",
|
||||||
|
"ktg_filters_hide_folder": "Hide folder",
|
||||||
|
"ktg_filters_hide_button": "Hide button",
|
||||||
|
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/filter_icons.h"
|
#include "ui/filter_icons.h"
|
||||||
#include "ui/wrap/vertical_layout_reorder.h"
|
#include "ui/wrap/vertical_layout_reorder.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
|
#include "ui/toast/toast.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/filters/edit_filter_box.h"
|
#include "boxes/filters/edit_filter_box.h"
|
||||||
#include "kotato/json_settings.h"
|
#include "kotato/json_settings.h"
|
||||||
|
|
@ -317,18 +318,18 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (id >= 0) {
|
|
||||||
raw->events(
|
raw->events(
|
||||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||||
return e->type() == QEvent::ContextMenu;
|
return e->type() == QEvent::ContextMenu;
|
||||||
}) | rpl::start_with_next([=] {
|
}) | rpl::start_with_next([=] {
|
||||||
if (id){
|
if (id == -1) {
|
||||||
|
showEditMenu(QCursor::pos());
|
||||||
|
} else if (id) {
|
||||||
showMenu(QCursor::pos(), id);
|
showMenu(QCursor::pos(), id);
|
||||||
} else {
|
} else {
|
||||||
showAllMenu(QCursor::pos());
|
showAllMenu(QCursor::pos());
|
||||||
}
|
}
|
||||||
}, raw->lifetime());
|
}, raw->lifetime());
|
||||||
}
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -376,6 +377,40 @@ void FiltersMenu::showAllMenu(QPoint position) {
|
||||||
tr::ktg_filters_context_make_default(tr::now),
|
tr::ktg_filters_context_make_default(tr::now),
|
||||||
crl::guard(&_outer, [=] { setDefaultFilter(0); }));
|
crl::guard(&_outer, [=] { setDefaultFilter(0); }));
|
||||||
}
|
}
|
||||||
|
_popupMenu->addAction(
|
||||||
|
tr::ktg_filters_hide_folder(tr::now),
|
||||||
|
crl::guard(&_outer, [=] {
|
||||||
|
cSetHideFilterAllChats(true);
|
||||||
|
Kotato::JsonSettings::Write();
|
||||||
|
_all = nullptr;
|
||||||
|
Ui::Toast::Show(Ui::Toast::Config{
|
||||||
|
.text = { tr::ktg_filters_hide_all_chats_toast(tr::now) },
|
||||||
|
.st = &st::windowArchiveToast,
|
||||||
|
.multiline = true,
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
_popupMenu->popup(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FiltersMenu::showEditMenu(QPoint position) {
|
||||||
|
if (_popupMenu) {
|
||||||
|
_popupMenu = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_popupMenu = base::make_unique_q<Ui::PopupMenu>(_setup);
|
||||||
|
_popupMenu->addAction(
|
||||||
|
tr::ktg_filters_hide_button(tr::now),
|
||||||
|
crl::guard(&_outer, [=] {
|
||||||
|
cSetHideFilterEditButton(true);
|
||||||
|
Kotato::JsonSettings::Write();
|
||||||
|
_setup = nullptr;
|
||||||
|
Ui::Toast::Show(Ui::Toast::Config{
|
||||||
|
.text = { tr::ktg_filters_hide_edit_toast(tr::now) },
|
||||||
|
.st = &st::windowArchiveToast,
|
||||||
|
.multiline = true,
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
_popupMenu->popup(position);
|
_popupMenu->popup(position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ private:
|
||||||
void setupMainMenuIcon();
|
void setupMainMenuIcon();
|
||||||
void showMenu(QPoint position, FilterId id);
|
void showMenu(QPoint position, FilterId id);
|
||||||
void showAllMenu(QPoint position);
|
void showAllMenu(QPoint position);
|
||||||
|
void showEditMenu(QPoint position);
|
||||||
void setDefaultFilter(FilterId id);
|
void setDefaultFilter(FilterId id);
|
||||||
void showEditBox(FilterId id);
|
void showEditBox(FilterId id);
|
||||||
void showRemoveBox(FilterId id);
|
void showRemoveBox(FilterId id);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue