00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <sstream>
00026
00027 #include "zypp/base/String.h"
00028 #include "zypp/base/Gettext.h"
00029 #include "zypp/solver/detail/ProblemSolutionUninstall.h"
00030 #include "zypp/solver/detail/ResolverInfo.h"
00031
00032 using namespace std;
00033
00035 namespace zypp
00036 {
00037
00038 namespace solver
00039 {
00040
00041 namespace detail
00042 {
00043
00044 IMPL_PTR_TYPE(ProblemSolutionUninstall);
00045
00046
00047 ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItem_Ref item,
00048 const std::string & descr,
00049 const std::string & detail)
00050 : ProblemSolution (parent, descr, detail)
00051 {
00052 addAction ( new TransactionSolutionAction (item, REMOVE));
00053 }
00054
00055
00056
00057 ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent,
00058 PoolItem_Ref item)
00059 : ProblemSolution (parent, "", "")
00060 {
00061 ResStatus status = item.status();
00062 if (status.isInstalled()) {
00063
00064 _description = str::form (_("delete %s"), item->name().c_str() );
00065
00066 _details = str::form (_("delete %s"), ResolverInfo::toString (item).c_str());
00067 } else {
00068
00069 _description = str::form (_("do not install %s"), item->name().c_str() );
00070
00071 _details = str::form (_("do not install %s"), ResolverInfo::toString (item).c_str());
00072 }
00073
00074 addAction ( new TransactionSolutionAction (item, REMOVE));
00075 }
00076
00077 ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent,
00078 PoolItemList & itemlist)
00079 : ProblemSolution (parent, "", "")
00080 {
00081 _description = _("Do not install or delete concerning resolvables");
00082
00083 for (PoolItemList::iterator iter = itemlist.begin();
00084 iter != itemlist.end(); iter++) {
00085 PoolItem_Ref item = *iter;
00086 addAction ( new TransactionSolutionAction (item, REMOVE));
00087 }
00088
00089 ostringstream details;
00090 details << _actions;
00091 _details = details.str();
00092 }
00093
00095 };
00098 };
00101 };