2018-10-02 20:39:54 +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 "ui/rp_widget.h"
|
2018-10-05 16:02:33 +00:00
|
|
|
#include "boxes/abstract_box.h"
|
|
|
|
#include "history/admin_log/history_admin_log_item.h"
|
|
|
|
#include "history/view/history_view_element.h"
|
|
|
|
#include "history/history.h"
|
2018-10-02 20:39:54 +00:00
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
2018-10-02 20:39:54 +00:00
|
|
|
|
2020-06-23 17:21:58 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
2018-10-02 20:39:54 +00:00
|
|
|
namespace Ui {
|
|
|
|
class ScrollArea;
|
2018-10-11 11:17:51 +00:00
|
|
|
class InputField;
|
2021-08-27 20:44:47 +00:00
|
|
|
class ChatStyle;
|
2018-10-02 20:39:54 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Support {
|
|
|
|
|
2018-10-05 16:02:33 +00:00
|
|
|
struct Contact {
|
|
|
|
QString comment;
|
|
|
|
QString phone;
|
|
|
|
QString firstName;
|
|
|
|
QString lastName;
|
|
|
|
};
|
|
|
|
|
2020-11-10 14:10:08 +00:00
|
|
|
class Autocomplete final : public Ui::RpWidget {
|
2018-10-02 20:39:54 +00:00
|
|
|
public:
|
2019-07-24 11:45:24 +00:00
|
|
|
Autocomplete(QWidget *parent, not_null<Main::Session*> session);
|
2018-10-02 20:39:54 +00:00
|
|
|
|
2018-10-11 11:17:51 +00:00
|
|
|
void activate(not_null<Ui::InputField*> field);
|
2018-10-02 20:39:54 +00:00
|
|
|
void deactivate();
|
|
|
|
void setBoundings(QRect rect);
|
|
|
|
|
2018-10-05 16:02:33 +00:00
|
|
|
rpl::producer<QString> insertRequests() const;
|
|
|
|
rpl::producer<Contact> shareContactRequests() const;
|
2018-10-02 20:39:54 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setupContent();
|
2018-10-11 11:17:51 +00:00
|
|
|
void submitValue(const QString &value);
|
2018-10-02 20:39:54 +00:00
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
not_null<Main::Session*> _session;
|
2018-10-02 20:39:54 +00:00
|
|
|
Fn<void()> _activate;
|
|
|
|
Fn<void()> _deactivate;
|
|
|
|
Fn<void(int delta)> _moveSelection;
|
|
|
|
|
|
|
|
rpl::event_stream<QString> _insertRequests;
|
2018-10-05 16:02:33 +00:00
|
|
|
rpl::event_stream<Contact> _shareContactRequests;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class ConfirmContactBox
|
2019-09-18 11:19:05 +00:00
|
|
|
: public Ui::BoxContent
|
2019-05-14 09:50:44 +00:00
|
|
|
, public HistoryView::SimpleElementDelegate {
|
2018-10-05 16:02:33 +00:00
|
|
|
public:
|
|
|
|
ConfirmContactBox(
|
|
|
|
QWidget*,
|
2020-06-23 17:21:58 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2018-10-05 16:02:33 +00:00
|
|
|
not_null<History*> history,
|
|
|
|
const Contact &data,
|
2018-10-08 14:08:17 +00:00
|
|
|
Fn<void(Qt::KeyboardModifiers)> submit);
|
2018-10-05 16:02:33 +00:00
|
|
|
|
|
|
|
using Element = HistoryView::Element;
|
|
|
|
HistoryView::Context elementContext() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2018-10-08 14:08:17 +00:00
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
2018-10-05 16:02:33 +00:00
|
|
|
|
|
|
|
private:
|
2021-08-27 20:44:47 +00:00
|
|
|
std::unique_ptr<Ui::ChatStyle> _chatStyle;
|
2018-10-05 16:02:33 +00:00
|
|
|
AdminLog::OwnedItem _comment;
|
|
|
|
AdminLog::OwnedItem _contact;
|
2018-10-08 14:08:17 +00:00
|
|
|
Fn<void(Qt::KeyboardModifiers)> _submit;
|
2018-10-02 20:39:54 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} //namespace Support
|