tdesktop/Telegram/SourceFiles/boxes/url_auth_box.h

72 lines
1.4 KiB
C
Raw Normal View History

2019-05-22 14:29:02 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "boxes/abstract_box.h"
class HistoryItem;
struct HistoryMessageMarkupButton;
2019-08-06 16:40:08 +00:00
namespace Main {
class Session;
} // namespace Main
2019-09-18 11:19:05 +00:00
class UrlAuthBox : public Ui::BoxContent {
2019-05-22 14:29:02 +00:00
public:
static void Activate(
not_null<const HistoryItem*> message,
int row,
int column);
static void Activate(
not_null<Main::Session*> session,
const QString &url,
QVariant context);
2019-05-22 14:29:02 +00:00
protected:
void prepare() override;
private:
static void Request(
const MTPDurlAuthResultRequest &request,
not_null<const HistoryItem*> message,
int row,
int column);
static void Request(
const MTPDurlAuthResultRequest &request,
not_null<Main::Session*> session,
const QString &url,
QVariant context);
2019-05-22 14:29:02 +00:00
enum class Result {
None,
Auth,
AuthAndAllowWrite,
};
public:
UrlAuthBox(
QWidget*,
2019-08-06 16:40:08 +00:00
not_null<Main::Session*> session,
2019-05-22 14:29:02 +00:00
const QString &url,
const QString &domain,
UserData *bot,
Fn<void(Result)> callback);
private:
not_null<Ui::RpWidget*> setupContent(
2019-08-06 16:40:08 +00:00
not_null<Main::Session*> session,
2019-05-22 14:29:02 +00:00
const QString &url,
const QString &domain,
UserData *bot,
Fn<void(Result)> callback);
Fn<void()> _callback;
not_null<Ui::RpWidget*> _content;
};