2021-10-18 20:55:58 +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"
|
|
|
|
|
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class Checkbox;
|
|
|
|
class FlatLabel;
|
|
|
|
class LinkButton;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
class DeleteMessagesBox final : public Ui::BoxContent {
|
|
|
|
public:
|
|
|
|
DeleteMessagesBox(
|
|
|
|
QWidget*,
|
|
|
|
not_null<HistoryItem*> item,
|
|
|
|
bool suggestModerateActions);
|
|
|
|
DeleteMessagesBox(
|
|
|
|
QWidget*,
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
MessageIdsList &&selected);
|
2021-11-16 07:26:35 +00:00
|
|
|
DeleteMessagesBox(
|
|
|
|
QWidget*,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
QDate firstDayToDelete,
|
|
|
|
QDate lastDayToDelete);
|
2021-10-18 20:55:58 +00:00
|
|
|
DeleteMessagesBox(QWidget*, not_null<PeerData*> peer, bool justClear);
|
|
|
|
|
|
|
|
void setDeleteConfirmedCallback(Fn<void()> callback) {
|
|
|
|
_deleteConfirmedCallback = std::move(callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct RevokeConfig {
|
2022-03-28 18:57:21 +00:00
|
|
|
TextWithEntities checkbox;
|
2021-10-18 20:55:58 +00:00
|
|
|
TextWithEntities description;
|
|
|
|
};
|
|
|
|
void deleteAndClear();
|
|
|
|
[[nodiscard]] PeerData *checkFromSinglePeer() const;
|
|
|
|
[[nodiscard]] bool hasScheduledMessages() const;
|
|
|
|
[[nodiscard]] std::optional<RevokeConfig> revokeText(
|
|
|
|
not_null<PeerData*> peer) const;
|
|
|
|
|
|
|
|
const not_null<Main::Session*> _session;
|
|
|
|
|
|
|
|
PeerData * const _wipeHistoryPeer = nullptr;
|
|
|
|
const bool _wipeHistoryJustClear = false;
|
2021-11-16 07:26:35 +00:00
|
|
|
const QDate _wipeHistoryFirstToDelete;
|
|
|
|
const QDate _wipeHistoryLastToDelete;
|
2021-10-18 20:55:58 +00:00
|
|
|
const MessageIdsList _ids;
|
2021-11-22 17:12:00 +00:00
|
|
|
PeerData *_moderateFrom = nullptr;
|
2021-10-18 20:55:58 +00:00
|
|
|
ChannelData *_moderateInChannel = nullptr;
|
|
|
|
bool _moderateBan = false;
|
|
|
|
bool _moderateDeleteAll = false;
|
|
|
|
|
|
|
|
object_ptr<Ui::FlatLabel> _text = { nullptr };
|
|
|
|
object_ptr<Ui::Checkbox> _revoke = { nullptr };
|
|
|
|
object_ptr<Ui::Checkbox> _banUser = { nullptr };
|
|
|
|
object_ptr<Ui::Checkbox> _reportSpam = { nullptr };
|
|
|
|
object_ptr<Ui::Checkbox> _deleteAll = { nullptr };
|
|
|
|
object_ptr<Ui::LinkButton> _autoDeleteSettings = { nullptr };
|
|
|
|
|
|
|
|
Fn<void()> _deleteConfirmedCallback;
|
|
|
|
|
|
|
|
};
|