2016-06-06 10:29:51 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2017-01-11 18:31:31 +00:00
|
|
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
2016-06-06 10:29:51 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-11-16 16:04:25 +00:00
|
|
|
#include "boxes/abstractbox.h"
|
2016-06-06 10:29:51 +00:00
|
|
|
|
2016-10-28 09:20:24 +00:00
|
|
|
namespace Ui {
|
|
|
|
class Radiobutton;
|
2016-11-15 11:56:49 +00:00
|
|
|
class InputArea;
|
2016-10-28 09:20:24 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
class ReportBox : public BoxContent, public RPCSender {
|
2016-06-06 10:29:51 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-12-13 17:07:56 +00:00
|
|
|
ReportBox(QWidget*, PeerData *peer);
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onReport();
|
|
|
|
void onChange();
|
|
|
|
void onDescriptionResized();
|
2016-12-20 13:03:51 +00:00
|
|
|
void onClose() {
|
|
|
|
closeBox();
|
|
|
|
}
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
protected:
|
2016-12-13 17:07:56 +00:00
|
|
|
void prepare() override;
|
|
|
|
void setInnerFocus() override;
|
2016-06-06 10:29:51 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void updateMaxHeight();
|
|
|
|
|
|
|
|
void reportDone(const MTPBool &result);
|
|
|
|
bool reportFail(const RPCError &error);
|
|
|
|
|
2016-12-09 06:19:55 +00:00
|
|
|
PeerData *_peer;
|
2016-06-06 10:29:51 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::Radiobutton> _reasonSpam;
|
|
|
|
object_ptr<Ui::Radiobutton> _reasonViolence;
|
|
|
|
object_ptr<Ui::Radiobutton> _reasonPornography;
|
|
|
|
object_ptr<Ui::Radiobutton> _reasonOther;
|
|
|
|
object_ptr<Ui::InputArea> _reasonOtherText = { nullptr };
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
enum Reason {
|
|
|
|
ReasonSpam,
|
|
|
|
ReasonViolence,
|
|
|
|
ReasonPornography,
|
|
|
|
ReasonOther,
|
|
|
|
};
|
|
|
|
mtpRequestId _requestId = 0;
|
|
|
|
|
|
|
|
};
|