41 #define YUILogComponent "ncurses-pkg"
44 #include "YMenuButton.h"
47 #include "NCLayoutBox.h"
48 #include "NCSpacing.h"
49 #include "NCPkgStrings.h"
50 #include "NCPackageSelector.h"
52 #include "NCPushButton.h"
53 #include "NCPkgTable.h"
58 #include <zypp/ui/Selectable.h>
59 #include <zypp/ui/UserWantedPackages.h>
61 #include "NCPkgPopupTable.h"
78 : NCPopup( at, false )
95 NCPkgPopupTable::~NCPkgPopupTable()
107 void NCPkgPopupTable::createLayout( )
110 NCLayoutBox * split =
new NCLayoutBox(
this, YD_VERT );
112 new NCSpacing( split, YD_VERT,
false, 0.6 );
115 new NCLabel( split, _(
"Automatic Changes" ),
true,
false );
117 new NCSpacing( split, YD_VERT,
false, 0.6 );
120 new NCLabel( split, _(
"In addition to your manual selections, the following" ),
false,
false );
123 new NCLabel( split, _(
"packages have been changed to resolve dependencies:" ),
false,
false );
125 YTableHeader * tableHeader =
new YTableHeader();
127 pkgTable =
new NCPkgTable( split, tableHeader );
132 NCLayoutBox * hSplit =
new NCLayoutBox( split, YD_HORIZ );
133 new NCSpacing( hSplit, YD_HORIZ,
true, 0.2 );
137 okButton->setFunctionKey( 10 );
138 okButton->setKeyboardFocus();
140 new NCSpacing( hSplit, YD_HORIZ,
true, 0.4 );
144 cancelButton->setFunctionKey( 9 );
146 new NCSpacing( hSplit, YD_HORIZ,
true, 0.2 );
148 new NCSpacing( split, YD_VERT,
false, 0.6 );
160 bool NCPkgPopupTable::fillAutoChanges(
NCPkgTable * pkgTable )
167 std::set<std::string> ignoredNames;
168 std::set<std::string> userWantedNames = zypp::ui::userWantedPackageNames();
173 std::insert_iterator< std::set<std::string> > result (ignoredNames, ignoredNames.begin());
175 if(!verifiedNames.empty())
178 set_union(userWantedNames.begin(), userWantedNames.end(),
179 verifiedNames.begin(), verifiedNames.end(), result );
183 ignoredNames = userWantedNames;
185 for ( std::set<std::string>::iterator it = ignoredNames.begin(); it != ignoredNames.end(); ++it )
186 yuiMilestone() <<
"Ignoring: " << *it << endl;
193 for (it = b; it != e; ++it)
198 if ( slb->toModify() && slb->modifiedBy () != zypp::ResStatus::USER )
200 if ( ! inContainer( ignoredNames, slb->name() ) )
202 ZyppPkg pkgPtr = tryCastToZyppPkg (slb->theObj());
205 yuiMilestone() <<
"The status of " << pkgPtr->name() <<
" has automatically changed" << endl;
234 NCursesEvent NCPkgPopupTable::showInfoPopup( )
236 postevent = NCursesEvent();
238 if ( !fillAutoChanges( pkgTable ) )
240 postevent = NCursesEvent::button;
247 }
while ( postAgain() );
260 int NCPkgPopupTable::preferredWidth()
262 return NCurses::cols()-15;
271 int NCPkgPopupTable::preferredHeight()
273 return NCurses::lines()-5;
284 NCursesEvent NCPkgPopupTable::wHandleInput( wint_t ch )
287 return NCursesEvent::cancel;
289 if ( ch == KEY_RETURN )
290 return NCursesEvent::button;
292 return NCDialog::wHandleInput( ch );
303 bool NCPkgPopupTable::postAgain()
305 if ( ! postevent.widget )
308 if ( postevent.widget == cancelButton )
314 postevent = NCursesEvent::cancel;
317 if ( postevent == NCursesEvent::button || postevent == NCursesEvent::cancel )