mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Added ability to open chat in window from Ctrl+click on notifications.
This commit is contained in:
parent
ee7a2b564b
commit
6c68bacaef
2 changed files with 17 additions and 4 deletions
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/notifications_manager.h"
|
#include "window/notifications_manager.h"
|
||||||
|
|
||||||
#include "base/options.h"
|
#include "base/options.h"
|
||||||
|
#include "base/qt/qt_key_modifiers.h"
|
||||||
#include "platform/platform_notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
#include "window/notifications_manager_default.h"
|
#include "window/notifications_manager_default.h"
|
||||||
#include "media/audio/media_audio_track.h"
|
#include "media/audio/media_audio_track.h"
|
||||||
|
@ -1146,7 +1147,8 @@ void Manager::notificationActivated(
|
||||||
window->widget()->setInnerFocus();
|
window->widget()->setInnerFocus();
|
||||||
system()->clearAll();
|
system()->clearAll();
|
||||||
} else {
|
} else {
|
||||||
openNotificationMessage(history, id.msgId);
|
const auto openSeparated = base::IsCtrlPressed();
|
||||||
|
openNotificationMessage(history, id.msgId, openSeparated);
|
||||||
}
|
}
|
||||||
onAfterNotificationActivated(id, window);
|
onAfterNotificationActivated(id, window);
|
||||||
}
|
}
|
||||||
|
@ -1155,7 +1157,8 @@ void Manager::notificationActivated(
|
||||||
|
|
||||||
void Manager::openNotificationMessage(
|
void Manager::openNotificationMessage(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId messageId) {
|
MsgId messageId,
|
||||||
|
bool openSeparated) {
|
||||||
const auto item = history->owner().message(history->peer, messageId);
|
const auto item = history->owner().message(history->peer, messageId);
|
||||||
const auto openExactlyMessage = !history->peer->isBroadcast()
|
const auto openExactlyMessage = !history->peer->isBroadcast()
|
||||||
&& item
|
&& item
|
||||||
|
@ -1163,10 +1166,19 @@ void Manager::openNotificationMessage(
|
||||||
&& (item->out() || (item->mentionsMe() && !history->peer->isUser()));
|
&& (item->out() || (item->mentionsMe() && !history->peer->isUser()));
|
||||||
const auto topic = item ? item->topic() : nullptr;
|
const auto topic = item ? item->topic() : nullptr;
|
||||||
const auto separate = Core::App().separateWindowFor(history->peer);
|
const auto separate = Core::App().separateWindowFor(history->peer);
|
||||||
|
const auto itemId = openExactlyMessage ? messageId : ShowAtUnreadMsgId;
|
||||||
const auto window = separate
|
const auto window = separate
|
||||||
? separate->sessionController()
|
? separate->sessionController()
|
||||||
|
: openSeparated
|
||||||
|
? [&] {
|
||||||
|
const auto window = Core::App().ensureSeparateWindowFor(
|
||||||
|
topic
|
||||||
|
? Window::SeparateId(Window::SeparateType::Forum, history)
|
||||||
|
: Window::SeparateId(history->peer),
|
||||||
|
itemId);
|
||||||
|
return window ? window->sessionController() : nullptr;
|
||||||
|
}()
|
||||||
: history->session().tryResolveWindow();
|
: history->session().tryResolveWindow();
|
||||||
const auto itemId = openExactlyMessage ? messageId : ShowAtUnreadMsgId;
|
|
||||||
if (window) {
|
if (window) {
|
||||||
if (topic) {
|
if (topic) {
|
||||||
window->showSection(
|
window->showSection(
|
||||||
|
|
|
@ -355,7 +355,8 @@ protected:
|
||||||
private:
|
private:
|
||||||
void openNotificationMessage(
|
void openNotificationMessage(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId messageId);
|
MsgId messageId,
|
||||||
|
bool openSeparated);
|
||||||
|
|
||||||
const not_null<System*> _system;
|
const not_null<System*> _system;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue