#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
+#include "zypp/base/Algorithm.h"
+#include "zypp/ResPool.h"
+#include "zypp/ResFilters.h"
+#include "zypp/CapFilters.h"
#include "zypp/solver/detail/ProblemSolutionUnlock.h"
using namespace std;
//---------------------------------------------------------------------------
-ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent)
+struct LockReset : public resfilter::PoolItemFilterFunctor
+{
+ ProblemSolutionUnlock & _problemSolutionUnlock;
+ LockReset( ProblemSolutionUnlock & solution )
+ : _problemSolutionUnlock( solution )
+ { }
+
+ bool operator()( PoolItem_Ref item )
+ {
+ _problemSolutionUnlock.addAction ( new TransactionSolutionAction (item, UNLOCK));
+ return true;
+ }
+};
+
+
+ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent,
+ const ResPool & pool)
: ProblemSolution (parent, "", "")
{
_description = _("unlock all resolvables");
-#warning implementation of unlocking ALL items
+ LockReset lockReset (*this);
+
+ invokeOnEach ( pool.begin(), pool.end(),
+ resfilter::ByLock( ),
+ functor::functorRef<bool,PoolItem>(lockReset));
}
ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent,
**/
ProblemSolutionUnlock( ResolverProblem_Ptr parent, PoolItem_Ref item);
ProblemSolutionUnlock( ResolverProblem_Ptr parent, PoolItemList & itemlist);
- ProblemSolutionUnlock( ResolverProblem_Ptr parent);
+ ProblemSolutionUnlock( ResolverProblem_Ptr parent, const ResPool & pool);
};
///////////////////////////////////////////////////////////////////
if (it->second.matches (misc_info->capability()) == CapMatch::yes) {
// unlock this item
problem->addSolution (new ProblemSolutionUnlock (problem, it->first));
+ // unlock ALL existing resolvables
+ problem->addSolution (new ProblemSolutionUnlock (problem, pool()));
}
}
// Searching for another item which provides this requires BUT has another architec
ResolverProblem_Ptr problem = new ResolverProblem (what, details);
problem->addSolution (new ProblemSolutionUnlock (problem, item)); // Unlocking resItem
+ // unlock ALL existing resolvables
+ problem->addSolution (new ProblemSolutionUnlock (problem, pool()));
if (misc_info->trigger() == ResolverInfoMisc::OBSOLETE) {
// Ignore obsoletes
problem->addSolution (new ProblemSolutionIgnoreObsoletes (problem, item, misc_info->capability(),