Index: src/packagekit/packagekit_updater.cpp
===================================================================
--- src/packagekit/packagekit_updater.cpp.orig
+++ src/packagekit/packagekit_updater.cpp
@@ -28,6 +28,7 @@
 #include <QTimer>
 #include <QMessageBox>
 #include <QDir>
+#include <QXmlStreamReader>
 #include <KGlobal>
 #include <KGenericFactory>
 #include <k3process.h>
@@ -36,11 +37,17 @@
 #include <KMessageBox>
 #include <KConfig>
 #include <kstandarddirs.h>
+#include <kio/job.h>
 
 #include "packagekit_updater.h"
 #include "constants.h"
 #include "mainwindow.h"
 
+#define typeof __typeof__
+#include <zypp/RepoManager.h>
+#include <zypp/RepoInfo.h>
+#include <zypp/Url.h>
+
 K_EXPORT_COMPONENT_FACTORY( kupdateapplet_packagekit, KGenericFactory<PackageKitUpdater>( "kupdateapplet_packagekit" ) )
 
 #define ASSERT_LISTS_VALID if ( !_patchList || !_packageList || !_driverList ) { kDebug() << "FATAL: some lists is not valid"; return; }
@@ -52,6 +59,7 @@ PackageKitUpdater::PackageKitUpdater( QO
 	, _securityAvailable (false)
         , _driverSearch(false)
         , _get_packages_mutex(new QMutex(QMutex::Recursive))
+	, _remainingJobsCount(0)
 {
 	// For ease announce that we have been loaded.
 	kDebug() << "PackageKit plugin loaded";
@@ -147,12 +155,6 @@ PackageKitUpdater::PackageKitUpdater( QO
 	);
 
 	connect(pkConnector,
-		SIGNAL(RepoDetail(const QString& , const QString&, bool)),
-		this,
-		SLOT(slotRepoDetail(const QString& , const QString&, bool))
-	);
-
-	connect(pkConnector,
 		SIGNAL(UpdateDetail(const QString&, const QString&, const QString&, const QString&,
                 const QString&, const QString&, const QString&, const QString&,
       		const QString&, const QString&, const QString&, const QString&)),
@@ -180,12 +182,6 @@ PackageKitUpdater::PackageKitUpdater( QO
 		SLOT(slotDistroUpgrade( const QString &, const QString &, const QString &))
 	);
 
-	connect(pkConnector,
-		SIGNAL(RepoListFinished()),
-		this,
-		SLOT(slotUpdaterRepoSearchFinished())
-	);
-
 
 }
 
@@ -355,10 +351,53 @@ void PackageKitUpdater::slotInstallFinis
 	}
 }
 
+bool PackageKitUpdater::isUpdateRepository(const QByteArray &repomdxmlContents)
+{
+	QXmlStreamReader reader(repomdxmlContents);
+	while ( !reader.atEnd() )
+		if ( reader.readNextStartElement()
+		  && reader.name() == "data"
+		  && reader.attributes().value("type").toString() == "updateinfo" )
+			return true;
+
+	return false;
+}
+
+
+
+void PackageKitUpdater::slotProcessRepomdContents(KJob *job_)
+{
+	KIO::StoredTransferJob *job=static_cast<KIO::StoredTransferJob *>(job_);
+	QString url=job->url().prettyUrl();
+	kDebug() << "Finished downloading " << url;
+
+	if ( job->error() )
+	{
+		kDebug() << "Error downloading " << job->errorString();
+		if (_repoSeemsUpdate[url]) 
+			kDebug() << "Error downloading repomd.xml file but " << url << " looks like an update repo based on its alias/name";
+	}
+        else
+	{
+		QByteArray contents = job->data();
+		_isUpdateRepository[url] = isUpdateRepository(contents);
+	        if (_isUpdateRepository[url])
+			kDebug() << "Found an update repository in " << url;
+	}
+
+        if (--_remainingJobsCount==0)
+        {
+		slotRepomdFilesDownloaded();
+		return;
+        }
+}
 
-void PackageKitUpdater::slotUpdaterRepoSearchFinished()
+void PackageKitUpdater::slotRepomdFilesDownloaded()
 {
-        kDebug() << "finished search for update repositories";
+	kDebug() << "finished downloading all repomd.xml files";
+	_updateRepoAvailable=_isUpdateRepository.values().contains(true) ||
+			     _repoSeemsUpdate.values().contains(true);
+
 	if (!_updateRepoAvailable)
         {
             kDebug() << "no update repositories defined";
@@ -486,15 +525,50 @@ void PackageKitUpdater::slotShowLog()
 {
 }
 
-
 void PackageKitUpdater::doCheckForUpdateRepos()
 {
-        kDebug() << "try to get repolist";
-	_updateRepoAvailable=false;
-	pkConnector->getRepoList();
+        QMap<QString, bool> newCache;
+	zypp::RepoManager repoManager;
+	std::list<zypp::RepoInfo> repoList = repoManager.knownRepositories();
+	for ( std::list<zypp::RepoInfo>::const_iterator it = repoList.begin() ; it != repoList.end() ; ++it )
+	{
+                zypp::Url url = it->url();
+                url.setPathName( url.getPathName() + "/repodata/repomd.xml" );
+                if (url.getScheme()=="dir") url.setScheme("file");
+                QString urlString = QString::fromStdString( url.asString() );
+                // urlString now contains the url of the repomd.xml file for the current repository
+
+                // See if we already have a cached result
+                if ( _isUpdateRepository.contains(urlString) )
+                {
+                        newCache[urlString]=_isUpdateRepository[urlString];
+                        continue;
+                }
+                QString alias = QString::fromStdString( it->alias() );
+                QString name = QString::fromStdString( it->name() );
+
+
+                if ((alias.contains("update", Qt::CaseInsensitive)) ||
+                    (alias.contains("patch", Qt::CaseInsensitive)) ||
+                    (name.contains("update", Qt::CaseInsensitive)) ||
+                    (name.contains("patch", Qt::CaseInsensitive)))
+                        _repoSeemsUpdate[urlString]=true;
+
+                // We don't, so let's download the file
+                KIO::StoredTransferJob *job=KIO::storedGet(urlString, KIO::NoReload, KIO::HideProgressInfo);
+                connect(job, SIGNAL(result(KJob *)), this, SLOT(slotProcessRepomdContents(KJob *)));
+                _remainingJobsCount++;
+        }
+
+        _isUpdateRepository=newCache; //This cleans the cache from old repositories that have been deleted
+
+	// In case there's nothing to do, just pretend everything has been downloaded
+        if (_remainingJobsCount==0)
+		slotRepomdFilesDownloaded();
 }
 
 
+
 void PackageKitUpdater::doCheckForUpdates()
 {
 	_get_packages_mutex->lock();
@@ -746,16 +820,6 @@ bool PackageKitUpdater::checkRegistratio
         return false;
 }
 
-
-void PackageKitUpdater::slotRepoDetail(const QString &repo_id, const QString &desc, bool enabled)
-{
-	if (	enabled && 
-		(repo_id.contains("update", Qt::CaseInsensitive) ||
-		desc.contains("update", Qt::CaseInsensitive)  ) )
-	_updateRepoAvailable=true;
-
-}
-
 void PackageKitUpdater::slotRequireRestart(const QString& type, const QString& details)
 {
 	kDebug() << "RequireRestart" << type << ": " << details;
Index: src/packagekit/CMakeLists.txt
===================================================================
--- src/packagekit/CMakeLists.txt.orig
+++ src/packagekit/CMakeLists.txt
@@ -14,12 +14,13 @@ set(kupdateapplet_packagekit_PART_SRCS
 
 include(FindPkgConfig)
 pkg_check_modules(POLKIT polkit-dbus)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
 
-include_directories( ${POLKIT_INCLUDE_DIRS})
+include_directories( ${POLKIT_INCLUDE_DIRS} ${QT_QTXML_INCLUDE_DIR})
 
 
 kde4_add_plugin(kupdateapplet_packagekit ${kupdateapplet_packagekit_PART_SRCS})
-target_link_libraries(kupdateapplet_packagekit kupdateapplet ${KDE4_SOLID_LIBRARY} polkit-grant polkit dbus-1 polkit-dbus ${KDE4_KIO_LIBS})
+target_link_libraries(kupdateapplet_packagekit kupdateapplet ${KDE4_SOLID_LIBRARY} polkit-grant polkit dbus-1 polkit-dbus ${KDE4_KIO_LIBS} ${QT_QTXML_LIBRARY} ${ZYPP_LIBRARY})
 install(TARGETS kupdateapplet_packagekit DESTINATION ${PLUGIN_INSTALL_DIR} )
 
 ########### install files ###############
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -33,6 +33,7 @@ include(CPack)
 find_package(KDE4 REQUIRED)
 include (KDE4Defaults)
 find_package(Gettext REQUIRED)
+find_package(Zypp REQUIRED)
 
 MESSAGE(STATUS "$LIB is ${LIB}" )
 # Library
Index: src/packagekit/packagekit_updater.h
===================================================================
--- src/packagekit/packagekit_updater.h.orig
+++ src/packagekit/packagekit_updater.h
@@ -25,7 +25,9 @@
 #include <QtCore/QList>
 #include <QProcess>
 #include <QMutex>
+#include <QMap>
 #include <QStringList>
+#include <kio/jobclasses.h>
 #include "qpackagekitconnector.h"
 class QPackageKitConnector;
 
@@ -88,14 +90,21 @@ public slots:
                 const QString &key_fingerprint, const QString &key_timestamp, const QString &type);
 
 	void slotStatusChanged( const QString &status );
-	void slotRepoDetail(const QString &repo_id, const QString &desc, bool enabled);
 	void slotUpdateDetail(const QString &package_id, const QString &updates, const QString &obsoletes, const QString &vendor_url,
                 const QString &bugzilla_url, const QString &cve_url, const QString &restart, const QString &update_text,
                 const QString &changelog, const QString &state, const QString &issued, const QString &updated );
 
 	void slotCheckDistroUpgrade();
 	void slotDistroUpgrade( const QString &type, const QString &name, const QString &details );
-	void slotUpdaterRepoSearchFinished();
+
+	/**
+	 * Slot called after a repomd.xml file is downloaded  to process its contents
+	 */
+	void slotProcessRepomdContents(KJob *job_);
+	/**
+	 * Slot called after all repomd.xml files have been downloaded
+	 */
+	void slotRepomdFilesDownloaded();
 
 
 protected slots:
@@ -108,6 +117,10 @@ private:
 	void doCheckForUpdates();
 	void doCheckForDrivers();
 	void doCheckForFirmware();
+	/**
+	 * Starts kio jobs to download the repomd.xml file for each configured repository and check
+	 * if there is an update repository or not
+	 */
 	void doCheckForUpdateRepos();
 	QPackageKitConnector* pkConnector ;
 
@@ -137,6 +150,30 @@ private:
 
 	QStringList _packageDetailsList;
 	int _missing_details;
+
+
+	/**
+	 * Analyzes the contents of a repomd.xml file (in @p repomdxmlContents)
+	 * @returns if it's an update repository or not
+	 */
+	static bool isUpdateRepository(const QByteArray &repomdxmlContents);
+	/**
+         * Stores a cache of the information downloaded from the
+	 * repositories' repomd.xml files. For each repomd.xml url
+	 * it stores if it's an update repository or not
+	 */
+        QMap<QString, bool> _isUpdateRepository;
+	/**
+         * Stores a cache of the repository information extracted from 
+	 * its alias or name. For each repomd.xml url it stores if
+         * the repository alias or name contains "Update" or "Patch"
+	 */
+        QMap<QString, bool> _repoSeemsUpdate;
+	/**
+	 * The count of kio jobs created to download repomd.xml files that
+	 * haven't finished yet
+	 */
+        int _remainingJobsCount;
 };
 
 #endif
