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") {
|
} else if (action == "mark") {
|
||||||
manager->notificationReplied(id, TextWithTags());
|
manager->notificationReplied(id, TextWithTags());
|
||||||
} else {
|
} else {
|
||||||
manager->notificationActivated(id, text);
|
manager->notificationActivated(id, {
|
||||||
|
.draft = std::move(text),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ QString Manager::accountNameSeparator() {
|
||||||
|
|
||||||
void Manager::notificationActivated(
|
void Manager::notificationActivated(
|
||||||
NotificationId id,
|
NotificationId id,
|
||||||
const TextWithTags &reply) {
|
ActivateOptions &&options) {
|
||||||
onBeforeNotificationActivated(id);
|
onBeforeNotificationActivated(id);
|
||||||
if (const auto session = system()->findSession(id.contextId.sessionId)) {
|
if (const auto session = system()->findSession(id.contextId.sessionId)) {
|
||||||
const auto history = session->data().history(
|
const auto history = session->data().history(
|
||||||
|
@ -1114,7 +1114,7 @@ void Manager::notificationActivated(
|
||||||
history->peer,
|
history->peer,
|
||||||
id.msgId);
|
id.msgId);
|
||||||
const auto topic = item ? item->topic() : nullptr;
|
const auto topic = item ? item->topic() : nullptr;
|
||||||
if (!reply.text.isEmpty()) {
|
if (!options.draft.text.isEmpty()) {
|
||||||
const auto topicRootId = topic
|
const auto topicRootId = topic
|
||||||
? topic->rootId()
|
? topic->rootId()
|
||||||
: id.contextId.topicRootId;
|
: id.contextId.topicRootId;
|
||||||
|
@ -1123,21 +1123,23 @@ void Manager::notificationActivated(
|
||||||
&& id.msgId != topicRootId)
|
&& id.msgId != topicRootId)
|
||||||
? FullMsgId(history->peer->id, id.msgId)
|
? FullMsgId(history->peer->id, id.msgId)
|
||||||
: FullMsgId();
|
: FullMsgId();
|
||||||
|
const auto length = int(options.draft.text.size());
|
||||||
auto draft = std::make_unique<Data::Draft>(
|
auto draft = std::make_unique<Data::Draft>(
|
||||||
reply,
|
std::move(options.draft),
|
||||||
FullReplyTo{
|
FullReplyTo{
|
||||||
.messageId = replyToId,
|
.messageId = replyToId,
|
||||||
.topicRootId = topicRootId,
|
.topicRootId = topicRootId,
|
||||||
},
|
},
|
||||||
MessageCursor{
|
MessageCursor{
|
||||||
int(reply.text.size()),
|
length,
|
||||||
int(reply.text.size()),
|
length,
|
||||||
Ui::kQFixedMax,
|
Ui::kQFixedMax,
|
||||||
},
|
},
|
||||||
Data::WebPageDraft());
|
Data::WebPageDraft());
|
||||||
history->setLocalDraft(std::move(draft));
|
history->setLocalDraft(std::move(draft));
|
||||||
}
|
}
|
||||||
const auto openSeparated = base::IsCtrlPressed();
|
const auto openSeparated = options.allowNewWindow
|
||||||
|
&& base::IsCtrlPressed();
|
||||||
const auto window = openNotificationMessage(
|
const auto window = openNotificationMessage(
|
||||||
history,
|
history,
|
||||||
id.msgId,
|
id.msgId,
|
||||||
|
|
|
@ -91,6 +91,11 @@ extern base::options::toggle OptionGNotification;
|
||||||
|
|
||||||
class Manager;
|
class Manager;
|
||||||
|
|
||||||
|
struct ActivateOptions {
|
||||||
|
TextWithTags draft;
|
||||||
|
bool allowNewWindow = false;
|
||||||
|
};
|
||||||
|
|
||||||
class System final {
|
class System final {
|
||||||
public:
|
public:
|
||||||
System();
|
System();
|
||||||
|
@ -283,7 +288,7 @@ public:
|
||||||
|
|
||||||
void notificationActivated(
|
void notificationActivated(
|
||||||
NotificationId id,
|
NotificationId id,
|
||||||
const TextWithTags &draft = {});
|
ActivateOptions &&options = {});
|
||||||
void notificationReplied(NotificationId id, const TextWithTags &reply);
|
void notificationReplied(NotificationId id, const TextWithTags &reply);
|
||||||
|
|
||||||
struct DisplayOptions {
|
struct DisplayOptions {
|
||||||
|
|
|
@ -1202,7 +1202,9 @@ void Notification::mousePressEvent(QMouseEvent *e) {
|
||||||
unlinkHistoryInManager();
|
unlinkHistoryInManager();
|
||||||
} else {
|
} else {
|
||||||
e->ignore();
|
e->ignore();
|
||||||
manager()->notificationActivated(myId());
|
manager()->notificationActivated(myId(), {
|
||||||
|
.allowNewWindow = true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue