2 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
5 * Easy-to use interface to the ZYPP dependency resolver
7 * Copyright (C) 2000-2002 Ximian, Inc.
8 * Copyright (C) 2005 SUSE Linux Products GmbH
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27 #include "zypp/base/String.h"
28 #include "zypp/base/Gettext.h"
29 #include "zypp/base/Algorithm.h"
30 #include "zypp/ResPool.h"
31 #include "zypp/ResFilters.h"
32 #include "zypp/solver/detail/ProblemSolutionUnlock.h"
36 /////////////////////////////////////////////////////////////////////////
38 { ///////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////
41 { /////////////////////////////////////////////////////////////////////
42 /////////////////////////////////////////////////////////////////////
44 { ///////////////////////////////////////////////////////////////////
46 IMPL_PTR_TYPE(ProblemSolutionUnlock);
48 //---------------------------------------------------------------------------
50 struct LockReset : public resfilter::PoolItemFilterFunctor
52 ProblemSolutionUnlock & _problemSolutionUnlock;
53 LockReset( ProblemSolutionUnlock & solution )
54 : _problemSolutionUnlock( solution )
57 bool operator()( PoolItem item )
59 _problemSolutionUnlock.addAction ( new TransactionSolutionAction (item, UNLOCK));
65 ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent,
67 : ProblemSolution (parent, "", "")
69 _description = _("unlock all resolvables");
70 LockReset lockReset (*this);
72 invokeOnEach ( pool.begin(), pool.end(),
74 functor::functorRef<bool,PoolItem>(lockReset));
77 ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent,
79 : ProblemSolution (parent, "", "")
81 // TranslatorExplanation %s = name of package, patch, selection ...
82 _description = str::form (_("unlock %s"), item->name().c_str() );
84 addAction ( new TransactionSolutionAction (item, UNLOCK));
87 ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent,
88 PoolItemList & itemlist)
89 : ProblemSolution (parent, "", "")
91 _description = _("Unlock these resolvables");
93 for (PoolItemList::iterator iter = itemlist.begin();
94 iter != itemlist.end(); iter++) {
95 PoolItem item = *iter;
96 addAction ( new TransactionSolutionAction (item, UNLOCK));
99 ostringstream details;
101 _details = details.str();
104 ///////////////////////////////////////////////////////////////////
105 };// namespace detail
106 /////////////////////////////////////////////////////////////////////
107 /////////////////////////////////////////////////////////////////////
108 };// namespace solver
109 ///////////////////////////////////////////////////////////////////////
110 ///////////////////////////////////////////////////////////////////////
112 /////////////////////////////////////////////////////////////////////////