Changeset View
Changeset View
Standalone View
Standalone View
src/core/rocketchatcache.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
61 | { | 61 | { | ||
62 | QString cachePath = ManagerDataPaths::self()->path(ManagerDataPaths::Cache, mAccount->accountName()); | 62 | QString cachePath = ManagerDataPaths::self()->path(ManagerDataPaths::Cache, mAccount->accountName()); | ||
63 | cachePath += QLatin1Char('/') + url.path(); | 63 | cachePath += QLatin1Char('/') + url.path(); | ||
64 | return cachePath; | 64 | return cachePath; | ||
65 | } | 65 | } | ||
66 | 66 | | |||
67 | void RocketChatCache::slotDataDownloaded(const QByteArray &data, const QUrl &url, bool storeInCache, const QUrl &localFileUrl) | 67 | void RocketChatCache::slotDataDownloaded(const QByteArray &data, const QUrl &url, bool storeInCache, const QUrl &localFileUrl) | ||
68 | { | 68 | { | ||
69 | const QString newPath = storeInCache ? fileCachePath(url) : localFileUrl.path(); | 69 | const QString newPath = storeInCache ? fileCachePath(url) : localFileUrl.toLocalFile(); | ||
70 | //Split between image/video/audio | 70 | //Split between image/video/audio | ||
71 | const QUrl urldir = QUrl::fromUserInput(newPath).adjusted(QUrl::RemoveFilename); | 71 | const QUrl urldir = QUrl::fromUserInput(newPath).adjusted(QUrl::RemoveFilename); | ||
72 | QDir().mkpath(urldir.path()); | 72 | QDir().mkpath(urldir.toLocalFile()); | ||
73 | QFile file(newPath); | 73 | QFile file(newPath); | ||
74 | if (file.open(QIODevice::ReadWrite)) { | 74 | if (file.open(QIODevice::ReadWrite)) { | ||
75 | file.write(data); | 75 | file.write(data); | ||
76 | file.close(); | 76 | file.close(); | ||
77 | Q_EMIT fileDownloaded(url.path(), QUrl::fromLocalFile(newPath)); | 77 | Q_EMIT fileDownloaded(url.path(), QUrl::fromLocalFile(newPath)); | ||
78 | } else { | 78 | } else { | ||
79 | qCWarning(RUQOLA_LOG) <<" Error !" << file.errorString(); | 79 | qCWarning(RUQOLA_LOG) <<" Error !" << file.errorString(); | ||
80 | } | 80 | } | ||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |