mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-29 10:43:31 +00:00
Add information about saved data.
This commit is contained in:
parent
0143fd28af
commit
9f8d61ab2f
@ -1657,8 +1657,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_export_title" = "Export Personal Data";
|
||||
"lng_export_progress_title" = "Exporting personal data";
|
||||
"lng_export_option_info" = "Personal information";
|
||||
"lng_export_option_info_about" = "Your chosen screen name, username and profile pictures are public and available to everyone. You don't have to supply your real name.";
|
||||
"lng_export_option_contacts" = "Contacts list";
|
||||
"lng_export_option_contacts_about" = "To let you connect with friends across all your devices, your contacts are continuosly synced with Telegram. You can disable syncing or delete your stored contacts in Settings > Privacy & Security.";
|
||||
"lng_export_option_sessions" = "Sessions list";
|
||||
"lng_export_option_sessions_about" = "We store this to display your connected devices in Settings > Privacy & Security > Active Sessions. Terminating a session removes this data from Telegram servers.";
|
||||
"lng_export_header_chats" = "Chat export settings";
|
||||
"lng_export_option_personal_chats" = "Personal chats";
|
||||
"lng_export_option_bot_chats" = "Bot chats";
|
||||
|
35
Telegram/SourceFiles/export/data/export_data_about.h
Normal file
35
Telegram/SourceFiles/export/data/export_data_about.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
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 "export/data/export_data_types.h"
|
||||
|
||||
namespace Export {
|
||||
namespace Data {
|
||||
|
||||
inline Utf8String AboutPersonalInfo() {
|
||||
return "Your chosen screen name, username and profile pictures "
|
||||
"are public and available to everyone. "
|
||||
"You don't have to supply your real name.";
|
||||
}
|
||||
|
||||
inline Utf8String AboutContacts() {
|
||||
return "To let you connect with friends across all your devices, "
|
||||
"your contacts are continuosly synced with Telegram. "
|
||||
"You can disable syncing or delete your stored contacts "
|
||||
"in Settings > Privacy & Security.";
|
||||
}
|
||||
|
||||
inline Utf8String AboutSessions() {
|
||||
return "We store this to display your connected devices "
|
||||
"in Settings > Privacy & Security > Active Sessions. "
|
||||
"Terminating a session removes this data from Telegram servers.";
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
} // namespace Export
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "export/output/export_output_result.h"
|
||||
#include "export/data/export_data_types.h"
|
||||
#include "export/data/export_data_about.h"
|
||||
#include "core/utils.h"
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
@ -615,6 +616,7 @@ Result JsonWriter::writePersonal(const Data::PersonalInfo &data) {
|
||||
return _output->writeBlock(
|
||||
prepareObjectItemStart("personal_information")
|
||||
+ SerializeObject(_context, {
|
||||
{ "about", SerializeString(Data::AboutPersonalInfo()) },
|
||||
{ "first_name", SerializeString(info.firstName) },
|
||||
{ "last_name", SerializeString(info.lastName) },
|
||||
{
|
||||
@ -687,6 +689,10 @@ Result JsonWriter::writeSavedContacts(const Data::ContactsList &data) {
|
||||
Expects(_output != nullptr);
|
||||
|
||||
auto block = prepareObjectItemStart("contacts");
|
||||
block.append(pushNesting(Context::kObject));
|
||||
block.append(prepareObjectItemStart("about"));
|
||||
block.append(SerializeString(Data::AboutContacts()));
|
||||
block.append(prepareObjectItemStart("list"));
|
||||
block.append(pushNesting(Context::kArray));
|
||||
for (const auto index : Data::SortedContactsIndices(data)) {
|
||||
const auto &contact = data.list[index];
|
||||
@ -711,6 +717,7 @@ Result JsonWriter::writeSavedContacts(const Data::ContactsList &data) {
|
||||
}));
|
||||
}
|
||||
}
|
||||
block.append(popNesting());
|
||||
return _output->writeBlock(block + popNesting());
|
||||
}
|
||||
|
||||
@ -765,6 +772,10 @@ Result JsonWriter::writeSessions(const Data::SessionsList &data) {
|
||||
Expects(_output != nullptr);
|
||||
|
||||
auto block = prepareObjectItemStart("sessions");
|
||||
block.append(pushNesting(Context::kObject));
|
||||
block.append(prepareObjectItemStart("about"));
|
||||
block.append(SerializeString(Data::AboutSessions()));
|
||||
block.append(prepareObjectItemStart("list"));
|
||||
block.append(pushNesting(Context::kArray));
|
||||
for (const auto &session : data.list) {
|
||||
block.append(prepareArrayItemStart());
|
||||
@ -787,6 +798,7 @@ Result JsonWriter::writeSessions(const Data::SessionsList &data) {
|
||||
{ "created", SerializeDate(session.created) },
|
||||
}));
|
||||
}
|
||||
block.append(popNesting());
|
||||
return _output->writeBlock(block + popNesting());
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "export/output/export_output_result.h"
|
||||
#include "export/data/export_data_types.h"
|
||||
#include "export/data/export_data_about.h"
|
||||
#include "core/utils.h"
|
||||
|
||||
#include <QtCore/QFile>
|
||||
@ -457,6 +458,9 @@ Result TextWriter::writePersonal(const Data::PersonalInfo &data) {
|
||||
{ "Username", FormatUsername(data.user.username) },
|
||||
{ "Bio", data.bio },
|
||||
})
|
||||
+ kLineBreak
|
||||
+ Data::AboutPersonalInfo()
|
||||
+ kLineBreak
|
||||
+ kLineBreak;
|
||||
return _summary->writeBlock(serialized);
|
||||
}
|
||||
@ -545,7 +549,10 @@ Result TextWriter::writeSavedContacts(const Data::ContactsList &data) {
|
||||
}));
|
||||
}
|
||||
}
|
||||
const auto full = JoinList(kLineBreak, list);
|
||||
const auto full = Data::AboutContacts()
|
||||
+ kLineBreak
|
||||
+ kLineBreak
|
||||
+ JoinList(kLineBreak, list);
|
||||
if (const auto result = file->writeBlock(full); !result) {
|
||||
return result;
|
||||
}
|
||||
@ -663,7 +670,10 @@ Result TextWriter::writeSessions(const Data::SessionsList &data) {
|
||||
{ "Created", Data::FormatDateTime(session.created) },
|
||||
}));
|
||||
}
|
||||
const auto full = JoinList(kLineBreak, list);
|
||||
const auto full = Data::AboutSessions()
|
||||
+ kLineBreak
|
||||
+ kLineBreak
|
||||
+ JoinList(kLineBreak, list);
|
||||
if (const auto result = file->writeBlock(full); !result) {
|
||||
return result;
|
||||
}
|
||||
|
@ -43,6 +43,12 @@ exportLocationLabel: FlatLabel(boxLabel) {
|
||||
}
|
||||
exportLocationPadding: margins(22px, 8px, 22px, 8px);
|
||||
|
||||
exportAboutOptionLabel: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowSubTextFg;
|
||||
minWidth: 175px;
|
||||
}
|
||||
exportAboutOptionPadding: margins(22px, 0px, 22px, 16px);
|
||||
|
||||
exportErrorLabel: FlatLabel(boxLabel) {
|
||||
minWidth: 175px;
|
||||
align: align(top);
|
||||
|
@ -95,12 +95,21 @@ void SettingsWidget::setupContent() {
|
||||
}
|
||||
|
||||
void SettingsWidget::setupOptions(not_null<Ui::VerticalLayout*> container) {
|
||||
addOption(
|
||||
addOptionWithAbout(
|
||||
container,
|
||||
lng_export_option_info,
|
||||
Type::PersonalInfo | Type::Userpics);
|
||||
addOption(container, lng_export_option_contacts, Type::Contacts);
|
||||
addOption(container, lng_export_option_sessions, Type::Sessions);
|
||||
Type::PersonalInfo | Type::Userpics,
|
||||
lng_export_option_info_about);
|
||||
addOptionWithAbout(
|
||||
container,
|
||||
lng_export_option_contacts,
|
||||
Type::Contacts,
|
||||
lng_export_option_contacts_about);
|
||||
addOptionWithAbout(
|
||||
container,
|
||||
lng_export_option_sessions,
|
||||
Type::Sessions,
|
||||
lng_export_option_sessions_about);
|
||||
addHeader(container, lng_export_header_chats);
|
||||
addOption(
|
||||
container,
|
||||
@ -311,6 +320,21 @@ not_null<Ui::Checkbox*> SettingsWidget::addOption(
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
void SettingsWidget::addOptionWithAbout(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
Types types,
|
||||
LangKey about) {
|
||||
addOption(container, key, types);
|
||||
const auto label = container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
lang(about),
|
||||
Ui::FlatLabel::InitType::Simple,
|
||||
st::exportAboutOptionLabel),
|
||||
st::exportAboutOptionPadding);
|
||||
}
|
||||
|
||||
void SettingsWidget::addChatOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
|
@ -51,6 +51,11 @@ private:
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
Types types);
|
||||
void addOptionWithAbout(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
Types types,
|
||||
LangKey about);
|
||||
void addChatOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
|
@ -56,6 +56,7 @@
|
||||
'<(src_loc)/export/export_controller.h',
|
||||
'<(src_loc)/export/export_settings.cpp',
|
||||
'<(src_loc)/export/export_settings.h',
|
||||
'<(src_loc)/export/data/export_data_about.h',
|
||||
'<(src_loc)/export/data/export_data_types.cpp',
|
||||
'<(src_loc)/export/data/export_data_types.h',
|
||||
'<(src_loc)/export/output/export_output_abstract.cpp',
|
||||
|
Loading…
Reference in New Issue
Block a user