2015-12-07 13:05:00 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2015-12-07 13:05:00 +00:00
|
|
|
*/
|
2017-09-13 16:57:44 +00:00
|
|
|
#include "facades.h"
|
|
|
|
|
2020-06-29 13:33:27 +00:00
|
|
|
#include "api/api_bot.h"
|
2017-09-13 17:01:23 +00:00
|
|
|
#include "info/info_memento.h"
|
2022-03-29 09:00:10 +00:00
|
|
|
#include "inline_bots/bot_attach_web_view.h"
|
2016-05-24 16:13:07 +00:00
|
|
|
#include "core/click_handler_types.h"
|
2019-01-21 13:42:21 +00:00
|
|
|
#include "core/application.h"
|
2019-02-13 12:36:59 +00:00
|
|
|
#include "media/clip/media_clip_reader.h"
|
2019-06-06 10:21:40 +00:00
|
|
|
#include "window/window_session_controller.h"
|
2020-01-15 13:30:29 +00:00
|
|
|
#include "window/window_peer_menu.h"
|
2017-12-18 15:44:50 +00:00
|
|
|
#include "history/history_item_components.h"
|
2019-09-17 16:13:12 +00:00
|
|
|
#include "base/platform/base_platform_info.h"
|
2019-01-04 11:09:48 +00:00
|
|
|
#include "data/data_peer.h"
|
|
|
|
#include "data/data_user.h"
|
2016-04-12 21:31:28 +00:00
|
|
|
#include "mainwindow.h"
|
2015-12-07 13:05:00 +00:00
|
|
|
#include "mainwidget.h"
|
2017-12-07 13:02:24 +00:00
|
|
|
#include "apiwrap.h"
|
2019-07-24 11:45:24 +00:00
|
|
|
#include "main/main_session.h"
|
2020-06-26 11:48:28 +00:00
|
|
|
#include "main/main_domain.h"
|
2021-10-18 21:36:55 +00:00
|
|
|
#include "ui/boxes/confirm_box.h"
|
2019-05-22 14:29:02 +00:00
|
|
|
#include "boxes/url_auth_box.h"
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "ui/layers/layer_widget.h"
|
2017-04-13 08:27:10 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2018-01-13 12:45:11 +00:00
|
|
|
#include "history/history.h"
|
2018-01-11 19:33:26 +00:00
|
|
|
#include "history/history_item.h"
|
2019-08-02 13:21:09 +00:00
|
|
|
#include "history/view/media/history_view_media.h"
|
2021-03-23 12:34:34 +00:00
|
|
|
#include "payments/payments_checkout_process.h"
|
2018-01-04 10:22:53 +00:00
|
|
|
#include "data/data_session.h"
|
2020-10-10 09:15:37 +00:00
|
|
|
#include "styles/style_chat.h"
|
2015-12-24 20:29:33 +00:00
|
|
|
|
2020-06-26 11:48:28 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
[[nodiscard]] MainWidget *CheckMainWidget(not_null<Main::Session*> session) {
|
|
|
|
if (const auto m = App::main()) { // multi good
|
|
|
|
if (&m->session() == session) {
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (&Core::App().domain().active() != &session->account()) {
|
|
|
|
Core::App().domain().activate(&session->account());
|
|
|
|
}
|
|
|
|
if (const auto m = App::main()) { // multi good
|
|
|
|
if (&m->session() == session) {
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
namespace Ui {
|
2015-12-07 18:09:05 +00:00
|
|
|
|
2020-06-18 18:04:16 +00:00
|
|
|
void showChatsList(not_null<Main::Session*> session) {
|
2020-06-26 11:48:28 +00:00
|
|
|
if (const auto m = CheckMainWidget(session)) {
|
|
|
|
m->ui_showPeerHistory(
|
|
|
|
0,
|
2021-02-26 14:38:16 +00:00
|
|
|
::Window::SectionShow::Way::ClearStack,
|
2020-06-26 11:48:28 +00:00
|
|
|
0);
|
2017-09-20 10:23:57 +00:00
|
|
|
}
|
2018-01-11 19:33:26 +00:00
|
|
|
}
|
|
|
|
|
2018-01-13 12:45:11 +00:00
|
|
|
void showPeerHistory(not_null<const History*> history, MsgId msgId) {
|
2020-06-10 18:08:17 +00:00
|
|
|
showPeerHistory(history->peer, msgId);
|
2018-01-13 12:45:11 +00:00
|
|
|
}
|
|
|
|
|
2020-06-10 18:08:17 +00:00
|
|
|
void showPeerHistory(not_null<const PeerData*> peer, MsgId msgId) {
|
2020-06-26 11:48:28 +00:00
|
|
|
if (const auto m = CheckMainWidget(&peer->session())) {
|
|
|
|
m->ui_showPeerHistory(
|
|
|
|
peer->id,
|
2021-02-26 14:38:16 +00:00
|
|
|
::Window::SectionShow::Way::ClearStack,
|
2020-06-26 11:48:28 +00:00
|
|
|
msgId);
|
2020-06-10 18:08:17 +00:00
|
|
|
}
|
2019-01-04 11:09:48 +00:00
|
|
|
}
|
|
|
|
|
2016-05-12 16:05:20 +00:00
|
|
|
bool skipPaintEvent(QWidget *widget, QPaintEvent *event) {
|
|
|
|
if (auto w = App::wnd()) {
|
|
|
|
if (w->contentOverlapped(widget, event)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Ui
|