2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Use KUrlMimeData for clipboard xdg-desktop-portal integration

This commit is contained in:
Ilya Fedin
2022-08-27 01:45:38 +04:00
committed by John Preston
parent 5f53dfda0e
commit e20840b4d4
13 changed files with 125 additions and 16 deletions

View File

@@ -67,7 +67,7 @@ auto ListFromMimeData(not_null<const QMimeData*> data, bool premium) {
auto result = data->hasUrls()
? Storage::PrepareMediaList(
// When we edit media, we need only 1 file.
data->urls().mid(0, 1),
base::GetMimeUrls(data).mid(0, 1),
st::sendMediaPreviewSize,
premium)
: Ui::PreparedList(Error::EmptyFile, QString());

View File

@@ -793,13 +793,13 @@ void SendFilesBox::captionResized() {
}
bool SendFilesBox::canAddFiles(not_null<const QMimeData*> data) const {
return (data->hasUrls() && CanAddUrls(data->urls())) || data->hasImage();
return (data->hasUrls() && CanAddUrls(base::GetMimeUrls(data))) || data->hasImage();
}
bool SendFilesBox::addFiles(not_null<const QMimeData*> data) {
const auto premium = _controller->session().premium();
auto list = [&] {
const auto urls = data->hasUrls() ? data->urls() : QList<QUrl>();
const auto urls = data->hasUrls() ? base::GetMimeUrls(data) : QList<QUrl>();
auto result = CanAddUrls(urls)
? Storage::PrepareMediaList(
urls,