diff options
author | kh1 <qt-info@nokia.com> | 2011-05-06 13:11:39 +0200 |
---|---|---|
committer | kh1 <qt-info@nokia.com> | 2011-05-06 13:11:39 +0200 |
commit | 972b92a015817e5df22afe4e5a8987fc093d1d7c (patch) | |
tree | 42b98a37543a1fc2c648cce9668e58466412aef5 /installerbuilder/libinstaller | |
parent | 54df89fa6dc88c03078e8c2c70ebc496c6d4ee61 (diff) |
Make use of the commen error values.
Diffstat (limited to 'installerbuilder/libinstaller')
7 files changed, 30 insertions, 40 deletions
diff --git a/installerbuilder/libinstaller/downloadarchivesjob.cpp b/installerbuilder/libinstaller/downloadarchivesjob.cpp index 7cbd4bbbe..0767f82ec 100644 --- a/installerbuilder/libinstaller/downloadarchivesjob.cpp +++ b/installerbuilder/libinstaller/downloadarchivesjob.cpp @@ -324,7 +324,7 @@ void DownloadArchivesJob::finishWithError(const QString &error) const FileDownloader *const dl = dynamic_cast<const FileDownloader*> (sender()); const QString msg = tr("Could not fetch archives: %1\nError while loading %2"); if (dl != 0) - emitFinishedWithError(DownloadError, msg.arg(error, dl->url().toString())); + emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, dl->url().toString())); else - emitFinishedWithError(DownloadError, msg.arg(error, m_downloader->url().toString())); + emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, m_downloader->url().toString())); } diff --git a/installerbuilder/libinstaller/downloadarchivesjob.h b/installerbuilder/libinstaller/downloadarchivesjob.h index a5b4505d1..b09f63639 100644 --- a/installerbuilder/libinstaller/downloadarchivesjob.h +++ b/installerbuilder/libinstaller/downloadarchivesjob.h @@ -49,12 +49,6 @@ class DownloadArchivesJob : public KDJob Q_OBJECT public: - enum Error { - InvalidUrl = KDJob::UserDefinedError, - Timeout, - DownloadError - }; - explicit DownloadArchivesJob(const QByteArray &publicKey, Installer *installer = 0); ~DownloadArchivesJob(); diff --git a/installerbuilder/libinstaller/getrepositoriesmetainfojob.cpp b/installerbuilder/libinstaller/getrepositoriesmetainfojob.cpp index 21a014a02..8357e8931 100644 --- a/installerbuilder/libinstaller/getrepositoriesmetainfojob.cpp +++ b/installerbuilder/libinstaller/getrepositoriesmetainfojob.cpp @@ -31,11 +31,16 @@ ** **************************************************************************/ #include "getrepositoriesmetainfojob.h" + #include "getrepositorymetainfojob.h" +#include "qinstallerglobal.h" using namespace KDUpdater; using namespace QInstaller; + +// -- GetRepositoriesMetaInfoJob + GetRepositoriesMetaInfoJob::GetRepositoriesMetaInfoJob(const QByteArray &publicKey, bool packageManager, QObject *parent) : KDJob(parent), @@ -121,7 +126,7 @@ void GetRepositoriesMetaInfoJob::fetchNextRepo() if (m_tmpRepositories.isEmpty()) { if (m_haveIgnoredError) - emitFinishedWithError(GetRepositoriesMetaInfoJob::UserIgnoreError, m_errorString); + emitFinishedWithError(QInstaller::UserIgnoreError, m_errorString); else emitFinished(); return; @@ -152,14 +157,14 @@ void GetRepositoriesMetaInfoJob::jobFinished(KDJob* j) return; } - if (job->error() == GetRepositoryMetaInfoJob::UserIgnoreError) { + if (job->error() == QInstaller::UserIgnoreError) { m_haveIgnoredError = true; m_errorString = job->errorString(); QMetaObject::invokeMethod(this, "fetchNextRepo", Qt::QueuedConnection); return; } - if (job->error() == GetRepositoryMetaInfoJob::InvalidMetaInfo) { + if (job->error() == QInstaller::InvalidMetaInfo) { emitFinishedWithError(KDJob::UserDefinedError, tr("Error while accessing online " "repository: %1. Please try again later").arg(job->errorString())); return; diff --git a/installerbuilder/libinstaller/getrepositoriesmetainfojob.h b/installerbuilder/libinstaller/getrepositoriesmetainfojob.h index 215b7c0f3..419dcfcce 100644 --- a/installerbuilder/libinstaller/getrepositoriesmetainfojob.h +++ b/installerbuilder/libinstaller/getrepositoriesmetainfojob.h @@ -51,10 +51,6 @@ class INSTALLER_EXPORT GetRepositoriesMetaInfoJob : public KDJob Q_OBJECT public: - enum Error { - UserIgnoreError = KDJob::UserDefinedError + 1 - }; - explicit GetRepositoriesMetaInfoJob(const QByteArray &publicKey, bool packageManager = false, QObject *parent = 0); diff --git a/installerbuilder/libinstaller/getrepositorymetainfojob.cpp b/installerbuilder/libinstaller/getrepositorymetainfojob.cpp index 751132069..f23860aad 100644 --- a/installerbuilder/libinstaller/getrepositorymetainfojob.cpp +++ b/installerbuilder/libinstaller/getrepositorymetainfojob.cpp @@ -37,6 +37,7 @@ #include "cryptosignatureverifier.h" #include "lib7z_facade.h" #include "messageboxhandler.h" +#include "qinstallerglobal.h" #include <KDUpdater/FileDownloader> #include <KDUpdater/FileDownloaderFactory> @@ -56,6 +57,9 @@ using namespace KDUpdater; using namespace QInstaller; + +// -- GetRepositoryMetaInfoJob + GetRepositoryMetaInfoJob::GetRepositoryMetaInfoJob(const QByteArray &publicKey, bool packageManager, QObject *parent) : KDJob(parent), @@ -130,16 +134,16 @@ void GetRepositoryMetaInfoJob::startUpdatesXmlDownload() const QUrl url = m_repository.url(); if (url.isEmpty()) { - emitFinishedWithError(GetRepositoryMetaInfoJob::InvalidUrl, tr("empty repository URL")); + emitFinishedWithError(QInstaller::InvalidUrl, tr("empty repository URL")); return; } if (!url.isValid()) { - emitFinishedWithError(GetRepositoryMetaInfoJob::InvalidUrl, tr("invalid repository URL")); + emitFinishedWithError(QInstaller::InvalidUrl, tr("invalid repository URL")); return; } m_downloader = FileDownloaderFactory::instance().create(url.scheme(), 0, QUrl(), this); if (!m_downloader) { - emitFinishedWithError(GetRepositoryMetaInfoJob::InvalidUrl, tr("URL scheme not supported: %1 (%2)") + emitFinishedWithError(QInstaller::InvalidUrl, tr("URL scheme not supported: %1 (%2)") .arg(url.scheme(), url.toString())); return; } @@ -170,20 +174,20 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() m_temporaryDirectory = createTemporaryDirectory(QLatin1String("remoterepo")); m_tempDirDeleter.add(m_temporaryDirectory); } catch (const QInstaller::Error& e) { - emitFinishedWithError(GetRepositoryMetaInfoJob::ExtractionError, e.message()); + emitFinishedWithError(QInstaller::ExtractionError, e.message()); return; } QFile file(fn); const QString updatesXmlPath = m_temporaryDirectory + QLatin1String("/Updates.xml"); if (!file.rename(updatesXmlPath)) { - emitFinishedWithError(GetRepositoryMetaInfoJob::DownloadError, + emitFinishedWithError(QInstaller::DownloadError, tr("Could not move Updates.xml to target location: %1").arg(file.errorString())); return; } QFile updatesFile(updatesXmlPath); if (!updatesFile.open(QIODevice::ReadOnly)) { - emitFinishedWithError(GetRepositoryMetaInfoJob::DownloadError, + emitFinishedWithError(QInstaller::DownloadError, tr("Could not open Updates.xml for reading: %1").arg(updatesFile.errorString())); return; } @@ -210,11 +214,11 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() } if (b == QMessageBox::Ok) { - emitFinishedWithError(GetRepositoryMetaInfoJob::UserIgnoreError, tr("Could not fetch " + emitFinishedWithError(QInstaller::UserIgnoreError, tr("Could not fetch " "Updates.xml: %1").arg(err)); return; } - // emitFinishedWithError(GetRepositoryMetaInfoJob::InvalidMetaInfo, + // emitFinishedWithError(QInstaller::InvalidMetaInfo, // tr("Could not parse component index: %1:%2: %3").arg(QString::number(line), // QString::number(col), err)); } @@ -257,7 +261,7 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadError(const QString &err) if (!m_repository.required()) { emit infoMessage(this, tr("Could not fetch Updates.xml from repository: %1") .arg(m_repository.url().toString())); - emitFinishedWithError(GetRepositoryMetaInfoJob::UserIgnoreError, tr("Could not fetch " + emitFinishedWithError(QInstaller::UserIgnoreError, tr("Could not fetch " "Updates.xml: %1").arg(err)); verbose() << "Could not fetch Updates.xml from: " << m_repository.url().toString() << std::endl; return; @@ -280,7 +284,7 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadError(const QString &err) } if (b == QMessageBox::Ok) { - emitFinishedWithError(GetRepositoryMetaInfoJob::UserIgnoreError, tr("Could not fetch " + emitFinishedWithError(QInstaller::UserIgnoreError, tr("Could not fetch " "Updates.xml: %1").arg(err)); return; } @@ -368,7 +372,7 @@ void GetRepositoryMetaInfoJob::metaDownloadFinished() QFile arch(fn); if (!arch.open(QIODevice::ReadOnly)) { - emitFinishedWithError(GetRepositoryMetaInfoJob::ExtractionError, + emitFinishedWithError(QInstaller::ExtractionError, tr("Could not open meta info archive %1: %2").arg(fn, arch.errorString())); return; } @@ -393,7 +397,7 @@ void GetRepositoryMetaInfoJob::metaDownloadFinished() if (!arch.remove()) qWarning("Could not delete file %s: %s", qPrintable(fn), qPrintable(arch.errorString())); } catch (const Lib7z::SevenZipException& e) { - emitFinishedWithError(GetRepositoryMetaInfoJob::ExtractionError, + emitFinishedWithError(QInstaller::ExtractionError, tr("Could not open meta info archive %1: %2").arg(fn, e.message())); return; } @@ -413,7 +417,7 @@ void GetRepositoryMetaInfoJob::metaDownloadError(const QString &err) if (!m_repository.required()) { emit infoMessage(this, tr("Could not download information for component %1: %2") .arg(m_currentPackageName, err)); - emitFinishedWithError(GetRepositoryMetaInfoJob::UserIgnoreError, tr("Could not download " + emitFinishedWithError(QInstaller::UserIgnoreError, tr("Could not download " "information for component %1: %2").arg(m_currentPackageName, err)); verbose() << QString::fromLatin1("Could not download information for component %1: %2") .arg(m_currentPackageName, err) << std::endl; @@ -439,7 +443,7 @@ void GetRepositoryMetaInfoJob::metaDownloadError(const QString &err) } if (b == QMessageBox::Ok) { - emitFinishedWithError(GetRepositoryMetaInfoJob::UserIgnoreError, tr("%1").arg(err)); + emitFinishedWithError(QInstaller::UserIgnoreError, tr("%1").arg(err)); return; } } diff --git a/installerbuilder/libinstaller/getrepositorymetainfojob.h b/installerbuilder/libinstaller/getrepositorymetainfojob.h index a428f3b20..56cce9b16 100644 --- a/installerbuilder/libinstaller/getrepositorymetainfojob.h +++ b/installerbuilder/libinstaller/getrepositorymetainfojob.h @@ -51,15 +51,6 @@ class INSTALLER_EXPORT GetRepositoryMetaInfoJob : public KDJob friend class ::QInstaller::GetRepositoriesMetaInfoJob; public: - enum Error { - InvalidUrl = KDJob::UserDefinedError, - DownloadError, - InvalidUpdatesXml, - InvalidMetaInfo, - ExtractionError, - UserIgnoreError - }; - explicit GetRepositoryMetaInfoJob(const QByteArray &publicKey = QByteArray(), bool packageManager = false, QObject *parent = 0); ~GetRepositoryMetaInfoJob(); diff --git a/installerbuilder/libinstaller/qinstaller.cpp b/installerbuilder/libinstaller/qinstaller.cpp index 7eedc940c..650bcb52f 100644 --- a/installerbuilder/libinstaller/qinstaller.cpp +++ b/installerbuilder/libinstaller/qinstaller.cpp @@ -699,7 +699,7 @@ bool Installer::fetchAllPackages() QScopedPointer <GetRepositoriesMetaInfoJob> metaInfoJob(fetchMetaInformation(*d->m_installerSettings)); if (metaInfoJob->isCanceled() || metaInfoJob->error() != KDJob::NoError) { - if (metaInfoJob->error() != GetRepositoriesMetaInfoJob::UserIgnoreError) { + if (metaInfoJob->error() != QInstaller::UserIgnoreError) { verbose() << tr("Could not retrieve updates: %1").arg(metaInfoJob->errorString()) << std::endl; return false; } @@ -797,7 +797,7 @@ bool Installer::fetchUpdaterPackages() QScopedPointer <GetRepositoriesMetaInfoJob> metaInfoJob(fetchMetaInformation(*d->m_installerSettings)); if (metaInfoJob->isCanceled() || metaInfoJob->error() != KDJob::NoError) { - if (metaInfoJob->error() != GetRepositoriesMetaInfoJob::UserIgnoreError) { + if (metaInfoJob->error() != QInstaller::UserIgnoreError) { verbose() << tr("Could not retrieve updates: %1").arg(metaInfoJob->errorString()) << std::endl; return false; } |