diff --git a/Telegram/Resources/icons/menu/file.png b/Telegram/Resources/icons/menu/file.png new file mode 100644 index 000000000..4bf456b4c Binary files /dev/null and b/Telegram/Resources/icons/menu/file.png differ diff --git a/Telegram/Resources/icons/menu/file@2x.png b/Telegram/Resources/icons/menu/file@2x.png new file mode 100644 index 000000000..d18f28300 Binary files /dev/null and b/Telegram/Resources/icons/menu/file@2x.png differ diff --git a/Telegram/Resources/icons/menu/file@3x.png b/Telegram/Resources/icons/menu/file@3x.png new file mode 100644 index 000000000..cb4542036 Binary files /dev/null and b/Telegram/Resources/icons/menu/file@3x.png differ diff --git a/Telegram/Resources/icons/menu/image.png b/Telegram/Resources/icons/menu/image.png new file mode 100644 index 000000000..c7f5c3c2f Binary files /dev/null and b/Telegram/Resources/icons/menu/image.png differ diff --git a/Telegram/Resources/icons/menu/image@2x.png b/Telegram/Resources/icons/menu/image@2x.png new file mode 100644 index 000000000..aba87b945 Binary files /dev/null and b/Telegram/Resources/icons/menu/image@2x.png differ diff --git a/Telegram/Resources/icons/menu/image@3x.png b/Telegram/Resources/icons/menu/image@3x.png new file mode 100644 index 000000000..7f6ebd378 Binary files /dev/null and b/Telegram/Resources/icons/menu/image@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 9d0ebaf9f..a75c8960f 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1489,6 +1489,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_attach_file" = "File"; "lng_attach_photo" = "Photo"; "lng_attach_camera" = "Camera"; +"lng_attach_document" = "Document"; +"lng_attach_photo_or_video" = "Photo or video"; "lng_media_open_with" = "Open With"; "lng_media_download" = "Download"; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 00fca145f..8df631fec 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -498,10 +498,14 @@ HistoryWidget::HistoryWidget( _attachBotsMenu->setAutoHiding(true); } }; + const auto attach = [=](bool compress) { + chooseAttach(compress); + }; _attachBotsMenu = InlineBots::MakeAttachBotsMenu( this, controller, - forceShown); + forceShown, + attach); _attachBotsMenu->setOrigin( Ui::PanelAnimation::Origin::BottomLeft); if (_history && _history->peer->isUser()) { @@ -4039,7 +4043,8 @@ void HistoryWidget::cornerButtonsAnimationFinish() { updateCornerButtonsPositions(); } -void HistoryWidget::chooseAttach() { +void HistoryWidget::chooseAttach( + std::optional overrideSendImagesAsPhotos) { if (_editMsgId) { controller()->show(Ui::MakeInformBox(tr::lng_edit_caption_attach())); return; @@ -4058,7 +4063,9 @@ void HistoryWidget::chooseAttach() { return; } - const auto filter = FileDialog::AllOrImagesFilter(); + const auto filter = (overrideSendImagesAsPhotos == true) + ? FileDialog::ImagesOrAllFilter() + : FileDialog::AllOrImagesFilter(); FileDialog::GetOpenPaths(this, tr::lng_choose_files(tr::now), filter, crl::guard(this, [=]( FileDialog::OpenResult &&result) { @@ -4073,7 +4080,8 @@ void HistoryWidget::chooseAttach() { if (!read.image.isNull() && !read.animated) { confirmSendingFiles( std::move(read.image), - std::move(result.remoteContent)); + std::move(result.remoteContent), + overrideSendImagesAsPhotos); } else { uploadFile(result.remoteContent, SendMediaType::File); } @@ -4081,6 +4089,7 @@ void HistoryWidget::chooseAttach() { auto list = Storage::PrepareMediaList( result.paths, st::sendMediaPreviewSize); + list.overrideSendImagesAsPhotos = overrideSendImagesAsPhotos; confirmSendingFiles(std::move(list)); } }), nullptr); diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 5225befc0..e077e1227 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -423,7 +423,7 @@ private: void animationCallback(); void updateOverStates(QPoint pos); - void chooseAttach(); + void chooseAttach(std::optional overrideSendImagesAsPhotos = {}); void cornerButtonsAnimationFinish(); void sendButtonClicked(); void newItemAdded(not_null item); diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp index 5005e4152..ed77e63a7 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp @@ -674,7 +674,8 @@ void AttachWebView::toggleInMenu( std::unique_ptr MakeAttachBotsMenu( not_null parent, not_null controller, - Fn forceShown) { + Fn forceShown, + Fn attach) { auto result = std::make_unique( parent, st::dropdownMenuWithIcons); @@ -682,12 +683,12 @@ std::unique_ptr MakeAttachBotsMenu( const auto raw = result.get(); const auto refresh = [=] { raw->clearActions(); - raw->addAction(u"Photo or video"_q, [=] { - - }); - raw->addAction(u"Document"_q, [=] { - - }); + raw->addAction(tr::lng_attach_photo_or_video(tr::now), [=] { + attach(true); + }, &st::menuIconPhoto); + raw->addAction(tr::lng_attach_document(tr::now), [=] { + attach(false); + }, &st::menuIconFile); for (const auto &bot : bots->attachBots()) { const auto callback = [=] { const auto active = controller->activeChatCurrent(); diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h index 7d859279b..c68a33928 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h @@ -132,6 +132,7 @@ private: [[nodiscard]] std::unique_ptr MakeAttachBotsMenu( not_null parent, not_null controller, - Fn forceShown); + Fn forceShown, + Fn attach); } // namespace InlineBots diff --git a/Telegram/SourceFiles/ui/menu_icons.style b/Telegram/SourceFiles/ui/menu_icons.style index dad37e892..fc8f15fc3 100644 --- a/Telegram/SourceFiles/ui/menu_icons.style +++ b/Telegram/SourceFiles/ui/menu_icons.style @@ -108,6 +108,8 @@ menuIconCustomize: icon {{ "menu/customize", menuIconColor }}; menuIconSoundOn: icon {{ "menu/sound_enable", menuIconColor }}; menuIconSoundOff: icon {{ "menu/sound_disable", menuIconColor }}; menuIconSoundSelect: icon {{ "menu/sound_select", menuIconColor }}; +menuIconFile: icon {{ "menu/file", menuIconColor }}; +menuIconPhoto: icon {{ "menu/image", menuIconColor }}; menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }}; menuIconTTLAnyTextPosition: point(11px, 22px);