diff options
Diffstat (limited to 'src/libs/installer/downloadarchivesjob.cpp')
-rw-r--r-- | src/libs/installer/downloadarchivesjob.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/libs/installer/downloadarchivesjob.cpp b/src/libs/installer/downloadarchivesjob.cpp index e7f60f9cf..52031121d 100644 --- a/src/libs/installer/downloadarchivesjob.cpp +++ b/src/libs/installer/downloadarchivesjob.cpp @@ -38,8 +38,8 @@ #include "packagemanagercore.h" #include "utils.h" -#include "kdupdaterfiledownloader.h" -#include "kdupdaterfiledownloaderfactory.h" +#include "filedownloader.h" +#include "filedownloaderfactory.h" #include <QtCore/QFile> #include <QtCore/QTimerEvent> @@ -52,7 +52,7 @@ using namespace KDUpdater; Creates a new DownloadArchivesJob with \a parent. */ DownloadArchivesJob::DownloadArchivesJob(PackageManagerCore *core) - : KDJob(core) + : Job(core) , m_core(core) , m_downloader(0) , m_archivesDownloaded(0) @@ -125,8 +125,8 @@ void DownloadArchivesJob::fetchNextArchiveHash() return; } - connect(m_downloader, SIGNAL(downloadCompleted()), this, SLOT(finishedHashDownload()), - Qt::QueuedConnection); + connect(m_downloader, &FileDownloader::downloadCompleted, + this, &DownloadArchivesJob::finishedHashDownload, Qt::QueuedConnection); m_downloader->download(); } else { QMetaObject::invokeMethod(this, "fetchNextArchive", Qt::QueuedConnection); @@ -164,7 +164,7 @@ void DownloadArchivesJob::fetchNextArchive() if (m_downloader != 0) m_downloader->deleteLater(); - m_downloader = setupDownloader(QString(), m_core->value(QLatin1String("UrlQueryString"))); + m_downloader = setupDownloader(QString(), m_core->value(scUrlQueryString)); if (!m_downloader) { m_archivesToDownload.removeFirst(); QMetaObject::invokeMethod(this, "fetchNextArchiveHash", Qt::QueuedConnection); @@ -173,7 +173,8 @@ void DownloadArchivesJob::fetchNextArchive() emit progressChanged(double(m_archivesDownloaded) / m_archivesToDownloadCount); connect(m_downloader, SIGNAL(downloadProgress(double)), this, SLOT(emitDownloadProgress(double))); - connect(m_downloader, SIGNAL(downloadCompleted()), this, SLOT(registerFile()), Qt::QueuedConnection); + connect(m_downloader, &FileDownloader::downloadCompleted, + this, &DownloadArchivesJob::registerFile, Qt::QueuedConnection); m_downloader->download(); } @@ -220,7 +221,7 @@ void DownloadArchivesJob::registerFile() QMessageBox::Retry | QMessageBox::Cancel, QMessageBox::Cancel); if (res == QMessageBox::Cancel) { - finishWithError(tr("Could not verify Hash")); + finishWithError(tr("Cannot verify Hash")); return; } } else { @@ -240,7 +241,7 @@ void DownloadArchivesJob::registerFile() void DownloadArchivesJob::downloadCanceled() { - emitFinishedWithError(KDJob::Canceled, m_downloader->errorString()); + emitFinishedWithError(Job::Canceled, m_downloader->errorString()); } void DownloadArchivesJob::downloadFailed(const QString &error) @@ -250,7 +251,7 @@ void DownloadArchivesJob::downloadFailed(const QString &error) const QMessageBox::StandardButton b = MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), - QLatin1String("archiveDownloadError"), tr("Download Error"), tr("Could not download archive: %1 : %2") + QLatin1String("archiveDownloadError"), tr("Download Error"), tr("Cannot download archive %1: %2") .arg(m_archivesToDownload.first().second, error), QMessageBox::Retry | QMessageBox::Cancel); if (b == QMessageBox::Retry) @@ -262,7 +263,7 @@ void DownloadArchivesJob::downloadFailed(const QString &error) void DownloadArchivesJob::finishWithError(const QString &error) { const FileDownloader *const dl = qobject_cast<const FileDownloader*> (sender()); - const QString msg = tr("Could not fetch archives: %1\nError while loading %2"); + const QString msg = tr("Cannot fetch archives: %1\nError while loading %2"); if (dl != 0) emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, dl->url().toString())); else @@ -291,24 +292,23 @@ KDUpdater::FileDownloader *DownloadArchivesJob::setupDownloader(const QString &s auth.setPassword(component->value(QLatin1String("password"))); downloader->setAuthenticator(auth); - connect(downloader, SIGNAL(downloadCanceled()), this, SLOT(downloadCanceled())); - connect(downloader, SIGNAL(downloadAborted(QString)), this, SLOT(downloadFailed(QString)), + connect(downloader, &FileDownloader::downloadCanceled, this, &DownloadArchivesJob::downloadCanceled); + connect(downloader, &FileDownloader::downloadAborted, this, &DownloadArchivesJob::downloadFailed, Qt::QueuedConnection); - connect(downloader, SIGNAL(downloadStatus(QString)), this, SIGNAL(downloadStatusChanged(QString))); + connect(downloader, &FileDownloader::downloadStatus, this, &DownloadArchivesJob::downloadStatusChanged); if (FileDownloaderFactory::isSupportedScheme(scheme)) { downloader->setDownloadedFileName(component->localTempPath() + QLatin1Char('/') + component->name() + QLatin1Char('/') + fi.fileName() + suffix); } - emit outputTextChanged(tr("Downloading archive '%1' for component: %2") + emit outputTextChanged(tr("Downloading archive \"%1\" for component %2.") .arg(fi.fileName() + suffix, component->displayName())); } else { - emit outputTextChanged(tr("Scheme not supported: %1 (%2)").arg(scheme, url.toString())); + emit outputTextChanged(tr("Scheme %1 not supported (URL: %2).").arg(scheme, url.toString())); } } else { - emit outputTextChanged(tr("Could not find component for: %1.").arg(QFileInfo(fi.path()) - .fileName())); + emit outputTextChanged(tr("Cannot find component for %1.").arg(QFileInfo(fi.path()).fileName())); } return downloader; } |