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

@@ -88,14 +88,14 @@ void PrepareDetailsInParallel(PreparedList &result, int previewWidth) {
} // namespace
bool ValidatePhotoEditorMediaDragData(not_null<const QMimeData*> data) {
if (data->urls().size() > 1) {
if (base::GetMimeUrls(data).size() > 1) {
return false;
} else if (data->hasImage()) {
return true;
}
if (data->hasUrls()) {
const auto url = data->urls().front();
const auto url = base::GetMimeUrls(data).front();
if (url.isLocalFile()) {
using namespace Core;
const auto info = QFileInfo(Platform::File::UrlToLocal(url));
@@ -111,14 +111,14 @@ bool ValidatePhotoEditorMediaDragData(not_null<const QMimeData*> data) {
bool ValidateEditMediaDragData(
not_null<const QMimeData*> data,
Ui::AlbumType albumType) {
if (data->urls().size() > 1) {
if (base::GetMimeUrls(data).size() > 1) {
return false;
} else if (data->hasImage()) {
return (albumType != Ui::AlbumType::Music);
}
if (albumType == Ui::AlbumType::PhotoVideo && data->hasUrls()) {
const auto url = data->urls().front();
const auto url = base::GetMimeUrls(data).front();
if (url.isLocalFile()) {
using namespace Core;
const auto info = QFileInfo(Platform::File::UrlToLocal(url));
@@ -143,7 +143,7 @@ MimeDataState ComputeMimeDataState(const QMimeData *data) {
return MimeDataState::None;
}
const auto &urls = data->urls();
const auto &urls = base::GetMimeUrls(data);
if (urls.isEmpty()) {
return MimeDataState::None;
}