mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Make retaining selection after forward optional
This commit is contained in:
@@ -2578,4 +2578,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
"ktg_forward_go_to_chat" = "Go to chat";
|
||||
|
||||
"ktg_settings_forward" = "Forward";
|
||||
"ktg_settings_forward_retain_selection" = "Retain selection after forward";
|
||||
|
||||
// Keys finished
|
||||
|
@@ -168,6 +168,8 @@
|
||||
|
||||
// New strings
|
||||
"ktg_forward_go_to_chat": "Go to chat",
|
||||
"ktg_settings_forward": "Forward",
|
||||
"ktg_settings_forward_retain_selection": "Retain selection after forward",
|
||||
|
||||
// This string should always be last for better work with Git.
|
||||
"dummy_last_string": ""
|
||||
|
@@ -176,6 +176,8 @@
|
||||
|
||||
// New strings
|
||||
"ktg_forward_go_to_chat": "Go to chat",
|
||||
"ktg_settings_forward": "Forward",
|
||||
"ktg_settings_forward_retain_selection": "Retain selection after forward",
|
||||
|
||||
// This string should always be last for better work with Git.
|
||||
"dummy_last_string": ""
|
||||
|
@@ -175,6 +175,8 @@
|
||||
|
||||
// New strings
|
||||
"ktg_forward_go_to_chat": "Перейти в чат",
|
||||
"ktg_settings_forward": "Пересылка",
|
||||
"ktg_settings_forward_retain_selection": "Сохранять выделение после пересылки",
|
||||
|
||||
// This string should always be last for better work with Git.
|
||||
"dummy_last_string": ""
|
||||
|
@@ -168,6 +168,8 @@
|
||||
|
||||
// New strings
|
||||
"ktg_forward_go_to_chat": "Go to chat",
|
||||
"ktg_settings_forward": "Forward",
|
||||
"ktg_settings_forward_retain_selection": "Retain selection after forward",
|
||||
|
||||
// This string should always be last for better work with Git.
|
||||
"dummy_last_string": ""
|
||||
|
@@ -175,6 +175,8 @@
|
||||
|
||||
// New strings
|
||||
"ktg_forward_go_to_chat": "Go to chat",
|
||||
"ktg_settings_forward": "Forward",
|
||||
"ktg_settings_forward_retain_selection": "Retain selection after forward",
|
||||
|
||||
// This string should always be last for better work with Git.
|
||||
"dummy_last_string": ""
|
||||
|
@@ -212,6 +212,7 @@ QByteArray GenerateSettingsJson(bool areDefault = false) {
|
||||
settings.insert(qsl("profile_top_mute"), cProfileTopBarNotifications());
|
||||
settings.insert(qsl("hover_emoji_panel"), HoverEmojiPanel());
|
||||
settings.insert(qsl("monospace_large_bubbles"), MonospaceLargeBubbles());
|
||||
settings.insert(qsl("forward_retain_selection"), cForwardRetainSelection());
|
||||
|
||||
settingsFonts.insert(qsl("use_system_font"), cUseSystemFont());
|
||||
settingsFonts.insert(qsl("use_original_metrics"), cUseOriginalMetrics());
|
||||
@@ -516,6 +517,10 @@ bool Manager::readCustomFile() {
|
||||
ReadBoolOption(settings, "hover_emoji_panel", [&](auto v) {
|
||||
SetHoverEmojiPanel(v);
|
||||
});
|
||||
|
||||
ReadBoolOption(settings, "forward_retain_selection", [&](auto v) {
|
||||
cSetForwardRetainSelection(v);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -186,3 +186,5 @@ bool HoverEmojiPanel() {
|
||||
rpl::producer<bool> HoverEmojiPanelChanges() {
|
||||
return gHoverEmojiPanel.changes();
|
||||
}
|
||||
|
||||
bool gForwardRetainSelection = false;
|
||||
|
@@ -121,3 +121,5 @@ DeclareSetting(bool, ProfileTopBarNotifications);
|
||||
void SetHoverEmojiPanel(bool enabled);
|
||||
[[nodiscard]] bool HoverEmojiPanel();
|
||||
[[nodiscard]] rpl::producer<bool> HoverEmojiPanelChanges();
|
||||
|
||||
DeclareSetting(bool, ForwardRetainSelection);
|
||||
|
@@ -372,6 +372,16 @@ void SetupKotatoMessages(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupKotatoForward(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, tr::ktg_settings_forward());
|
||||
|
||||
SettingsMenuCSwitch(ktg_settings_forward_retain_selection, ForwardRetainSelection);
|
||||
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
@@ -585,6 +595,7 @@ void Kotato::setupContent(not_null<Window::SessionController*> controller) {
|
||||
|
||||
SetupKotatoChats(controller, content);
|
||||
SetupKotatoMessages(content);
|
||||
SetupKotatoForward(content);
|
||||
SetupKotatoNetwork(content);
|
||||
SetupKotatoFolders(controller, content);
|
||||
SetupKotatoSystem(controller, content);
|
||||
|
@@ -15,6 +15,7 @@ namespace Settings {
|
||||
|
||||
void SetupKotatoChats(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoMessages(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoForward(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoFolders(
|
||||
not_null<Window::SessionController*> controller,
|
||||
|
@@ -1025,13 +1025,15 @@ QPointer<Ui::RpWidget> ShowForwardMessagesBox(
|
||||
MessageIdsList &&items,
|
||||
FnMut<void()> &&successCallback) {
|
||||
struct ShareData {
|
||||
ShareData(not_null<PeerData*> peer, MessageIdsList &&ids)
|
||||
ShareData(not_null<PeerData*> peer, MessageIdsList &&ids, FnMut<void()> &&callback)
|
||||
: peer(peer)
|
||||
, msgIds(std::move(ids)) {
|
||||
, msgIds(std::move(ids))
|
||||
, submitCallback(std::move(callback)) {
|
||||
}
|
||||
not_null<PeerData*> peer;
|
||||
MessageIdsList msgIds;
|
||||
base::flat_set<mtpRequestId> requests;
|
||||
FnMut<void()> submitCallback;
|
||||
};
|
||||
const auto weak = std::make_shared<QPointer<ShareBox>>();
|
||||
const auto item = App::wnd()->sessionController()->session().data().message(items[0]);
|
||||
@@ -1043,7 +1045,7 @@ QPointer<Ui::RpWidget> ShowForwardMessagesBox(
|
||||
&& item->media()
|
||||
&& (item->media()->game() != nullptr);
|
||||
const auto canCopyLink = items.size() == 1 && (item->hasDirectLink() || isGame);
|
||||
const auto data = std::make_shared<ShareData>(history->peer, std::move(items));
|
||||
const auto data = std::make_shared<ShareData>(history->peer, std::move(items), std::move(successCallback));
|
||||
|
||||
auto copyCallback = [=]() {
|
||||
if (const auto item = owner->message(data->msgIds[0])) {
|
||||
@@ -1162,6 +1164,9 @@ QPointer<Ui::RpWidget> ShowForwardMessagesBox(
|
||||
});
|
||||
data->requests.insert(history->sendRequestId);
|
||||
}
|
||||
if (data->submitCallback && !cForwardRetainSelection()) {
|
||||
data->submitCallback();
|
||||
}
|
||||
};
|
||||
auto filterCallback = [](PeerData *peer) {
|
||||
return peer->canWrite();
|
||||
|
Reference in New Issue
Block a user