From c0cee088ebe9b1265200dbf74a26e1685c48e4f7 Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 7 Aug 2013 15:47:00 +0200 Subject: Make it possible to filter repositories not matching the license. Change-Id: I8ca36004394778ecd680636b36bfeafe8fcd1ff8 Reviewed-by: Niels Weber Reviewed-by: Iikka Eklund Reviewed-by: Kai Koehne --- src/libs/installer/getrepositoriesmetainfojob.cpp | 4 +++- src/libs/installer/productkeycheck.cpp | 7 +++++++ src/libs/installer/productkeycheck.h | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/libs/installer') diff --git a/src/libs/installer/getrepositoriesmetainfojob.cpp b/src/libs/installer/getrepositoriesmetainfojob.cpp index 98840b6b0..c4564e781 100644 --- a/src/libs/installer/getrepositoriesmetainfojob.cpp +++ b/src/libs/installer/getrepositoriesmetainfojob.cpp @@ -42,6 +42,7 @@ #include "getrepositoriesmetainfojob.h" #include "getrepositorymetainfojob.h" +#include "productkeycheck.h" #include "packagemanagercore_p.h" #include @@ -120,8 +121,9 @@ void GetRepositoriesMetaInfoJob::doStart() { if ((m_core->isInstaller() && !m_core->isOfflineOnly()) || (m_core->isUpdater() || m_core->isPackageManager())) { + const ProductKeyCheck *const productKeyCheck = ProductKeyCheck::instance(m_core); foreach (const Repository &repo, m_core->settings().repositories()) { - if (repo.isEnabled()) + if (repo.isEnabled() && productKeyCheck->isValidRepository(repo)) m_repositories += repo; } } diff --git a/src/libs/installer/productkeycheck.cpp b/src/libs/installer/productkeycheck.cpp index fe1fd10af..a4af2b6d3 100644 --- a/src/libs/installer/productkeycheck.cpp +++ b/src/libs/installer/productkeycheck.cpp @@ -88,3 +88,10 @@ bool ProductKeyCheck::isValidLicenseTextFile(const QString &/*fileName*/) { return true; } + + +bool ProductKeyCheck::isValidRepository(const QInstaller::Repository &repository) const +{ + Q_UNUSED(repository) + return true; +} \ No newline at end of file diff --git a/src/libs/installer/productkeycheck.h b/src/libs/installer/productkeycheck.h index d472d9288..6d72089e2 100644 --- a/src/libs/installer/productkeycheck.h +++ b/src/libs/installer/productkeycheck.h @@ -38,6 +38,7 @@ namespace QInstaller{ class PackageManagerCore; + class Repository; } class ProductKeyCheckPrivate; @@ -60,6 +61,9 @@ public: // to filter none valid licenses bool isValidLicenseTextFile(const QString &fileName); + // to filter repositories not matching the license + bool isValidRepository(const QInstaller::Repository &repository) const; + private: ProductKeyCheck(); ProductKeyCheckPrivate *const d; -- cgit v1.2.3