Files
tdesktop/Telegram/SourceFiles/support/support_autocomplete.h
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
init
2026-02-16 15:50:16 +03:00

95 lines
2.1 KiB
C++

/*
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"
#include "ui/layers/box_content.h"
#include "history/admin_log/history_admin_log_item.h"
#include "history/view/history_view_element.h"
#include "history/history.h"
namespace Main {
class Session;
} // namespace Main
namespace Window {
class SessionController;
} // namespace Window
namespace Ui {
class ScrollArea;
class InputField;
class ChatStyle;
} // namespace Ui
namespace Support {
struct Contact {
QString comment;
QString phone;
QString firstName;
QString lastName;
};
class Autocomplete final : public Ui::RpWidget {
public:
Autocomplete(QWidget *parent, not_null<Main::Session*> session);
void activate(not_null<Ui::InputField*> field);
void deactivate();
void setBoundings(QRect rect);
rpl::producer<QString> insertRequests() const;
rpl::producer<Contact> shareContactRequests() const;
protected:
void keyPressEvent(QKeyEvent *e) override;
private:
void setupContent();
void submitValue(const QString &value);
not_null<Main::Session*> _session;
Fn<void()> _activate;
Fn<void()> _deactivate;
Fn<void(int delta)> _moveSelection;
rpl::event_stream<QString> _insertRequests;
rpl::event_stream<Contact> _shareContactRequests;
};
class ConfirmContactBox
: public Ui::BoxContent
, public HistoryView::SimpleElementDelegate {
public:
ConfirmContactBox(
QWidget*,
not_null<Window::SessionController*> controller,
not_null<History*> history,
const Contact &data,
Fn<void(Qt::KeyboardModifiers)> submit);
using Element = HistoryView::Element;
HistoryView::Context elementContext() override;
protected:
void prepare() override;
void paintEvent(QPaintEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
private:
std::unique_ptr<Ui::ChatStyle> _chatStyle;
AdminLog::OwnedItem _comment;
AdminLog::OwnedItem _contact;
Fn<void(Qt::KeyboardModifiers)> _submit;
};
} //namespace Support