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;
116 for ( ZyppPoolIterator it = zyppPkgBegin();
120 ZyppSel selectable = *it;
126 if ( selectable->installedObj() )
128 match = check( selectable, tryCastToZyppPkg( selectable->installedObj() ), group );
134 zypp::ui::Selectable::picklist_iterator it = selectable->picklistBegin();
135 while ( it != selectable->picklistEnd() && !match )
137 check( selectable, tryCastToZyppPkg( *it ), group );
144 packageList->setCurrentItem( 0 );
148 yuiMilestone() <<
"Filling package list \"" << group->label() <<
"\"" << endl;
153 bool NCPkgFilterClassification::check( ZyppSel selectable, ZyppPkg pkg, YItem * group )
155 NCPkgTable * packageList = packager->PackageList();
158 yuiDebug() << zypp::PoolItem(pkg) << endl;
160 if ( !packageList || !selectable || !pkg )
162 yuiError() <<
"No valid data" << endl;
166 if ( group == recommended &&
167 zypp::PoolItem(pkg).status().isRecommended() )
172 if ( group == suggested &&
173 zypp::PoolItem(pkg).status().isSuggested() )
178 if ( group == orphaned &&
179 zypp::PoolItem(pkg).status().isOrphaned() )
184 if ( group == unneeded &&
185 zypp::PoolItem(pkg).status().isUnneeded() )
195 void NCPkgFilterClassification::showDescription( )
197 std::string description;
201 if ( group == recommended )
203 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.");
205 else if ( group == suggested )
207 description = _(
"It's suggested to install these packages because they fit to already installed packages. The decision to install it is by the user.");
209 else if ( group == orphaned )
211 description = _(
"The solver has detected that these packages are without a repository, i.e. updates aren't possible.");
213 else if ( group == unneeded )
215 description = _(
"These packages might be unneeded because former dependencies don't apply any longer.");
217 packager->FilterDescription()->setText ( description );
229 NCursesEvent NCPkgFilterClassification::wHandleInput( wint_t ch )
231 NCursesEvent ret = NCursesEvent::none;
242 ret = NCursesEvent::handled;
249 ret = NCSelectionBox::wHandleInput( ch ) ;
bool showPackages()
Fill package list.
bool showInformation()
Show the corresponding information (e.g.
bool createListEntry(ZyppPkg pkgPtr, ZyppSel slbPtr)
Creates a line in the package table.
YItem * getCurrentGroup()
Get currently selected package group item.
virtual void itemsCleared()
Clears the package list.
void drawList()
Draws the package list (has to be called after the loop with addLine() calls)