From efb3e92525558cb889aa38f6e8ca596f21953130 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 28 Jun 2018 18:12:13 +0100 Subject: [PATCH] Show "Saved messages" chat name in export UI. --- Telegram/SourceFiles/export/export_controller.cpp | 3 +++ Telegram/SourceFiles/export/export_controller.h | 6 ++++++ Telegram/SourceFiles/export/view/export_view_content.cpp | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/export/export_controller.cpp b/Telegram/SourceFiles/export/export_controller.cpp index 385ca4b377..1dd31effaa 100644 --- a/Telegram/SourceFiles/export/export_controller.cpp +++ b/Telegram/SourceFiles/export/export_controller.cpp @@ -655,6 +655,9 @@ void Controller::fillMessagesState( result.entityIndex = index + addIndex; result.entityCount = info.list.size() + addCount; result.entityName = dialog.name; + result.entityType = (dialog.type == Data::DialogInfo::Type::Self) + ? ProcessingState::EntityType::SavedMessages + : ProcessingState::EntityType::Chat; result.itemIndex = _messagesWritten + progress.itemIndex; result.itemCount = std::max(_messagesCount, result.itemIndex); result.bytesType = ProcessingState::FileType::File; // TODO diff --git a/Telegram/SourceFiles/export/export_controller.h b/Telegram/SourceFiles/export/export_controller.h index 33c59f47ff..0ec6ca670a 100644 --- a/Telegram/SourceFiles/export/export_controller.h +++ b/Telegram/SourceFiles/export/export_controller.h @@ -48,6 +48,11 @@ struct ProcessingState { GIF, File, }; + enum class EntityType { + Chat, + SavedMessages, + Other, + }; Step step = Step::Initializing; @@ -55,6 +60,7 @@ struct ProcessingState { int substepsNow = 0; int substepsTotal = 0; + EntityType entityType = EntityType::Other; QString entityName; int entityIndex = 0; int entityCount = 0; diff --git a/Telegram/SourceFiles/export/view/export_view_content.cpp b/Telegram/SourceFiles/export/view/export_view_content.cpp index 8f692082de..a217b1ea23 100644 --- a/Telegram/SourceFiles/export/view/export_view_content.cpp +++ b/Telegram/SourceFiles/export/view/export_view_content.cpp @@ -90,7 +90,9 @@ Content ContentFromState(const ProcessingState &state) { "chat" + QString::number(state.entityIndex), (state.entityName.isEmpty() ? lang(lng_deleted) - : state.entityName), + : (state.entityType == ProcessingState::EntityType::Chat) + ? state.entityName + : lang(lng_saved_messages)), (state.itemCount > 0 ? (QString::number(state.itemIndex) + " / "