I actually solved the problem right now. Here is the solution:
{
if (url.
host().
isEmpty() && url.
path().
startsWith(QLatin1String("/.file/id="))) {
const char* cString = utf8.constData();
NSString *localFilePath = [[NSString alloc] initWithUTF8String:cString];
NSURL *localFilePathURL = [NSURL fileURLWithPath:localFilePath];
url
= QUrl::fromNSURL([localFilePathURL filePathURL
]);
}
url.
setPath(url.
path().
normalized(QString::NormalizationForm_C));
return url.toString();
}
QString returnActualPathForDroppedFile(QString aPath)
{
QUrl url(aPath);
if (url.host().toLower() == QLatin1String("localhost"))
url.setHost(QString());
if (url.host().isEmpty() && url.path().startsWith(QLatin1String("/.file/id=")))
{
const QByteArray utf8 = aPath.toUtf8();
const char* cString = utf8.constData();
NSString *localFilePath = [[NSString alloc] initWithUTF8String:cString];
NSURL *localFilePathURL = [NSURL fileURLWithPath:localFilePath];
url = QUrl::fromNSURL([localFilePathURL filePathURL]);
}
url.setPath(url.path().normalized(QString::NormalizationForm_C));
return url.toString();
}
To copy to clipboard, switch view to plain text mode
Bookmarks