41 #define YUILogComponent "ncurses-pkg"
44 #include "NCPkgFilterClassification.h"
47 #include "NCLayoutBox.h"
48 #include "NCSpacing.h"
49 #include "NCPackageSelector.h"
69 NCPkgFilterClassification::NCPkgFilterClassification( YWidget *parent,
NCPackageSelector *pkg )
70 :NCSelectionBox( parent,
"" )
74 recommended =
new YItem( _(
"Recommended") );
75 addItem( recommended );
77 suggested =
new YItem( _(
"Suggested") );
80 orphaned =
new YItem( _(
"Orphaned") );
83 unneeded =
new YItem( _(
"Unneeded" ) );
92 int index = getCurrentItem();
94 return itemAt( index );
100 NCPkgTable * packageList = packager->PackageList();
109 yuiError() <<
"No valid NCPkgTable widget" << endl;
117 for ( ZyppPoolIterator it = zyppPkgBegin();
121 ZyppSel selectable = *it;
132 check( selectable, tryCastToZyppPkg( selectable->candidateObj() ), group ) ||
133 check( selectable, tryCastToZyppPkg( selectable->installedObj() ), group );
139 ! selectable->candidateObj() &&
140 ! selectable->installedObj() )
141 check( selectable, tryCastToZyppPkg( selectable->theObj() ), group );
145 packageList->setCurrentItem( 0 );
149 yuiMilestone() <<
"Filling package list \"" << group->label() <<
"\"" << endl;
154 bool NCPkgFilterClassification::check( ZyppSel selectable, ZyppPkg pkg, YItem * group )
156 NCPkgTable * packageList = packager->PackageList();
160 yuiError() <<
"No valid package table widget" << endl;
164 if ( group == recommended &&
165 zypp::PoolItem(pkg).status().isRecommended() )
170 if ( group == suggested &&
171 zypp::PoolItem(pkg).status().isSuggested() )
176 if ( group == orphaned &&
177 zypp::PoolItem(pkg).status().isOrphaned() )
182 if ( group == unneeded &&
183 zypp::PoolItem(pkg).status().isUnneeded() )
193 void NCPkgFilterClassification::showDescription( )
195 std::string description;
199 if ( group == recommended )
201 description = _(
"This is a list of useful packages. They will be additionally installed if recommeded by a newly installed package. To get packages recommeded by already installed packages the option <b>Install Recommended Packages for Already Installed Packages</b> from <b>Dependencies</b> menu has to be set.");
203 else if ( group == suggested )
205 description = _(
"It's suggested to install these packages because they fit to already installed packages. The decision to install it is by the user.");
207 else if ( group == orphaned )
209 description = _(
"The solver has detected that these packages are without a repository, i.e. updates aren't possible.");
211 else if ( group == unneeded )
213 description = _(
"These packages might be unneeded because former dependencies don't apply any longer.");
215 packager->FilterDescription()->setText ( description );
227 NCursesEvent NCPkgFilterClassification::wHandleInput( wint_t ch )
229 NCursesEvent ret = NCursesEvent::none;
240 ret = NCursesEvent::handled;
247 ret = NCSelectionBox::wHandleInput( ch ) ;