mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Preserved caption text on cancel of send files box.
This commit is contained in:
@@ -819,7 +819,7 @@ void SendFilesBox::prepare() {
|
||||
setCloseByOutsideClick(false);
|
||||
|
||||
boxClosing() | rpl::on_next([=] {
|
||||
if (!_confirmed && _cancelledCallback) {
|
||||
if (!_confirmed && !_textTaken && _cancelledCallback) {
|
||||
_cancelledCallback();
|
||||
}
|
||||
}, lifetime());
|
||||
@@ -2251,10 +2251,16 @@ rpl::producer<TextWithTags> SendFilesBox::takeTextWithTagsRequests() const {
|
||||
return _textWithTagsRequests.events();
|
||||
}
|
||||
|
||||
void SendFilesBox::requestToTakeTextWithTags() const {
|
||||
if (!_caption->isHidden()) {
|
||||
_textWithTagsRequests.fire_copy(_caption->getTextWithTags());
|
||||
void SendFilesBox::requestToTakeTextWithTags() {
|
||||
if (_caption->isHidden()) {
|
||||
return;
|
||||
}
|
||||
const auto text = _caption->getTextWithTags();
|
||||
if (!_prefilledCaptionText.text.isEmpty() && text.text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
_textTaken = true;
|
||||
_textWithTagsRequests.fire_copy(text);
|
||||
}
|
||||
|
||||
void SendFilesBox::setInnerFocus() {
|
||||
|
||||
@@ -270,7 +270,7 @@ private:
|
||||
void checkCharsLimitation();
|
||||
void refreshMessagesCount();
|
||||
|
||||
void requestToTakeTextWithTags() const;
|
||||
void requestToTakeTextWithTags();
|
||||
bool validateLength(const QString &text) const;
|
||||
|
||||
[[nodiscard]] Fn<MenuDetails()> prepareSendMenuDetails(
|
||||
@@ -303,6 +303,7 @@ private:
|
||||
std::unique_ptr<Ui::RpWidget> _priceTag;
|
||||
QImage _priceTagBg;
|
||||
bool _confirmed = false;
|
||||
bool _textTaken = false;
|
||||
bool _invertCaption = false;
|
||||
|
||||
const object_ptr<Ui::InputField> _caption;
|
||||
|
||||
Reference in New Issue
Block a user