|
|
@ -913,7 +913,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const |
|
|
|
else if (sUrl.startsWith("file://") || sUrl.startsWith("/")) |
|
|
|
else if (sUrl.startsWith("file://") || sUrl.startsWith("/")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString fileName = url.toLocalFile(); |
|
|
|
QString fileName = url.toLocalFile(); |
|
|
|
|
|
|
|
QUrl formedUrl = sUrl.startsWith("file://") ? sUrl : QUrl::fromLocalFile(sUrl); |
|
|
|
QString contentType = UBFileSystemUtils::mimeTypeFromFileName(fileName); |
|
|
|
QString contentType = UBFileSystemUtils::mimeTypeFromFileName(fileName); |
|
|
|
|
|
|
|
|
|
|
|
bool shouldLoadFileData = |
|
|
|
bool shouldLoadFileData = |
|
|
@ -926,7 +926,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const |
|
|
|
if (shouldLoadFileData) |
|
|
|
if (shouldLoadFileData) |
|
|
|
file.open(QIODevice::ReadOnly); |
|
|
|
file.open(QIODevice::ReadOnly); |
|
|
|
|
|
|
|
|
|
|
|
downloadFinished(true, url, contentType, file.readAll(), pPos, pSize, isBackground, internalData); |
|
|
|
downloadFinished(true, formedUrl, contentType, file.readAll(), pPos, pSize, isBackground, internalData); |
|
|
|
|
|
|
|
|
|
|
|
if (shouldLoadFileData) |
|
|
|
if (shouldLoadFileData) |
|
|
|
file.close(); |
|
|
|
file.close(); |
|
|
@ -955,6 +955,8 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString mimeType = pContentTypeHeader; |
|
|
|
QString mimeType = pContentTypeHeader; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qDebug() << sourceUrl.toString(); |
|
|
|
|
|
|
|
|
|
|
|
// In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is
|
|
|
|
// In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is
|
|
|
|
// why we will check if an ; exists and take the first part (the standard allows this kind of mimetype)
|
|
|
|
// why we will check if an ; exists and take the first part (the standard allows this kind of mimetype)
|
|
|
|
if(mimeType.isEmpty()) |
|
|
|
if(mimeType.isEmpty()) |
|
|
|