44 const QVariantMap& additional,
58 e.Additional_ = additional;
67 const auto fileGuard =
MakeScopeGuard ([&file] { file.remove (); });
68 if (!file.open (QIODevice::ReadOnly))
74 cont.
Right (file.readAll ());
85 const DataHandler_t& cont,
87 : DownloadHandler { url, {},
iem, cont, parent }
91 DownloadHandler::DownloadHandler (
const Entity& e,
93 const EntityHandler_t& cont,
101 throw std::runtime_error (
"Cannot delegate entity.");
104 connect (res.Handler_,
105 SIGNAL (jobFinished (
int)),
107 SLOT (handleFinished (
int)));
108 connect (res.Handler_,
114 void DownloadHandler::handleFinished (
int id)
Entity MakeEntity(const QVariant &entity, const QString &location, TaskParameters tp, const QString &mime)
Proxy to core entity manager.
Left_f::result_type Left(Args &&...args) const
Invoke the left function and return its result.
detail::ScopeGuard< F > MakeScopeGuard(const F &f)
Returns an object performing passed function on scope exit.
A peir of two functions, typically a continuation and an error handler.
DownloadHandler(const QUrl &url, const QVariantMap &additional, IEntityManager *iem, const DataHandler_t &, QObject *parent=nullptr)
QString GetTemporaryName(const QString &pattern)
Returns a temporary filename.
Right_f::result_type Right(Args &&...args) const
Invoke the right function and return its result.
virtual DelegationResult DelegateEntity(LeechCraft::Entity entity, QObject *desired=0)=0
Delegates the given entity and returns the delegation result.
QString Location_
Source or destination.