mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
parent
efb566bcc7
commit
3907a103fc
4 changed files with 20 additions and 9 deletions
|
@ -656,7 +656,9 @@ void Manager::Private::handleActivation(const ToastActivation &activation) {
|
|||
} else if (action == "mark") {
|
||||
manager->notificationReplied(id, TextWithTags());
|
||||
} else {
|
||||
manager->notificationActivated(id, text);
|
||||
manager->notificationActivated(id, {
|
||||
.draft = std::move(text),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@ QString Manager::accountNameSeparator() {
|
|||
|
||||
void Manager::notificationActivated(
|
||||
NotificationId id,
|
||||
const TextWithTags &reply) {
|
||||
ActivateOptions &&options) {
|
||||
onBeforeNotificationActivated(id);
|
||||
if (const auto session = system()->findSession(id.contextId.sessionId)) {
|
||||
const auto history = session->data().history(
|
||||
|
@ -1114,7 +1114,7 @@ void Manager::notificationActivated(
|
|||
history->peer,
|
||||
id.msgId);
|
||||
const auto topic = item ? item->topic() : nullptr;
|
||||
if (!reply.text.isEmpty()) {
|
||||
if (!options.draft.text.isEmpty()) {
|
||||
const auto topicRootId = topic
|
||||
? topic->rootId()
|
||||
: id.contextId.topicRootId;
|
||||
|
@ -1123,21 +1123,23 @@ void Manager::notificationActivated(
|
|||
&& id.msgId != topicRootId)
|
||||
? FullMsgId(history->peer->id, id.msgId)
|
||||
: FullMsgId();
|
||||
const auto length = int(options.draft.text.size());
|
||||
auto draft = std::make_unique<Data::Draft>(
|
||||
reply,
|
||||
std::move(options.draft),
|
||||
FullReplyTo{
|
||||
.messageId = replyToId,
|
||||
.topicRootId = topicRootId,
|
||||
},
|
||||
MessageCursor{
|
||||
int(reply.text.size()),
|
||||
int(reply.text.size()),
|
||||
length,
|
||||
length,
|
||||
Ui::kQFixedMax,
|
||||
},
|
||||
Data::WebPageDraft());
|
||||
history->setLocalDraft(std::move(draft));
|
||||
}
|
||||
const auto openSeparated = base::IsCtrlPressed();
|
||||
const auto openSeparated = options.allowNewWindow
|
||||
&& base::IsCtrlPressed();
|
||||
const auto window = openNotificationMessage(
|
||||
history,
|
||||
id.msgId,
|
||||
|
|
|
@ -91,6 +91,11 @@ extern base::options::toggle OptionGNotification;
|
|||
|
||||
class Manager;
|
||||
|
||||
struct ActivateOptions {
|
||||
TextWithTags draft;
|
||||
bool allowNewWindow = false;
|
||||
};
|
||||
|
||||
class System final {
|
||||
public:
|
||||
System();
|
||||
|
@ -283,7 +288,7 @@ public:
|
|||
|
||||
void notificationActivated(
|
||||
NotificationId id,
|
||||
const TextWithTags &draft = {});
|
||||
ActivateOptions &&options = {});
|
||||
void notificationReplied(NotificationId id, const TextWithTags &reply);
|
||||
|
||||
struct DisplayOptions {
|
||||
|
|
|
@ -1202,7 +1202,9 @@ void Notification::mousePressEvent(QMouseEvent *e) {
|
|||
unlinkHistoryInManager();
|
||||
} else {
|
||||
e->ignore();
|
||||
manager()->notificationActivated(myId());
|
||||
manager()->notificationActivated(myId(), {
|
||||
.allowNewWindow = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue