mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Moved code for send context menu to namespace.
This commit is contained in:
@@ -1087,7 +1087,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
Ui::show(
|
||||
HistoryView::PrepareScheduleBox(
|
||||
this,
|
||||
SendMenuType::Scheduled,
|
||||
SendMenu::Type::Scheduled,
|
||||
send),
|
||||
Ui::LayerOption::KeepOther);
|
||||
};
|
||||
@@ -1108,9 +1108,11 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
if (_sendType == Api::SendType::Normal) {
|
||||
const auto sendMenuType = [=] {
|
||||
collectError();
|
||||
return *error ? SendMenuType::Disabled : SendMenuType::Scheduled;
|
||||
return *error
|
||||
? SendMenu::Type::Disabled
|
||||
: SendMenu::Type::Scheduled;
|
||||
};
|
||||
SetupSendMenuAndShortcuts(
|
||||
SendMenu::SetupMenuAndShortcuts(
|
||||
submit.data(),
|
||||
sendMenuType,
|
||||
sendSilent,
|
||||
|
@@ -1667,7 +1667,7 @@ SendFilesBox::SendFilesBox(
|
||||
CompressConfirm compressed,
|
||||
SendLimit limit,
|
||||
Api::SendType sendType,
|
||||
SendMenuType sendMenuType)
|
||||
SendMenu::Type sendMenuType)
|
||||
: _controller(controller)
|
||||
, _sendType(sendType)
|
||||
, _list(std::move(list))
|
||||
@@ -1837,7 +1837,7 @@ void SendFilesBox::setupShadows(
|
||||
void SendFilesBox::prepare() {
|
||||
_send = addButton(tr::lng_send_button(), [=] { send({}); });
|
||||
if (_sendType == Api::SendType::Normal) {
|
||||
SetupSendMenuAndShortcuts(
|
||||
SendMenu::SetupMenuAndShortcuts(
|
||||
_send,
|
||||
[=] { return _sendMenuType; },
|
||||
[=] { sendSilent(); },
|
||||
@@ -2418,7 +2418,7 @@ void SendFilesBox::sendSilent() {
|
||||
|
||||
void SendFilesBox::sendScheduled() {
|
||||
const auto type = (_sendType == Api::SendType::ScheduledToUser)
|
||||
? SendMenuType::ScheduledToUser
|
||||
? SendMenu::Type::ScheduledToUser
|
||||
: _sendMenuType;
|
||||
const auto callback = [=](Api::SendOptions options) { send(options); };
|
||||
Ui::show(
|
||||
|
@@ -40,7 +40,9 @@ namespace Window {
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
enum class SendMenuType;
|
||||
namespace SendMenu {
|
||||
enum class Type;
|
||||
} // namespace SendMenu
|
||||
|
||||
enum class SendFilesWay {
|
||||
Album,
|
||||
@@ -62,7 +64,7 @@ public:
|
||||
CompressConfirm compressed,
|
||||
SendLimit limit,
|
||||
Api::SendType sendType,
|
||||
SendMenuType sendMenuType);
|
||||
SendMenu::Type sendMenuType);
|
||||
|
||||
void setConfirmedCallback(
|
||||
Fn<void(
|
||||
@@ -142,7 +144,7 @@ private:
|
||||
CompressConfirm _compressConfirmInitial = CompressConfirm::None;
|
||||
CompressConfirm _compressConfirm = CompressConfirm::None;
|
||||
SendLimit _sendLimit = SendLimit::Many;
|
||||
SendMenuType _sendMenuType = SendMenuType();
|
||||
SendMenu::Type _sendMenuType = SendMenu::Type();
|
||||
|
||||
Fn<void(
|
||||
Storage::PreparedList &&list,
|
||||
|
@@ -409,13 +409,13 @@ void ShareBox::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
SendMenuType ShareBox::sendMenuType() const {
|
||||
SendMenu::Type ShareBox::sendMenuType() const {
|
||||
const auto selected = _inner->selected();
|
||||
return ranges::all_of(selected, HistoryView::CanScheduleUntilOnline)
|
||||
? SendMenuType::ScheduledToUser
|
||||
? SendMenu::Type::ScheduledToUser
|
||||
: (selected.size() == 1 && selected.front()->isSelf())
|
||||
? SendMenuType::Reminder
|
||||
: SendMenuType::Scheduled;
|
||||
? SendMenu::Type::Reminder
|
||||
: SendMenu::Type::Scheduled;
|
||||
}
|
||||
|
||||
void ShareBox::createButtons() {
|
||||
@@ -424,7 +424,7 @@ void ShareBox::createButtons() {
|
||||
const auto send = addButton(tr::lng_share_confirm(), [=] {
|
||||
submit({});
|
||||
});
|
||||
SetupSendMenuAndShortcuts(
|
||||
SendMenu::SetupMenuAndShortcuts(
|
||||
send,
|
||||
[=] { return sendMenuType(); },
|
||||
[=] { submitSilent(); },
|
||||
|
@@ -14,7 +14,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/effects/round_checkbox.h"
|
||||
#include "mtproto/sender.h"
|
||||
|
||||
enum class SendMenuType;
|
||||
namespace SendMenu {
|
||||
enum class Type;
|
||||
} // namespace SendMenu
|
||||
|
||||
namespace Window {
|
||||
class SessionNavigation;
|
||||
@@ -82,7 +84,7 @@ private:
|
||||
void copyLink();
|
||||
bool searchByUsername(bool useCache = false);
|
||||
|
||||
SendMenuType sendMenuType() const;
|
||||
SendMenu::Type sendMenuType() const;
|
||||
|
||||
void scrollTo(Ui::ScrollToRequest request);
|
||||
void needSearchByUsername();
|
||||
|
Reference in New Issue
Block a user