41 #define YUILogComponent "ncurses-pkg" 44 #include "NCPkgFilterRepo.h" 47 #include "NCLayoutBox.h" 48 #include "NCSpacing.h" 49 #include "NCPackageSelector.h" 69 : YTableCell(
std::string(
" "))
84 NCPkgRepoTable::NCPkgRepoTable( YWidget *parent, YTableHeader *tableHeader,
NCPackageSelector *pkg )
85 :NCTable( parent, tableHeader )
101 void NCPkgRepoTable::fillHeader()
103 std::vector <std::string> header;
106 header.push_back(
"L" );
107 header.push_back(
"L" + NCPkgStrings::PkgName() );
124 YTableItem *tabItem =
new YTableItem();
130 for (
const std::string& s: cols )
152 NCTableLine *line = myPad()->ModifyLine( index );
158 YTableItem *it =
dynamic_cast<YTableItem*
> (line->origItem() );
161 YTableCell *tcell = it->cell(0);
190 std::string NCPkgRepoTable::showDescription( ZyppRepo r)
192 std::string ret =
"";
194 if ( r.isSystemRepo())
195 ret = _(
"<b>@System</b>: local RPM database" );
198 std::string label = _(
"<b>Repository URL:</b>" );
200 if ( ! r.info().baseUrlsEmpty() )
201 srcUrl = *(r).info().baseUrlsBegin();
203 ret = label + srcUrl.asString();
220 yuiMilestone() <<
"Filling repository list" << endl;
222 std::vector <std::string> oneLine;
225 for ( ZyppRepositoryIterator it = ZyppRepositoriesBegin();
226 it != ZyppRepositoriesEnd();
238 std::string name = (*it).info().name();
240 oneLine.push_back( name );
247 bool NCPkgRepoTable::showRepoPackages()
249 int index = getCurrentItem();
250 ZyppRepo repo =
getRepo( index );
252 yuiMilestone() <<
"Selected repository " << repo.info().alias().c_str() << endl;
253 yuiMilestone() <<
"Collecting packages in selected repository" << endl;
255 NCPkgTable *pkgList = packager->PackageList();
260 q.addRepo( repo.info().alias() );
261 q.addKind( zypp::ResKind::package );
263 for ( zypp::PoolQuery::Selectable_iterator it = q.selectableBegin();
264 it != q.selectableEnd(); it++)
266 ZyppPkg pkg = tryCastToZyppPkg( (*it)->theObj() );
270 packager->FilterDescription()->setText( showDescription( repo ) );
272 pkgList->setCurrentItem( 0 );
294 zypp::ResPool::byKind_iterator beg = zypp::ResPool::instance().byKindBegin( zypp::ResKind::product);
295 zypp::ResPool::byKind_iterator end = zypp::ResPool::instance().byKindEnd( zypp::ResKind::product);
297 while( beg != end && !product )
300 if ( beg->resolvable()->repoInfo().alias() == repo.info().alias() )
301 product = zypp::asKind<zypp::Product>( beg->resolvable() );
307 if ( beg->resolvable()->repoInfo().alias() == repo.info().alias() )
310 yuiWarning() <<
"Multiple products in repository " <<
311 repo.info().alias().c_str() << endl;
322 yuiMilestone() <<
"No product in repository " <<
323 repo.info().alias().c_str() << endl;
338 NCursesEvent NCPkgRepoTable::wHandleInput( wint_t ch )
340 NCursesEvent ret = NCursesEvent::none;
351 ret = NCursesEvent::handled;
356 ret = NCTable::wHandleInput( ch );
bool showInformation()
Show the corresponding information (e.g.
ZyppProduct findProductForRepo(ZyppRepo repo)
Find single zypp::Product for this repository (null product if multiple products found) ...
ZyppRepo getRepo(int index)
Get repository reference from selected line's tag.
NCPkgRepoTag * getTag(const int &index)
Get tag of repository table line on current index, ( contains repository reference) ...
bool createListEntry(ZyppPkg pkgPtr, ZyppSel slbPtr)
Creates a line in the package table.
NCPkgRepoTag(ZyppRepo repo)
A helper class to hold a reference to zypp::Repository for each repository table line (actually it's ...
bool fillRepoList()
Add items to the repository list (assoc.
virtual void itemsCleared()
Clears the package list.
virtual void addLine(ZyppRepo r, const std::vector< std::string > &cols)
Add one line (with tag) to the repositories table.
void drawList()
Draws the package list (has to be called after the loop with addLine() calls)