42 #include "NCWidgetFactory.h"
43 #include "NCPushButton.h"
44 #include "NCMenuButton.h"
46 #include "NCSpacing.h"
47 #include "NCRichText.h"
49 #include "NCPkgFilterRPMGroups.h"
50 #include "NCPopupInfo.h"
51 #include "NCSelectionBox.h"
52 #include "NCMenuButton.h"
53 #include "NCPkgFilterPattern.h"
54 #include "NCPkgFilterLocale.h"
55 #include "NCPkgFilterRepo.h"
56 #include "NCPkgFilterClassification.h"
57 #include "NCPkgPopupDeps.h"
58 #include "NCPkgPopupDiskspace.h"
59 #include "NCPkgMenuDeps.h"
60 #include "NCPkgMenuView.h"
61 #include "NCPkgMenuExtras.h"
62 #include "NCPkgMenuConfig.h"
63 #include "NCPkgMenuHelp.h"
64 #include "NCPkgMenuAction.h"
65 #include "NCPkgPopupDescr.h"
66 #include "NCPackageSelector.h"
67 #include "NCLayoutBox.h"
68 #include "YSelectionBox.h"
69 #include "YAlignment.h"
70 #include "YNCursesUI.h"
71 #include "YApplication.h"
81 #include <zypp/ui/Selectable.h>
82 #include <zypp/base/Sysconfig.h>
84 #include "YWidgetID.h"
85 #include "YPackageSelector.h"
87 #define PATH_TO_YAST_SYSCONFIG "/etc/sysconfig/yast2"
89 #define OPTION_REEVALUATE "PKGMGR_REEVALUATE_RECOMMENDED"
90 #define OPTION_VERIFY "PKGMGR_VERIFY_SYSTEM"
91 #define OPTION_AUTO_CHECK "PKGMGR_AUTO_CHECK"
92 #define OPTION_EXIT "PKGMGR_ACTION_AT_EXIT"
94 typedef zypp::Patch::Contents ZyppPatchContents;
95 typedef zypp::Patch::Contents::Selectable_iterator ZyppPatchContentsIterator;
109 NCPackageSelector::NCPackageSelector(
long modeFlags )
115 , diskspacePopup( 0 )
118 , verifySystem( false )
119 , installRecommended( false )
129 , updatelistItem( 0 )
131 , diskspaceLabel( 0 )
136 , patchPkgsVersions( 0 )
142 setFlags( modeFlags );
147 setInstallAlreadyRecommended( isInstallAlreadyRecommended() );
148 setAutoCheck( isAutoCheck() );
149 setVerifySystem( isVerifySystem() );
164 void NCPackageSelector::setFlags(
long modeFlags )
166 youMode = ( modeFlags & YPkg_OnlineUpdateMode ) ?
true :
false ;
168 updateMode = ( modeFlags & YPkg_UpdateMode ) ?
true :
false ;
170 repoMgrEnabled = (modeFlags & YPkg_RepoMgr) ?
true :
false;
172 testMode = (modeFlags & YPkg_TestMode ) ?
true :
false ;
174 repoMode = ( modeFlags & YPkg_RepoMode ) ?
true :
false;
176 summaryMode = ( modeFlags & YPkg_SummaryMode ) ?
true :
false;
179 void NCPackageSelector::readSysconfig()
181 sysconfig = zypp::base::sysconfig::read( PATH_TO_YAST_SYSCONFIG );
182 std::map <std::string,std::string>::const_iterator it = sysconfig.find( OPTION_EXIT );
184 if (it != sysconfig.end())
186 actionAtExit = it->second;
187 yuiMilestone() <<
"Read sysconfig's action at pkg mgr exit value: " << actionAtExit << endl;
192 yuiMilestone() <<
"Could not read " << OPTION_EXIT <<
"variable from sysconfig, disabling the menu" << endl;
196 void NCPackageSelector::writeSysconfig( )
200 if( !actionAtExit.empty() )
202 ret = zypp::base::sysconfig::writeStringVal( PATH_TO_YAST_SYSCONFIG,
205 "Set behaviour when package installation has finished.");
208 yuiError() <<
"Writing " << OPTION_EXIT <<
" failed" << endl;
212 ret = zypp::base::sysconfig::writeStringVal( PATH_TO_YAST_SYSCONFIG,
214 (autoCheck?
"yes":
"no"),
215 "Automatic dependency checking" );
217 yuiError() <<
"Writing " << OPTION_AUTO_CHECK <<
" failed" << endl;
219 ret = zypp::base::sysconfig::writeStringVal( PATH_TO_YAST_SYSCONFIG,
221 (verifySystem?
"yes":
"no"),
222 "System verification mode" );
224 yuiError() <<
"Writing " << OPTION_VERIFY <<
" failed" << endl;
227 ret = zypp::base::sysconfig::writeStringVal( PATH_TO_YAST_SYSCONFIG,
229 (installRecommended?
"yes":
"no"),
230 "Install recommended packages for already installed packages" );
232 yuiError() <<
"Writing " << OPTION_REEVALUATE <<
" failed" << endl;
235 bool NCPackageSelector::checkNow(
bool *ok )
240 ret = depsPopup->showDependencies( NCPkgPopupDeps::S_Solve, ok );
241 YDialog::deleteTopmostDialog();
245 bool NCPackageSelector::systemVerification(
bool *ok )
250 ret = depsPopup->showDependencies( NCPkgPopupDeps::S_Verify, ok );
251 YDialog::deleteTopmostDialog();
259 bool NCPackageSelector::isCleanDepsOnRemove()
261 return zypp::getZYpp()->resolver()->cleandepsOnRemove();
264 void NCPackageSelector::setCleanDepsOnRemove(
bool on )
266 zypp::getZYpp()->resolver()->setCleandepsOnRemove( on );
267 zypp::getZYpp()->resolver()->resolvePool();
275 bool NCPackageSelector::isInstallAlreadyRecommended()
277 std::map <std::string,std::string>::const_iterator it = sysconfig.find( OPTION_REEVALUATE );
279 if ( it != sysconfig.end() )
281 yuiMilestone() << OPTION_REEVALUATE<<
": " << it->second << endl;
282 if ( it->second ==
"yes" )
283 installRecommended =
true;
284 else if ( it->second ==
"no")
285 installRecommended =
false;
287 installRecommended = !(zypp::getZYpp()->resolver()->ignoreAlreadyRecommended());
291 installRecommended = !(zypp::getZYpp()->resolver()->ignoreAlreadyRecommended());
293 yuiMilestone() <<
"installRecommended: " << (installRecommended?
"yes":
"no") << endl;
295 return installRecommended;
298 void NCPackageSelector::setInstallAlreadyRecommended(
bool on )
300 installRecommended = on;
301 zypp::getZYpp()->resolver()->setIgnoreAlreadyRecommended( !on );
303 zypp::getZYpp()->resolver()->resolvePool();
308 bool NCPackageSelector::isAutoCheck()
312 std::map <std::string,std::string>::const_iterator it = sysconfig.find( OPTION_AUTO_CHECK);
314 if ( it != sysconfig.end() )
316 yuiMilestone() << OPTION_AUTO_CHECK <<
": " << it->second << endl;
317 if ( it->second ==
"no" )
320 yuiMilestone() <<
"autoCheck " << (autoCheck?
"yes":
"no") << endl;
325 bool NCPackageSelector::isVerifySystem( )
327 std::map <std::string,std::string>::const_iterator it = sysconfig.find( OPTION_VERIFY );
329 if ( it != sysconfig.end() )
331 yuiMilestone() << OPTION_VERIFY <<
": " << it->second << endl;
332 if ( it->second ==
"yes" )
334 else if ( it->second ==
"no")
335 verifySystem =
false;
337 verifySystem = zypp::getZYpp()->resolver()->systemVerification();
341 verifySystem = zypp::getZYpp()->resolver()->systemVerification();
343 yuiMilestone() <<
"verifySystem: " << (verifySystem?
"yes":
"no") << endl;
348 void NCPackageSelector::setVerifySystem(
bool on )
351 zypp::getZYpp()->resolver()->setSystemVerification( on );
353 zypp::getZYpp()->resolver()->resolvePool();
361 bool NCPackageSelector::isAllowVendorChange()
363 zypp::Resolver_Ptr resolver = zypp::getZYpp()->resolver();
364 bool change = resolver->allowVendorChange();
365 yuiMilestone() <<
"Vendor change allowed: " << (change?
"true":
"false") << endl;
369 void NCPackageSelector::setAllowVendorChange(
bool on )
371 zypp::getZYpp()->resolver()->setAllowVendorChange( on );
372 zypp::getZYpp()->resolver()->resolvePool();
383 ZyppPool p = zyppPool ();
385 p.saveState<zypp::Package> ();
386 p.saveState<zypp::SrcPackage> ();
388 p.saveState<zypp::Patch> ();
390 p.saveState<zypp::Pattern> ();
394 void NCPackageSelector::restoreState ()
396 ZyppPool p = zyppPool ();
398 p.restoreState<zypp::Package> ();
399 p.restoreState<zypp::SrcPackage> ();
401 p.restoreState<zypp::Patch> ();
403 p.restoreState<zypp::Pattern> ();
407 bool NCPackageSelector::diffState ()
409 ZyppPool p = zyppPool ();
413 std::ostream & log = yuiMilestone();
414 log <<
"diffState" << endl;
415 diff = diff || p.diffState<zypp::Package> ();
417 diff = diff || p.diffState<zypp::SrcPackage> ();
420 diff = diff || p.diffState<zypp::Patch> ();
423 diff = diff || p.diffState<zypp::Pattern> ();
440 if ( event == NCursesEvent::handled )
443 yuiMilestone() <<
"widget event: " <<
event << endl;
445 if ( event == NCursesEvent::button )
447 if ( event.widget == okButton )
451 else if ( event.widget == cancelButton )
455 else if ( event.widget == filterPopup )
457 retVal = filterPopup->handleEvent();
459 else if ( event.widget == filterMain )
461 retVal = filterMain->handleEvent();
463 else if ( event.widget == searchField )
465 if ( event.reason == YEvent::Activated )
467 retVal = searchPopup->showSearchResultPackages();
475 else if ( event == NCursesEvent::menu )
477 if ( event.widget == actionMenu )
479 retVal = actionMenu->handleEvent( event );
480 else if ( event.widget == viewMenu )
482 retVal = viewMenu->handleEvent( event );
483 else if ( event.widget == depsMenu )
484 retVal = depsMenu->handleEvent( event );
485 else if ( event.widget == extrasMenu )
486 retVal = extrasMenu->handleEvent( event );
487 else if ( event.widget == configMenu )
488 retVal = configMenu->handleEvent( event );
489 else if ( event.widget == helpMenu )
490 retVal = helpMenu->handleEvent( event );
491 else if ( event.widget == filterMenu )
492 retVal = filterMenu->handleEvent( event );
493 else if ( event.selection->label().substr(0,4) ==
"pkg:" )
522 q.addKind( zypp::ResKind::patch );
523 q.addAttribute( zypp::sat::SolvAttr::keywords );
526 q.addAttribute( zypp::sat::SolvAttr::name );
530 q.addAttribute( zypp::sat::SolvAttr::summary );
533 for( zypp::PoolQuery::Selectable_iterator it = q.selectableBegin();
534 it != q.selectableEnd(); it++)
536 yuiMilestone() << (*it)->name() << endl;
537 ZyppPatch patchPtr = tryCastToZyppPatch( (*it)->theObj() );
566 yuiError() <<
"No valid NCPkgTable widget" << endl;
574 std::list<ZyppSel> patchList( zyppPatchesBegin (), zyppPatchesEnd () );
575 patchList.sort( sortByName );
576 std::list<ZyppSel>::iterator listIt = patchList.begin();
578 while ( listIt != patchList.end() )
580 ZyppPatch patchPtr = tryCastToZyppPatch( ( *listIt)->theObj() );
589 if ( filter == NCPkgMenuFilter::F_All
603 case NCPkgMenuFilter::F_Needed:
609 case NCPkgMenuFilter::F_Unneeded:
611 packageLabel->setLabel( NCPkgStrings::InstPatches() );
616 packageLabel->setLabel( NCPkgStrings::Patches() );
636 yuiError() <<
"Widget is not a valid NCPkgTable widget" << endl;
643 std::list<zypp::PoolItem> problemList = zypp::getZYpp()->resolver()->problematicUpdateItems();
645 for ( std::list<zypp::PoolItem>::const_iterator it = problemList.begin();
646 it != problemList.end();
649 ZyppPkg pkg = tryCastToZyppPkg( (*it).resolvable() );
657 yuiMilestone() <<
"Problematic package: " << pkg->name().c_str() <<
" " <<
658 pkg->edition().asString().c_str() << endl;
684 if ( !pkgTable || !objPtr )
689 std::set<ZyppSel> patchSelectables;
690 ZyppPatch patchPtr = tryCastToZyppPatch( objPtr );
695 ZyppPatchContents patchContents( patchPtr->contents() );
697 yuiMilestone() <<
"Filtering for patch: " << patchPtr->name().c_str() <<
" number of atoms: "
698 << patchContents.size() << endl ;
700 for ( ZyppPatchContentsIterator it = patchContents.selectableBegin();
701 it != patchContents.selectableEnd();
704 ZyppPkg pkg = tryCastToZyppPkg( (*it)->theObj() );
708 yuiMilestone() <<
"Patch package found: " << (*it)->name().c_str() << endl;
713 if ( inContainer( patchSelectables, sel ) )
715 yuiMilestone() <<
"Suppressing duplicate selectable: " << (*it)->name().c_str() <<
"-" <<
716 pkg->edition().asString().c_str() <<
" " <<
717 pkg->arch().asString().c_str() << endl;
721 patchSelectables.insert( sel );
722 yuiDebug() << (*it)->name().c_str() <<
": Version: " << pkg->edition().asString() << endl;
728 zypp::ui::Selectable::available_iterator
729 b = sel->availableBegin (),
730 e = sel->availableEnd (),
732 for (it = b; it != e; ++it)
734 ZyppPkg pkgAvail = tryCastToZyppPkg (*it);
737 if ( pkg->edition() != pkgAvail->edition() ||
738 pkg->arch() != pkgAvail->arch() )
751 yuiDebug() <<
"Found unknown atom of kind %s: %s" <<
752 (*it)->kind().asString().c_str() <<
753 (*it)->name().c_str() << endl;
773 NCPkgMenuFilter::PatchFilter filter )
777 bool displayPatch =
false;
779 if ( !packageList || !patchPtr
782 yuiError() <<
"Widget is not a valid NCPkgTable widget" << endl;
785 yuiDebug() <<
"Filter: " << filter << endl;
788 case NCPkgMenuFilter::F_All:
793 case NCPkgMenuFilter::F_Unneeded:
795 if ( selectable->hasCandidateObj() &&
796 ( !selectable->candidateObj().isRelevant() ||
797 ( selectable->candidateObj().isSatisfied() &&
798 ! selectable->candidateObj().status().isToBeInstalled() ) ) )
804 case NCPkgMenuFilter::F_Needed:
807 if ( selectable->hasCandidateObj() &&
808 selectable->candidateObj().isRelevant() )
811 if ( ! selectable->candidateObj().isSatisfied() ||
813 selectable->candidateObj().status().isToBeInstalled() )
818 case NCPkgMenuFilter::F_Security:
820 if ( patchPtr->category() ==
"security" )
824 case NCPkgMenuFilter::F_Recommended:
826 if ( patchPtr->category() ==
"recommended" )
830 case NCPkgMenuFilter::F_Optional:
832 if ( patchPtr->category() ==
"optional" )
837 yuiWarning() <<
"Unknown patch filter" << endl;
853 wrect NCPackageSelector::deleteReplacePoint()
856 YWidget * replaceChild = replacePoint->firstChild();
861 oldSize =
dynamic_cast<NCWidget *
>(replaceChild)->wGetSize();
868 patchPkgsVersions = 0;
884 wrect oldSize = deleteReplacePoint();
891 infoText->setSize( oldSize.Sze.W, oldSize.Sze.H );
906 wrect oldSize = deleteReplacePoint();
910 YTableHeader * tableHeader =
new YTableHeader();
911 versionsList =
new NCPkgTable( replacePoint, tableHeader );
915 if ( versionsList && packageList )
921 versionsList->setSize( oldSize.Sze.W, oldSize.Sze.H );
923 versionsList->fillAvailableList( packageList->
getSelPointer( packageList->getCurrentItem() ) );
924 versionsList->Redraw();
926 packageList->setKeyboardFocus();
941 wrect oldSize = deleteReplacePoint();
945 YTableHeader * tableHeader =
new YTableHeader();
946 patchPkgs =
new NCPkgTable( replacePoint, tableHeader );
948 if ( patchPkgs && packageList )
954 patchPkgs->
setTableType( NCPkgTable::T_PatchPkgs, strategy );
956 patchPkgs->setSize( oldSize.Sze.W, oldSize.Sze.H );
961 packageList->setKeyboardFocus();
976 wrect oldSize = deleteReplacePoint();
980 YTableHeader * tableHeader =
new YTableHeader();
981 patchPkgsVersions =
new NCPkgTable( replacePoint, tableHeader );
983 if ( patchPkgsVersions && packageList )
989 patchPkgsVersions->
setTableType( NCPkgTable::T_Availables, strategy );
991 patchPkgsVersions->setSize( oldSize.Sze.W, oldSize.Sze.H );
994 patchPkgsVersions->Redraw();
996 packageList->setKeyboardFocus();
1000 void NCPackageSelector::clearInfoArea()
1003 infoText->setText(
"");
1007 packageLabel->setText(
".....................................");
1010 void NCPackageSelector::replaceFilter( FilterMode mode)
1012 patternLabel->setLabel(
" " );
1013 YWidget * replaceChild = replPoint->firstChild();
1018 oldSize =
dynamic_cast<NCWidget *
>(replaceChild)->wGetSize();
1020 delete replaceChild;
1031 replaceFilterDescr( mode == Search );
1037 YTableHeader *hhh =
new YTableHeader ();
1039 patternPopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
1040 patternPopup->Redraw();
1042 patternPopup->setKeyboardFocus();
1047 YTableHeader *hhh =
new YTableHeader ();
1049 languagePopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
1050 languagePopup->Redraw();
1051 languagePopup->showLocalePackages();
1052 languagePopup->setKeyboardFocus();
1057 YTableHeader *hhh =
new YTableHeader ();
1059 repoPopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
1060 repoPopup->Redraw();
1061 repoPopup->showRepoPackages();
1062 repoPopup->setKeyboardFocus();
1068 filterPopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
1069 filterPopup->Redraw();
1071 YStringTreeItem * defaultGroup = filterPopup->getDefaultRpmGroup();
1075 yuiMilestone() <<
"default RPM group: " << defaultGroup->value().translation() << endl;
1076 filterPopup->showRPMGroupPackages ( defaultGroup->value().translation(), defaultGroup );
1080 yuiError() <<
"No default RPM group available" << endl;
1082 filterPopup->setKeyboardFocus();
1088 searchPopup->createLayout( replPoint );
1089 searchPopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
1090 searchPopup->Redraw();
1092 searchField = searchPopup->getSearchField();
1095 searchField->setKeyboardFocus();
1096 searchField->setNotify(
true);
1103 inst_summary->setSize( oldSize.Sze.W, oldSize.Sze.H );
1104 inst_summary->Redraw();
1105 inst_summary->setKeyboardFocus();
1106 pkgList->fillSummaryList(NCPkgTable::L_Changes);
1109 case PkgClassification:
1112 pkgClass->setSize( oldSize.Sze.W, oldSize.Sze.H );
1114 pkgClass->setKeyboardFocus();
1119 yuiError() <<
"zatim nic" << endl;
1129 pkgList->setCurrentItem(0);
1135 void NCPackageSelector::replaceFilterDescr(
bool b )
1137 YWidget * replaceChild = replPoint2->firstChild();
1142 oldSize =
dynamic_cast<NCWidget *
>(replaceChild)->wGetSize();
1144 delete replaceChild;
1152 searchSet->setSize( oldSize.Sze.W, oldSize.Sze.H );
1153 searchSet->Redraw();
1157 filter_desc =
new NCRichText( replPoint2,
"");
1158 filter_desc->setSize( oldSize.Sze.W, oldSize.Sze.H );
1159 filter_desc->Redraw();
1174 std::string pkgName = link.substr(6);
1180 for (i = b; i != e; ++i)
1182 ZyppPkg pkgPtr = tryCastToZyppPkg ((*i)->theObj());
1183 if ( pkgPtr && pkgPtr->name() == pkgName )
1185 yuiMilestone() <<
"Package " << pkgName <<
" found" << endl;
1188 popupDescr->showInfoPopup( pkgPtr, *i );
1190 YDialog::deleteTopmostDialog();
1198 yuiError() <<
"Package " << pkgName <<
" NOT found" << endl;
1214 bool changes = diffState ();
1218 NCPopupInfo * cancelMsg =
new NCPopupInfo( wpos( (NCurses::lines()-8)/2, (NCurses::cols()-45)/2 ),
1219 NCPkgStrings::NotifyLabel(),
1220 NCPkgStrings::CancelText(),
1224 cancelMsg->setPreferredSize( 45, 8 );
1225 cancelMsg->focusCancelButton();
1226 NCursesEvent input = cancelMsg->showInfoPopup( );
1228 YDialog::deleteTopmostDialog();
1230 if ( input == NCursesEvent::cancel ) {
1238 yuiMilestone() <<
"Cancel button pressed - leaving package selection" << endl;
1239 const_cast<NCursesEvent &
>(event).result =
"cancel";
1253 bool closeDialog =
true;
1254 bool confirmedAllLicenses =
false;
1264 closeDialog =
false;
1269 }
while ( !confirmedAllLicenses && closeDialog );
1275 NCursesEvent input = autoChangePopup->showInfoPopup();
1277 YDialog::deleteTopmostDialog();
1279 if ( input == NCursesEvent::cancel )
1282 closeDialog =
false;
1286 if ( diskspacePopup )
1288 std::string message =
"";
1289 message = diskspacePopup->checkDiskSpace();
1290 if ( message !=
"" )
1293 NCPopupInfo * spaceMsg =
new NCPopupInfo( wpos( (NCurses::lines()-10)/2, (NCurses::cols()-50)/2 ),
1294 NCPkgStrings::ErrorLabel(),
1296 _(
"You can choose to install anyway, but you risk getting a corrupted system." ),
1297 _(
"&Continue anyway" ),
1300 spaceMsg->setPreferredSize( 50, 10 );
1301 spaceMsg->focusOkButton();
1302 NCursesEvent input = spaceMsg->showInfoPopup( );
1304 YDialog::deleteTopmostDialog();
1306 if ( input == NCursesEvent::cancel )
1309 closeDialog =
false;
1321 const_cast<NCursesEvent &
>(event).result =
"accept";
1322 yuiMilestone() <<
"OK button pressed - leaving package selection, starting installation" << endl;
1333 packageList->setKeyboardFocus();
1342 bool allConfirmed =
true;
1349 return allConfirmed;
1354 yuiMilestone() <<
"Showing all pending license agreements" << endl;
1356 bool allConfirmed =
true;
1358 for ( ZyppPoolIterator it = begin; it != end; ++it )
1360 ZyppSel sel = (*it);
1362 switch ( sel->status() )
1369 if ( sel->candidateObj() )
1371 std::string licenseText = sel->candidateObj()->licenseToConfirm();
1373 if ( ! licenseText.empty() )
1375 yuiMilestone() <<
"Package/Patch " << sel->name().c_str() <<
1376 "has a license" << endl;
1378 if( ! sel->hasLicenceConfirmed() )
1384 yuiMilestone() <<
"License for " << sel->name().c_str() <<
1385 " is already confirmed" << endl;
1396 return allConfirmed;
1404 bool license_confirmed =
true;
1406 std::string pkgName = slbPtr->name();
1410 if ( !license_confirmed )
1413 switch ( slbPtr->status() )
1417 slbPtr->setStatus( S_Taboo );
1422 slbPtr->setStatus( S_Protected );
1431 yuiMilestone() <<
"User confirmed license agreement for " << pkgName << endl;
1432 slbPtr->setLicenceConfirmed (
true);
1448 bool cancel =
false;
1450 if ( doit || autoCheck )
1452 yuiMilestone() <<
"Checking dependencies" << endl;
1453 cancel = checkNow( & ok );
1476 std::string html_text =
"";
1477 const std::string htmlIdent(DOCTYPETAG);
1478 bool confirmed =
false;
1480 if ( license.find( htmlIdent ) != std::string::npos )
1482 html_text = license;
1486 html_text =
"<pre>" + license +
"</pre>";
1489 NCPopupInfo * info =
new NCPopupInfo ( wpos( NCurses::lines()/10, NCurses::cols()/10),
1491 _(
"End User License Agreement" ),
1492 "<i>" + pkgName +
"</i><br><br>"
1497 info->setPreferredSize( (NCurses::cols() * 80)/100, (NCurses::lines()*80)/100);
1498 info->focusOkButton();
1499 confirmed = info->showInfoPopup( ) != NCursesEvent::cancel;
1501 YDialog::deleteTopmostDialog();
1529 if ( diskspacePopup )
1531 diskspacePopup->checkDiskSpaceRange( );
1534 if ( diskspaceLabel )
1536 diskspaceLabel->setText( diskspacePopup->calculateDiff().asString() );
1550 std::set<ZyppSel> selectablesToInstall;
1552 for ( ZyppPoolIterator patches_it = zyppPatchesBegin();
1553 patches_it != zyppPatchesEnd();
1556 ZyppPatch patch = tryCastToZyppPatch( (*patches_it)->theObj() );
1560 ZyppPatchContents patchContents( patch->contents() );
1562 for ( ZyppPatchContentsIterator contents_it = patchContents.selectableBegin();
1563 contents_it != patchContents.selectableEnd();
1566 ZyppPkg pkg = tryCastToZyppPkg( (*contents_it)->theObj() );
1575 switch ( sel->status() )
1586 selectablesToInstall.insert( sel );
1592 case S_KeepInstalled:
1606 FSize totalSize = 0;
1608 for ( std::set<ZyppSel>::iterator it = selectablesToInstall.begin();
1609 it != selectablesToInstall.end();
1612 if ( (*it)->candidateObj() )
1613 totalSize += (*it)->candidateObj()->installSize();
1617 if ( diskspaceLabel )
1619 diskspaceLabel->setText( totalSize.asString() );
1628 NCPkgTable * NCPackageSelector::PackageList()
1639 YLayoutBox * split = YUI::widgetFactory()->createVBox( selector );
1641 YLayoutBox * hSplit = YUI::widgetFactory()->createHBox( split );
1643 YAlignment * left1 = YUI::widgetFactory()->createLeft( hSplit );
1644 filterMenu =
new NCPkgMenuFilter( left1, NCPkgStrings::Filter(),
this );
1646 YAlignment * left2 = YUI::widgetFactory()->createLeft( hSplit );
1647 actionMenu =
new NCPkgMenuAction( left2, NCPkgStrings::Actions(),
this );
1649 YAlignment * left3 = YUI::widgetFactory()->createLeft( hSplit );
1650 viewMenu =
new NCPkgMenuView( left3, NCPkgStrings::View(),
this);
1652 YAlignment * left4 = YUI::widgetFactory()->createLeft( hSplit );
1653 depsMenu =
new NCPkgMenuDeps( left4, NCPkgStrings::Deps(),
this);
1656 YTableHeader * tableHeader =
new YTableHeader();
1658 pkgList =
new NCPkgTable( split, tableHeader );
1659 YUI_CHECK_NEW( pkgList );
1664 pkgList->
setTableType( NCPkgTable::T_Patches, strategy );
1671 std::vector<std::string> pkgHeader;
1672 pkgList->getHeader( pkgHeader );
1676 YLayoutBox * hSplit2 = YUI::widgetFactory()->createHBox( split );
1678 YLayoutBox * hSplit3 = YUI::widgetFactory()->createHBox( hSplit2 );
1680 new NCLabel( hSplit3, _(
"Filter: " ) );
1681 packageLabel = YUI::widgetFactory()->createLabel ( hSplit3,
"....................................." );
1683 new NCSpacing( hSplit2, YD_HORIZ,
true, 0.5 );
1685 YLayoutBox * hSplit4 = YUI::widgetFactory()->createHBox( hSplit2 );
1687 new NCLabel( hSplit4, _(
"Total Download Size: " ) );
1689 diskspaceLabel = YUI::widgetFactory()->createLabel ( hSplit4,
" " );
1691 YLayoutBox * vSplit = YUI::widgetFactory()->createVBox( split );
1692 replacePoint = YUI::widgetFactory()->createReplacePoint( vSplit );
1695 YUI_CHECK_NEW( infoText );
1697 YLayoutBox * bottom_bar = YUI::widgetFactory()->createHBox( vSplit );
1698 YAlignment *ll = YUI::widgetFactory()->createLeft( bottom_bar );
1702 YAlignment *r = YUI::widgetFactory()->createRight( bottom_bar );
1703 YLayoutBox * hSplit5 = YUI::widgetFactory()->createHBox( r );
1706 cancelButton =
new NCPushButton( hSplit5, _(
"&Cancel" ) );
1707 YUI_CHECK_NEW( cancelButton );
1708 cancelButton->setFunctionKey( 9 );
1711 okButton =
new NCPushButton( hSplit5, _(
"&Accept" ) );
1712 YUI_CHECK_NEW( okButton );
1713 okButton->setFunctionKey( 10 );
1723 YLayoutBox * vsplit = YUI::widgetFactory()->createVBox( selector );
1724 YLayoutBox * menu_bar = YUI::widgetFactory()->createHBox( vsplit );
1725 YLayoutBox * panels = YUI::widgetFactory()->createVBox( vsplit );
1726 YLayoutBox * bottom_bar = YUI::widgetFactory()->createHBox( vsplit );
1728 YAlignment * left1 = YUI::widgetFactory()->createLeft( menu_bar );
1730 YLayoutBox * menu_buttons = YUI::widgetFactory()->createHBox( left1);
1731 depsMenu =
new NCPkgMenuDeps( menu_buttons, NCPkgStrings::Deps(),
this);
1732 viewMenu =
new NCPkgMenuView( menu_buttons, NCPkgStrings::View(),
this);
1735 if (isRepoMgrEnabled())
1736 configMenu =
new NCPkgMenuConfig( menu_buttons, _(
"C&onfiguration" ),
this);
1738 extrasMenu =
new NCPkgMenuExtras( menu_buttons, NCPkgStrings::Extras(),
this);
1740 YLayoutBox * hbox_top = YUI::widgetFactory()->createHBox( panels );
1741 YLayoutBox * hbox_bottom = YUI::widgetFactory()->createHBox( panels );
1743 YLayoutBox * vbox_left = YUI::widgetFactory()->createVBox( hbox_top );
1744 vbox_left->setWeight(YD_HORIZ,1);
1745 YFrame * fr = YUI::widgetFactory()->createFrame (vbox_left,
"");
1746 YLayoutBox * vv = YUI::widgetFactory()->createVBox( fr );
1747 YAlignment *l = YUI::widgetFactory()->createLeft( vv );
1750 replPoint = YUI::widgetFactory()->createReplacePoint( vv );
1753 searchPopup->createLayout( replPoint );
1755 searchField = searchPopup->getSearchField();
1758 searchField->setKeyboardFocus();
1759 searchField->setNotify(
true );
1762 YAlignment *l1 = YUI::widgetFactory()->createLeft( vbox_left );
1763 patternLabel =
new NCLabel( l1,
" " );
1766 YTableHeader * tableHeader =
new YTableHeader();
1768 YLayoutBox * v = YUI::widgetFactory()->createVBox( hbox_top );
1769 v->setWeight(YD_HORIZ,2);
1771 YUI_CHECK_NEW( pkgList );
1777 case NCPkgTable::T_Packages:
1779 pkgList->
setTableType( NCPkgTable::T_Packages, strategy );
1780 case NCPkgTable::T_Update:
1782 pkgList->
setTableType( NCPkgTable::T_Update, strategy );
1785 pkgList->
setTableType( NCPkgTable::T_Packages, strategy );
1792 std::vector<std::string> pkgHeader;
1793 pkgList->getHeader( pkgHeader );
1797 YLayoutBox * hSplit2 = YUI::widgetFactory()->createHBox( v );
1798 new NCLabel( hSplit2, NCPkgStrings::PackageName() );
1799 packageLabel = YUI::widgetFactory()->createLabel ( hSplit2,
"......................" );
1800 new NCSpacing( hSplit2, YD_HORIZ,
true, 0.5 );
1801 actionMenu =
new NCPkgMenuAction ( hSplit2, NCPkgStrings::Actions(),
this );
1804 replPoint2 = YUI::widgetFactory()->createReplacePoint( hbox_bottom );
1805 replPoint2->setWeight(YD_HORIZ, 1);
1809 YLayoutBox * vSplit = YUI::widgetFactory()->createVBox( hbox_bottom );
1810 vSplit->setWeight(YD_HORIZ, 2);
1811 replacePoint = YUI::widgetFactory()->createReplacePoint( vSplit );
1813 YUI_CHECK_NEW( infoText );
1816 YAlignment *ll = YUI::widgetFactory()->createLeft( bottom_bar );
1818 YUI_CHECK_NEW( helpMenu );
1821 YAlignment *right = YUI::widgetFactory()->createRight( bottom_bar );
1822 YLayoutBox * hSplit = YUI::widgetFactory()->createHBox( right );
1825 cancelButton =
new NCPushButton( hSplit, _(
"&Cancel" ) );
1826 YUI_CHECK_NEW( cancelButton );
1827 cancelButton->setFunctionKey( 9 );
1830 okButton =
new NCPushButton( hSplit, _(
"&Accept" ) );
1831 YUI_CHECK_NEW( okButton );
1832 okButton->setFunctionKey( 10 );
1844 yuiMilestone() <<
"Filling package list: " << (NCWidget *) pkgList << endl;
1846 switch ( pkgList->getTableType() )
1848 case NCPkgTable::T_Patches: {
1852 pkgList->setVisibleInfo(NCPkgTable::I_PatchDescr);
1855 pkgList->setKeyboardFocus();
1858 case NCPkgTable::T_Update: {
1859 if ( ! zypp::getZYpp()->resolver()->problematicUpdateItems().empty() )
1863 pkgList->setVisibleInfo(NCPkgTable::I_Technical);
1869 case NCPkgTable::T_Packages: {
1871 pkgList->setVisibleInfo(NCPkgTable::I_Technical);
1872 searchField->setKeyboardFocus();
1882 replaceFilter ( NCPackageSelector::Repositories );
1884 filterMain->setReposSelected();
1886 else if ( summaryMode )
1888 replaceFilter ( NCPackageSelector::Summary );
1890 filterMain->setSummarySelected();