mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 14:17:45 +00:00
[Improvement] Copy bot button callback data
This commit is contained in:
committed by
Eric Kotato
parent
29153f1324
commit
67086dabc1
@@ -30,6 +30,7 @@
|
|||||||
"ktg_user_status_unaccessible": "account inaccessible",
|
"ktg_user_status_unaccessible": "account inaccessible",
|
||||||
"ktg_settings_show_json_settings": "Show settings file",
|
"ktg_settings_show_json_settings": "Show settings file",
|
||||||
"ktg_settings_restart": "Restart Kotatogram",
|
"ktg_settings_restart": "Restart Kotatogram",
|
||||||
|
"ktg_copy_btn_callback": "Copy callback data",
|
||||||
"ktg_settings_chats": "Chats",
|
"ktg_settings_chats": "Chats",
|
||||||
"ktg_settings_sticker_height": "Sticker height: {pixels}px",
|
"ktg_settings_sticker_height": "Sticker height: {pixels}px",
|
||||||
"ktg_settings_sticker_scale_both": "Apply to sticker width",
|
"ktg_settings_sticker_scale_both": "Apply to sticker width",
|
||||||
|
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
*/
|
*/
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
#include "api/api_text_entities.h"
|
#include "api/api_text_entities.h"
|
||||||
#include "base/qt/qt_key_modifiers.h"
|
#include "base/qt/qt_key_modifiers.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
@@ -580,7 +581,14 @@ QString ReplyMarkupClickHandler::copyToClipboardText() const {
|
|||||||
|
|
||||||
QString ReplyMarkupClickHandler::copyToClipboardContextItemText() const {
|
QString ReplyMarkupClickHandler::copyToClipboardContextItemText() const {
|
||||||
const auto button = getUrlButton();
|
const auto button = getUrlButton();
|
||||||
return button ? tr::lng_context_copy_link(tr::now) : QString();
|
using Type = HistoryMessageMarkupButton::Type;
|
||||||
|
return button
|
||||||
|
? ((button->type == Type::Url || button->type == Type::Auth)
|
||||||
|
? tr::lng_context_copy_link(tr::now)
|
||||||
|
: (button->type == Type::Callback || button->type == Type::CallbackWithPassword)
|
||||||
|
? ktr("ktg_copy_btn_callback")
|
||||||
|
: QString())
|
||||||
|
: QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finds the corresponding button in the items markup struct.
|
// Finds the corresponding button in the items markup struct.
|
||||||
@@ -594,10 +602,13 @@ const HistoryMessageMarkupButton *ReplyMarkupClickHandler::getButton() const {
|
|||||||
auto ReplyMarkupClickHandler::getUrlButton() const
|
auto ReplyMarkupClickHandler::getUrlButton() const
|
||||||
-> const HistoryMessageMarkupButton* {
|
-> const HistoryMessageMarkupButton* {
|
||||||
if (const auto button = getButton()) {
|
if (const auto button = getButton()) {
|
||||||
|
/*
|
||||||
using Type = HistoryMessageMarkupButton::Type;
|
using Type = HistoryMessageMarkupButton::Type;
|
||||||
if (button->type == Type::Url || button->type == Type::Auth) {
|
if (button->type == Type::Url || button->type == Type::Auth) {
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
return button;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user