41 #define YUILogComponent "ncurses-pkg"
44 #include "NCPkgMenuFilter.h"
45 #include "NCPkgPatchSearch.h"
46 #include "NCPkgTable.h"
47 #include "NCPackageSelector.h"
55 NCPkgMenuFilter::NCPkgMenuFilter (YWidget *parent, std::string label,
NCPackageSelector *pkger)
56 : NCMenuButton( parent, label)
62 NCPkgMenuFilter::~NCPkgMenuFilter()
67 void NCPkgMenuFilter::createLayout()
72 needed =
new YMenuItem( _(
"&Needed Patches" ) );
74 unneeded =
new YMenuItem( _(
"&Installed Patches" ) );
76 recommended =
new YMenuItem( _(
"&Recommended" ) );
77 security =
new YMenuItem( _(
"&Security" ) );
78 optional =
new YMenuItem( _(
"&Optional" ) );
79 allPatches =
new YMenuItem( _(
"&All Patches" ) );
81 search =
new YMenuItem( _(
"S&earch" ) );
83 items.push_back( needed );
84 items.push_back( unneeded );
85 items.push_back( recommended );
86 items.push_back( security );
87 items.push_back( optional );
88 items.push_back( allPatches );
89 items.push_back( search );
95 bool NCPkgMenuFilter::handleEvent (
const NCursesEvent & event)
97 if ( !event.selection)
99 yuiError() <<
"Menu selection failed" << endl;
107 yuiError() <<
"No package list available" << endl;
111 yuiMilestone() <<
"Handle event NCPkgMenuFilter" << endl;
116 if ( event.selection == needed )
118 else if ( event.selection == unneeded )
120 else if ( event.selection == allPatches )
122 else if ( event.selection == recommended )
124 else if ( event.selection == security )
126 else if ( event.selection == optional )
128 else if ( event.selection == search )
134 NCursesEvent retEvent = searchPopup->showSearchPopup();
136 if ( retEvent == NCursesEvent::button )
138 yuiMilestone() <<
"Searching for: " << retEvent.result << endl;
143 yuiMilestone() <<
"Search is canceled" << endl;
145 searchPopup->destroy();
150 pkgList->setKeyboardFocus();
bool showInformation()
Show the corresponding information (e.g.
bool fillPatchList(NCPkgMenuFilter::PatchFilter filter)
Fills the package table with YOU patches matching the filter.