Skip to content

Commit

Permalink
Add export my data button in Settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Jun 20, 2018
1 parent e11c270 commit a89ad5d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
13 changes: 12 additions & 1 deletion Telegram/SourceFiles/settings/settings_privacy_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ For license and copyright information please follow this link:
#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"
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/settings/settings_privacy_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private slots:
void onAutoLock();
void onShowSessions();
void onSelfDestruction();
void onExportData();

private:
static QString GetAutoLockText();
Expand All @@ -103,6 +104,7 @@ private slots:
CloudPasswordState *_cloudPasswordState = nullptr;
Ui::LinkButton *_showAllSessions = nullptr;
Ui::LinkButton *_selfDestruction = nullptr;
Ui::LinkButton *_exportData = nullptr;

};

Expand Down

0 comments on commit a89ad5d

Please sign in to comment.