2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Copy text with expanded links only to external.

Paste valid custom links in message field if copied from messages.
This commit is contained in:
John Preston
2019-04-08 19:10:06 +04:00
parent 0f0c3b7461
commit b5be6df5e2
64 changed files with 772 additions and 647 deletions

View File

@@ -51,13 +51,13 @@ TextWithEntities ComposeNameWithEntities(DocumentData *document) {
result.text = document->filename().isEmpty()
? qsl("Unknown File")
: document->filename();
result.entities.push_back({ EntityInTextBold, 0, result.text.size() });
result.entities.push_back({ EntityType::Bold, 0, result.text.size() });
} else if (song->performer.isEmpty()) {
result.text = song->title;
result.entities.push_back({ EntityInTextBold, 0, result.text.size() });
result.entities.push_back({ EntityType::Bold, 0, result.text.size() });
} else {
result.text = song->performer + QString::fromUtf8(" \xe2\x80\x93 ") + (song->title.isEmpty() ? qsl("Unknown Track") : song->title);
result.entities.push_back({ EntityInTextBold, 0, song->performer.size() });
result.entities.push_back({ EntityType::Bold, 0, song->performer.size() });
}
return result;
}
@@ -1317,7 +1317,7 @@ Link::Link(
int32 from = 0, till = text.size(), lnk = entities.size();
for (const auto &entity : entities) {
auto type = entity.type();
if (type != EntityInTextUrl && type != EntityInTextCustomUrl && type != EntityInTextEmail) {
if (type != EntityType::Url && type != EntityType::CustomUrl && type != EntityType::Email) {
continue;
}
const auto customUrl = entity.data();
@@ -1332,7 +1332,7 @@ Link::Link(
--lnk;
auto &entity = entities.at(lnk);
auto type = entity.type();
if (type != EntityInTextUrl && type != EntityInTextCustomUrl && type != EntityInTextEmail) {
if (type != EntityType::Url && type != EntityType::CustomUrl && type != EntityType::Email) {
++lnk;
break;
}