2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +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

@@ -17,10 +17,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <crl/crl_time.h>
#include <QtCore/QReadWriteLock>
#include <QtCore/QRegularExpression>
#include <QtCore/QMimeData>
#include <QtNetwork/QNetworkProxy>
#include <cmath>
#include <set>
#if __has_include(<KUrlMimeData>)
#include <KUrlMimeData>
#endif
#define qsl(s) QStringLiteral(s)
namespace base {
@@ -30,6 +35,16 @@ inline bool in_range(Value &&value, From &&from, Till &&till) {
return (value >= from) && (value < till);
}
inline auto GetMimeUrls(const QMimeData *data) {
#if __has_include(<KUrlMimeData>)
return KUrlMimeData::urlsFromMimeData(
data,
KUrlMimeData::PreferLocalUrls);
#else
return data->urls();
#endif
}
} // namespace base
static const int32 ScrollMax = INT_MAX;