Add export my data button in Settings.

This commit is contained in:
John Preston 2018-06-20 17:41:59 +01:00
parent e11c27048b
commit a89ad5d0fb
3 changed files with 15 additions and 1 deletions

View File

@ -469,6 +469,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_calls_privacy" = "Phone calls privacy";
"lng_settings_groups_invite_privacy" = "Group invite settings";
"lng_settings_show_sessions" = "Show all sessions";
"lng_settings_export_data" = "Export all my data";
"lng_settings_self_destruct" = "Account self-destruct settings";
"lng_settings_change_phone" = "Change phone number";

View File

@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_settings.h"
#include "lang/lang_keys.h"
#include "application.h"
#include "auth_session.h"
#include "data/data_session.h"
#include "platform/platform_specific.h"
#include "base/openssl_help.h"
#include "boxes/sessions_box.h"
@ -234,8 +236,9 @@ void PrivacyWidget::createControls() {
_autoLock->hide(anim::type::instant);
}
createChildRow(_cloudPasswordState, marginSmall);
createChildRow(_showAllSessions, marginSmall, lang(lng_settings_show_sessions), SLOT(onShowSessions()));
createChildRow(_selfDestruction, marginSmall, lang(lng_settings_self_destruct), SLOT(onSelfDestruction()));
createChildRow(_showAllSessions, marginSmall, lang(lng_settings_show_sessions), SLOT(onShowSessions()));
createChildRow(_exportData, marginSmall, lang(lng_settings_export_data), SLOT(onExportData()));
}
void PrivacyWidget::autoLockUpdated() {
@ -280,4 +283,12 @@ void PrivacyWidget::onSelfDestruction() {
Ui::show(Box<SelfDestructionBox>());
}
void PrivacyWidget::onExportData() {
Ui::hideSettingsAndLayer();
App::CallDelayed(
st::boxDuration,
&Auth(),
[] { Auth().data().startExport(); });
}
} // namespace Settings

View File

@ -87,6 +87,7 @@ private slots:
void onAutoLock();
void onShowSessions();
void onSelfDestruction();
void onExportData();
private:
static QString GetAutoLockText();
@ -103,6 +104,7 @@ private:
CloudPasswordState *_cloudPasswordState = nullptr;
Ui::LinkButton *_showAllSessions = nullptr;
Ui::LinkButton *_selfDestruction = nullptr;
Ui::LinkButton *_exportData = nullptr;
};