QMacPasteboardMimeFileUri: Use file paths instead of file references
Change-Id: I732d94bc6add2814c8ebd2c7fe80592024dd1b9a Task-number: QTBUG-40449 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
parent
8dcfb43d8f
commit
be5cfa960b
@ -611,9 +611,21 @@ QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QBy
|
||||
return QVariant();
|
||||
QList<QVariant> ret;
|
||||
for (int i = 0; i < data.size(); ++i) {
|
||||
QUrl url = QUrl::fromEncoded(data.at(i));
|
||||
const QByteArray &a = data.at(i);
|
||||
NSString *urlString = [[[NSString alloc] initWithBytesNoCopy:(void *)a.data() length:a.size()
|
||||
encoding:NSUTF8StringEncoding freeWhenDone:NO] autorelease];
|
||||
NSURL *nsurl = [NSURL URLWithString:urlString];
|
||||
QUrl url;
|
||||
// OS X 10.10 sends file references instead of file paths
|
||||
if ([nsurl isFileReferenceURL]) {
|
||||
url = QUrl::fromNSURL([nsurl filePathURL]);
|
||||
} else {
|
||||
url = QUrl::fromNSURL(nsurl);
|
||||
}
|
||||
|
||||
if (url.host().toLower() == QLatin1String("localhost"))
|
||||
url.setHost(QString());
|
||||
|
||||
url.setPath(url.path().normalized(QString::NormalizationForm_C));
|
||||
ret.append(url);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user