コード例 #1
0
/*!
     Returns a new instance of a KDUpdater::FileDownloader subclass. The
     instantiation of a subclass depends on the communication protocol string
     stored in \a scheme with the parent \a parent.

     \note Ownership of the created object remains with the programmer.
*/
FileDownloader *FileDownloaderFactory::create(const QString &scheme, QObject *parent) const
{
    FileDownloader *downloader =
        GenericFactory<FileDownloader, QString, QObject*>::create(scheme, parent);
    if (downloader != 0) {
        downloader->setFollowRedirects(d->m_followRedirects);
        downloader->setIgnoreSslErrors(d->m_ignoreSslErrors);
        if (d->m_factory)
            downloader->setProxyFactory(d->m_factory->clone());
    }
    return downloader;
}
FileDownloader *FileDownloaderFactory::create(const QString &scheme, const SignatureVerifier *verifier,
        const QUrl &signatureUrl, QObject *parent) const
{
    FileDownloader *downloader = KDGenericFactory<FileDownloader>::create(scheme);
    if (downloader != 0) {
        downloader->setParent(parent);
        downloader->setFollowRedirects(d->m_followRedirects);
        if (d->m_factory)
            downloader->setProxyFactory(d->m_factory->clone());
    }
    if (!verifier)
        return downloader;

    SignatureVerificationDownloader *svdl = new SignatureVerificationDownloader(downloader, parent);
    svdl->setSignatureVerifier(verifier);
    svdl->setSignatureUrl(signatureUrl);
    return svdl;
}