2016-08-19 17:26:31 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-08-19 17:26:31 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-08-19 17:26:31 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "settings/settings_block_widget.h"
|
2016-08-28 19:16:23 +00:00
|
|
|
#include "settings/settings_chat_settings_widget.h"
|
2017-09-13 16:57:44 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2016-08-19 17:26:31 +00:00
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
2017-09-13 16:57:44 +00:00
|
|
|
class LocalPasscodeState : public Ui::RpWidget, private base::Subscriber {
|
2016-08-28 19:16:23 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
LocalPasscodeState(QWidget *parent);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int resizeGetHeight(int newWidth) override;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onEdit();
|
|
|
|
void onTurnOff();
|
|
|
|
|
|
|
|
private:
|
2017-04-18 17:37:14 +00:00
|
|
|
static QString GetEditPasscodeText();
|
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
void updateControls();
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::LinkButton> _edit;
|
|
|
|
object_ptr<Ui::LinkButton> _turnOff;
|
2016-08-28 19:16:23 +00:00
|
|
|
|
2016-08-27 17:52:05 +00:00
|
|
|
};
|
|
|
|
|
2017-09-13 16:57:44 +00:00
|
|
|
class CloudPasswordState : public Ui::RpWidget, private base::Subscriber, public RPCSender {
|
2016-08-28 19:16:23 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CloudPasswordState(QWidget *parent);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int resizeGetHeight(int newWidth) override;
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onEdit();
|
|
|
|
void onTurnOff();
|
|
|
|
void onReloadPassword(Qt::ApplicationState state = Qt::ApplicationActive);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void getPasswordDone(const MTPaccount_Password &result);
|
|
|
|
void offPasswordDone(const MTPBool &result);
|
|
|
|
bool offPasswordFail(const RPCError &error);
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::LinkButton> _edit;
|
|
|
|
object_ptr<Ui::LinkButton> _turnOff;
|
2016-08-28 19:16:23 +00:00
|
|
|
|
|
|
|
QString _waitingConfirm;
|
|
|
|
QByteArray _curPasswordSalt;
|
|
|
|
bool _hasPasswordRecovery = false;
|
|
|
|
QString _curPasswordHint;
|
|
|
|
QByteArray _newPasswordSalt;
|
|
|
|
|
2016-08-27 17:52:05 +00:00
|
|
|
};
|
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
class PrivacyWidget : public BlockWidget {
|
2016-08-22 17:16:21 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
public:
|
|
|
|
PrivacyWidget(QWidget *parent, UserData *self);
|
|
|
|
|
2016-08-22 17:16:21 +00:00
|
|
|
private slots:
|
2017-03-13 15:40:21 +00:00
|
|
|
void onBlockedUsers();
|
2017-03-16 15:15:07 +00:00
|
|
|
void onLastSeenPrivacy();
|
2017-04-29 15:32:01 +00:00
|
|
|
void onCallsPrivacy();
|
2017-03-17 16:19:57 +00:00
|
|
|
void onGroupsInvitePrivacy();
|
2016-08-28 19:16:23 +00:00
|
|
|
void onAutoLock();
|
2016-08-22 17:16:21 +00:00
|
|
|
void onShowSessions();
|
2017-03-20 15:41:17 +00:00
|
|
|
void onSelfDestruction();
|
2016-08-19 17:26:31 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-18 17:37:14 +00:00
|
|
|
static QString GetAutoLockText();
|
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
void createControls();
|
|
|
|
void autoLockUpdated();
|
2016-08-19 17:26:31 +00:00
|
|
|
|
2017-09-13 16:57:44 +00:00
|
|
|
Ui::LinkButton *_blockedUsers = nullptr;
|
|
|
|
Ui::LinkButton *_lastSeenPrivacy = nullptr;
|
|
|
|
Ui::LinkButton *_callsPrivacy = nullptr;
|
|
|
|
Ui::LinkButton *_groupsInvitePrivacy = nullptr;
|
|
|
|
LocalPasscodeState *_localPasscodeState = nullptr;
|
|
|
|
Ui::SlideWrap<LabeledLink> *_autoLock = nullptr;
|
|
|
|
CloudPasswordState *_cloudPasswordState = nullptr;
|
|
|
|
Ui::LinkButton *_showAllSessions = nullptr;
|
|
|
|
Ui::LinkButton *_selfDestruction = nullptr;
|
2016-08-22 17:16:21 +00:00
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Settings
|