31 e.Mime_ = std::move (params.
Mime_);
37 qWarning () <<
"delegation failed for" << url;
41 QObject::tr (
"Unable to find a downloader plugin.")
45 const auto result = co_await res.DownloadResult_;
46 const auto success [[maybe_unused]] = co_await
WithHandler (result,
49 qWarning () <<
"failed downloading" << url << static_cast<int> (error.
Type_) << error.
Message_;
54 if (!file.open (QIODevice::ReadOnly))
56 qWarning () <<
"unable to open downloaded file" << file.errorString ();
60 QObject::tr (
"Unable to open local file: %1.").arg (file.errorString ())
64 co_return file.readAll ();
Proxy to core entity manager.
requires std::invocable< F, const L & > detail::EitherAwaiter< L, R, F > WithHandler(const Either< L, R > &either, F &&errorHandler)
Task< TempDownload_t > DownloadAsTemporary(IEntityManager &iem, QUrl url, DownloadParams params)
Entity MakeEntity(const QVariant &entity, const QString &location, TaskParameters tp, const QString &mime)
enum IDownload::Error::Type Type_
virtual DelegationResult DelegateEntity(LC::Entity entity, QObject *desired=nullptr)=0
Delegates the given entity and returns the delegation result.
detail::ScopeGuard< F > MakeScopeGuard(const F &f)
Returns an object performing passed function on scope exit.
QString GetTemporaryName(const QString &pattern)
Returns a temporary filename.