mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 07:52:57 +02:00
Added ability to clear proxy list from top context menu in settings.
This commit is contained in:
parent
8bebca4502
commit
a2c2ed0b4a
2 changed files with 24 additions and 4 deletions
|
@ -34,6 +34,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/fields/number_input.h"
|
#include "ui/widgets/fields/number_input.h"
|
||||||
#include "ui/widgets/fields/password_input.h"
|
#include "ui/widgets/fields/password_input.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
|
#include "ui/widgets/menu/menu_add_action_callback.h"
|
||||||
|
#include "ui/widgets/menu/menu_add_action_callback_factory.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
@ -737,10 +739,21 @@ void ProxiesBox::setupTopButton() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
top->setClickedCallback([=] {
|
top->setClickedCallback([=] {
|
||||||
*menu = base::make_unique_q<Ui::PopupMenu>(top, st::defaultPopupMenu);
|
*menu = base::make_unique_q<Ui::PopupMenu>(
|
||||||
(*menu)->addAction(
|
top,
|
||||||
tr::lng_proxy_add_from_clipboard(tr::now),
|
st::popupMenuWithIcons);
|
||||||
callback);
|
const auto addAction = Ui::Menu::CreateAddActionCallback(*menu);
|
||||||
|
addAction({
|
||||||
|
.text = tr::lng_proxy_add_from_clipboard(tr::now),
|
||||||
|
.handler = callback,
|
||||||
|
.icon = &st::menuIconImportTheme,
|
||||||
|
});
|
||||||
|
addAction({
|
||||||
|
.text = tr::lng_group_invite_context_delete_all(tr::now),
|
||||||
|
.handler = [=] { _controller->deleteItems(); },
|
||||||
|
.icon = &st::menuIconDeleteAttention,
|
||||||
|
.isAttention = true,
|
||||||
|
});
|
||||||
(*menu)->popup(QCursor::pos());
|
(*menu)->popup(QCursor::pos());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -1475,6 +1488,12 @@ void ProxiesBoxController::deleteItem(int id) {
|
||||||
setDeleted(id, true);
|
setDeleted(id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProxiesBoxController::deleteItems() {
|
||||||
|
for (const auto &item : _list) {
|
||||||
|
setDeleted(item.id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ProxiesBoxController::restoreItem(int id) {
|
void ProxiesBoxController::restoreItem(int id) {
|
||||||
setDeleted(id, false);
|
setDeleted(id, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void deleteItem(int id);
|
void deleteItem(int id);
|
||||||
|
void deleteItems();
|
||||||
void restoreItem(int id);
|
void restoreItem(int id);
|
||||||
void shareItem(int id, bool qr);
|
void shareItem(int id, bool qr);
|
||||||
void shareItems();
|
void shareItems();
|
||||||
|
|
Loading…
Add table
Reference in a new issue