[Improvement] Copy sticker pack title
This commit is contained in:
		
							parent
							
								
									cb8d390402
								
							
						
					
					
						commit
						010681e600
					
				
					 3 changed files with 17 additions and 0 deletions
				
			
		|  | @ -106,6 +106,8 @@ | ||||||
| 	"ktg_settings_messages": "Messages", | 	"ktg_settings_messages": "Messages", | ||||||
| 	"ktg_settings_filters_hide_all": "Hide \"All chats\" folder", | 	"ktg_settings_filters_hide_all": "Hide \"All chats\" folder", | ||||||
| 	"ktg_hide_pinned_message": "Hide", | 	"ktg_hide_pinned_message": "Hide", | ||||||
|  | 	"ktg_stickers_copy_title": "Copy name", | ||||||
|  | 	"ktg_stickers_title_copied": "Sticker pack name copied to clipboard.", | ||||||
| 	"ktg_settings_userpic_rounding": "Profile pictures rounding", | 	"ktg_settings_userpic_rounding": "Profile pictures rounding", | ||||||
| 	"ktg_settings_userpic_rounding_none": "Square", | 	"ktg_settings_userpic_rounding_none": "Square", | ||||||
| 	"ktg_settings_userpic_rounding_small": "Small", | 	"ktg_settings_userpic_rounding_small": "Small", | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL | ||||||
| */ | */ | ||||||
| #include "boxes/sticker_set_box.h" | #include "boxes/sticker_set_box.h" | ||||||
| 
 | 
 | ||||||
|  | #include "kotato/kotato_lang.h" | ||||||
| #include "data/data_document.h" | #include "data/data_document.h" | ||||||
| #include "data/data_session.h" | #include "data/data_session.h" | ||||||
| #include "data/data_file_origin.h" | #include "data/data_file_origin.h" | ||||||
|  | @ -282,6 +283,14 @@ void StickerSetBox::copyStickersLink() { | ||||||
| 	QGuiApplication::clipboard()->setText(url); | 	QGuiApplication::clipboard()->setText(url); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void StickerSetBox::copyTitle() { | ||||||
|  | 	_inner->title( | ||||||
|  | 	) | rpl::start_with_next([](const TextWithEntities &value) { | ||||||
|  | 		QGuiApplication::clipboard()->setText(value.text); | ||||||
|  | 		Ui::show(Box<Ui::InformBox>(ktr("ktg_stickers_title_copied"))); | ||||||
|  | 	}, lifetime()); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void StickerSetBox::handleError(Error error) { | void StickerSetBox::handleError(Error error) { | ||||||
| 	const auto guard = gsl::finally(crl::guard(this, [=] { | 	const auto guard = gsl::finally(crl::guard(this, [=] { | ||||||
| 		closeBox(); | 		closeBox(); | ||||||
|  | @ -411,6 +420,11 @@ bool StickerSetBox::showMenu(not_null<Ui::IconButton*> button) { | ||||||
| 	}); | 	}); | ||||||
| 	button->installEventFilter(_menu); | 	button->installEventFilter(_menu); | ||||||
| 
 | 
 | ||||||
|  | 	_menu->addAction( | ||||||
|  | 		ktr("ktg_stickers_copy_title"), | ||||||
|  | 		[=] { copyTitle(); }, | ||||||
|  | 		&st::menuIconCopy); | ||||||
|  | 
 | ||||||
| 	if (!_inner->shortName().isEmpty()) { | 	if (!_inner->shortName().isEmpty()) { | ||||||
| 		_menu->addAction( | 		_menu->addAction( | ||||||
| 			tr::lng_stickers_share_pack(tr::now), | 			tr::lng_stickers_share_pack(tr::now), | ||||||
|  |  | ||||||
|  | @ -47,6 +47,7 @@ private: | ||||||
| 	bool showMenu(not_null<Ui::IconButton*> button); | 	bool showMenu(not_null<Ui::IconButton*> button); | ||||||
| 	void addStickers(); | 	void addStickers(); | ||||||
| 	void copyStickersLink(); | 	void copyStickersLink(); | ||||||
|  | 	void copyTitle(); | ||||||
| 	void handleError(Error error); | 	void handleError(Error error); | ||||||
| 
 | 
 | ||||||
| 	const not_null<Window::SessionController*> _controller; | 	const not_null<Window::SessionController*> _controller; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue