mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
feat: restore caption from send files box
This commit is contained in:
parent
353e9adec1
commit
631f5a1043
6 changed files with 20 additions and 6 deletions
|
@ -482,7 +482,8 @@ SendFilesBox::SendFilesBox(
|
|||
const TextWithTags &caption,
|
||||
not_null<PeerData*> toPeer,
|
||||
Api::SendType sendType,
|
||||
SendMenu::Details sendMenuDetails)
|
||||
SendMenu::Details sendMenuDetails,
|
||||
Fn<void(const TextWithTags &text)> cancelled2)
|
||||
: SendFilesBox(nullptr, {
|
||||
.show = controller->uiShow(),
|
||||
.list = std::move(list),
|
||||
|
@ -492,6 +493,7 @@ SendFilesBox::SendFilesBox(
|
|||
.check = DefaultCheckForPeer(controller, toPeer),
|
||||
.sendType = sendType,
|
||||
.sendMenuDetails = [=] { return sendMenuDetails; },
|
||||
.cancelled2 = cancelled2,
|
||||
}) {
|
||||
}
|
||||
|
||||
|
@ -510,6 +512,7 @@ SendFilesBox::SendFilesBox(QWidget*, SendFilesBoxDescriptor &&descriptor)
|
|||
, _check(std::move(descriptor.check))
|
||||
, _confirmedCallback(std::move(descriptor.confirmed))
|
||||
, _cancelledCallback(std::move(descriptor.cancelled))
|
||||
, _cancelled2Callback(std::move(descriptor.cancelled2))
|
||||
, _caption(this, _st.files.caption, Ui::InputField::Mode::MultiLine)
|
||||
, _prefilledCaptionText(std::move(descriptor.caption))
|
||||
, _scroll(this, st::boxScroll)
|
||||
|
@ -631,6 +634,10 @@ void SendFilesBox::prepare() {
|
|||
if (!_confirmed && _cancelledCallback) {
|
||||
_cancelledCallback();
|
||||
}
|
||||
auto text = _caption->getTextWithAppliedMarkdown();
|
||||
if (!_confirmed && _cancelled2Callback && !text.empty()) {
|
||||
_cancelled2Callback(std::move(text));
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
setupDragArea();
|
||||
|
|
|
@ -102,6 +102,7 @@ struct SendFilesBoxDescriptor {
|
|||
const style::ComposeControls *stOverride = nullptr;
|
||||
SendFilesConfirmed confirmed;
|
||||
Fn<void()> cancelled;
|
||||
Fn<void(const TextWithTags &text)> cancelled2;
|
||||
};
|
||||
|
||||
class SendFilesBox : public Ui::BoxContent {
|
||||
|
@ -117,7 +118,8 @@ public:
|
|||
const TextWithTags &caption,
|
||||
not_null<PeerData*> toPeer,
|
||||
Api::SendType sendType,
|
||||
SendMenu::Details sendMenuDetails);
|
||||
SendMenu::Details sendMenuDetails,
|
||||
Fn<void(const TextWithTags &text)> cancelled2 = nullptr);
|
||||
SendFilesBox(QWidget*, SendFilesBoxDescriptor &&descriptor);
|
||||
|
||||
void setConfirmedCallback(SendFilesConfirmed callback) {
|
||||
|
@ -272,6 +274,7 @@ private:
|
|||
SendFilesCheck _check;
|
||||
SendFilesConfirmed _confirmedCallback;
|
||||
Fn<void()> _cancelledCallback;
|
||||
Fn<void(const TextWithTags &text)> _cancelled2Callback;
|
||||
rpl::variable<uint64> _price = 0;
|
||||
std::unique_ptr<Ui::RpWidget> _priceTag;
|
||||
QImage _priceTagBg;
|
||||
|
|
|
@ -6264,7 +6264,8 @@ bool HistoryWidget::confirmSendingFiles(
|
|||
text,
|
||||
_peer,
|
||||
Api::SendType::Normal,
|
||||
sendMenuDetails());
|
||||
sendMenuDetails(),
|
||||
[=](const TextWithTags &text) { _field->setTextWithTags(text); });
|
||||
_field->setTextWithTags({});
|
||||
box->setConfirmedCallback(crl::guard(this, [=](
|
||||
Ui::PreparedList &&list,
|
||||
|
|
|
@ -1085,7 +1085,8 @@ bool RepliesWidget::confirmSendingFiles(
|
|||
_composeControls->getTextWithAppliedMarkdown(),
|
||||
_history->peer,
|
||||
Api::SendType::Normal,
|
||||
sendMenuDetails());
|
||||
sendMenuDetails(),
|
||||
[=](const TextWithTags &text) { _composeControls->setText(text); });
|
||||
|
||||
box->setConfirmedCallback(crl::guard(this, [=](
|
||||
Ui::PreparedList &&list,
|
||||
|
|
|
@ -572,7 +572,8 @@ bool ScheduledWidget::confirmSendingFiles(
|
|||
(CanScheduleUntilOnline(_history->peer)
|
||||
? Api::SendType::ScheduledToUser
|
||||
: Api::SendType::Scheduled),
|
||||
SendMenu::Details());
|
||||
SendMenu::Details(),
|
||||
[=](const TextWithTags &text) { _composeControls->setText(text); });
|
||||
|
||||
box->setConfirmedCallback(crl::guard(this, [=](
|
||||
Ui::PreparedList &&list,
|
||||
|
|
|
@ -1353,7 +1353,8 @@ bool ShortcutMessages::confirmSendingFiles(
|
|||
_composeControls->getTextWithAppliedMarkdown(),
|
||||
_history->peer,
|
||||
Api::SendType::Normal,
|
||||
SendMenu::Details());
|
||||
SendMenu::Details(),
|
||||
[=](const TextWithTags &text) { _composeControls->setText(text); });
|
||||
|
||||
box->setConfirmedCallback(crl::guard(this, [=](
|
||||
Ui::PreparedList &&list,
|
||||
|
|
Loading…
Add table
Reference in a new issue