Author: gs Date: Tue May 6 15:47:21 2008 New Revision: 47321 URL: http://svn.opensuse.org/viewcvs/yast?rev=47321&view=rev Log: filter name for satisfied patches is 'Unneeded' (like qt), use enum for patch filters Modified: trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes trunk/ncurses-pkg/src/NCPackageSelector.cc trunk/ncurses-pkg/src/NCPackageSelector.h trunk/ncurses-pkg/src/NCPkgMenuFilter.cc trunk/ncurses-pkg/src/NCPkgMenuFilter.h trunk/ncurses-pkg/src/NCPkgStrings.cc Modified: trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes?rev=47321&r1=47320&r2=47321&view=diff ============================================================================== --- trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes (original) +++ trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes Tue May 6 15:47:21 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Tue May 6 15:39:05 CEST 2008 - gs@suse.de + +- YOU: filter name for satisfied patches is 'Unneeded' (like qt), + use enum for patch filters, +- Do the initial solver run before showing the default list + +------------------------------------------------------------------- Mon May 5 14:31:15 CEST 2008 - kmachalkova@suse.cz - Improved YOU layout, showing YOU help ( by gs ) Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.cc?rev=47321&r1=47320&r2=47321&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.cc (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.cc Tue May 6 15:47:21 2008 @@ -21,7 +21,6 @@ #include "NCPushButton.h" #include "NCMenuButton.h" #include "NCTable.h" -#include "NCPkgTable.h" #include "NCSpacing.h" #include "NCRichText.h" #include "NCLabel.h" @@ -364,7 +363,7 @@ // // Fills the package table with the list of YOU patches // -bool NCPackageSelector::fillPatchList( string filter ) +bool NCPackageSelector::fillPatchList( NCPkgMenuFilter::PatchFilter filter ) { NCPkgTable * packageList = PackageList(); @@ -393,7 +392,7 @@ ++listIt; } - if ( filter == "installable" + if ( filter == NCPkgMenuFilter::F_All && packageList->getNumLines() == 0 ) { packageList->createInfoEntry( NCPkgStrings::NoPatches() ); @@ -405,18 +404,23 @@ // show the selected filter label if ( packageLabel ) { - if ( filter == "installable" ) + switch ( filter ) { - // show common label "Online Update Patches" - packageLabel->setLabel( NCPkgStrings::YOUPatches() ); - } - else if ( filter == "installed" ) - { - packageLabel->setLabel( NCPkgStrings::InstPatches() ); - } - else - { - packageLabel->setLabel( NCPkgStrings::Patches() ); + case NCPkgMenuFilter::F_Needed: + { + // show common label "Needed Patches" + packageLabel->setLabel( NCPkgStrings::YOUPatches() ); + break; + } + case NCPkgMenuFilter::F_Unneeded: + { + packageLabel->setLabel( NCPkgStrings::InstPatches() ); + break; + } + default: + { + packageLabel->setLabel( NCPkgStrings::Patches() ); + } } } @@ -571,8 +575,8 @@ // // bool NCPackageSelector::checkPatch( ZyppPatch patchPtr, - ZyppSel selectable, - string filter ) + ZyppSel selectable, + NCPkgMenuFilter::PatchFilter filter ) { NCPkgTable * packageList = PackageList(); @@ -584,47 +588,56 @@ yuiError() << "Widget is not a valid NCPkgTable widget" << endl; return false; } - - if ( filter == "all" ) - { - displayPatch = true; - } - else if ( filter == "installed" ) // now means: satisfied - { - if ( selectable->hasCandidateObj() && - selectable->candidateObj().isRelevant() && - selectable->candidateObj().isSatisfied() ) - { - displayPatch = true; - } - } - else if ( filter == "installable" ) // relevant patches + yuiMilestone() << "Filter: " << filter << endl; + switch ( filter ) { - // only shows patches relevant to the system - if ( selectable->hasCandidateObj() && - selectable->candidateObj().isRelevant() ) - { - // FIXME: Condition is relevant and broken ??? -> schubi - // and only those that are needed - if ( ! selectable->candidateObj().isSatisfied() ) - displayPatch = true; - } - } - else if ( filter == "security" ) - { - if ( patchPtr->category() == "security" ) - displayPatch = true; - } - - else if ( filter == "recommended" ) - { - if ( patchPtr->category() == "recommended" ) + case NCPkgMenuFilter::F_All: + { displayPatch = true; - } - else if ( filter == "optional" ) - { - if ( patchPtr->category() == "optional" ) + break; + } + case NCPkgMenuFilter::F_Unneeded: // unneeded means satisfied + { + if ( selectable->hasCandidateObj() && + selectable->candidateObj().isRelevant() && + selectable->candidateObj().isSatisfied() ) + { + displayPatch = true; + } + break; + } + case NCPkgMenuFilter::F_Needed: // needed means relevant patches + { + // only shows patches relevant to the system + if ( selectable->hasCandidateObj() && + selectable->candidateObj().isRelevant() ) + { + // and only those that are needed + if ( ! selectable->candidateObj().isSatisfied() ) displayPatch = true; + } + break; + } + case NCPkgMenuFilter::F_Security: + { + if ( patchPtr->category() == "security" ) + displayPatch = true; + break; + } + case NCPkgMenuFilter::F_Recommended: + { + if ( patchPtr->category() == "recommended" ) + displayPatch = true; + break; + } + case NCPkgMenuFilter::F_Optional: + { + if ( patchPtr->category() == "optional" ) + displayPatch = true; + break; + } + default: + y2warning( "Unknown patch filter" ); } if ( displayPatch ) @@ -1682,7 +1695,7 @@ switch ( pkgList->getTableType() ) { case NCPkgTable::T_Patches: { - fillPatchList( "installable" ); // default: installable patches + fillPatchList( NCPkgMenuFilter::F_Needed ); // default: needed patches // set the visible info to long description pkgList->setVisibleInfo(NCPkgTable::I_PatchDescr); Modified: trunk/ncurses-pkg/src/NCPackageSelector.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.h?rev=47321&r1=47320&r2=47321&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.h (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.h Tue May 6 15:47:21 2008 @@ -68,7 +68,6 @@ class NCPkgMenuDeps; class NCPkgMenuAction; class NCPkgMenuView; -class NCPkgMenuFilter; class NCPkgSearchSettings; class NCPkgPackageDetails; class NCPkgFilterMain; @@ -246,7 +245,7 @@ * @param filter * @return bool */ - bool fillPatchList( string filter ); + bool fillPatchList( NCPkgMenuFilter::PatchFilter filter ); /** * Fills the package table with packages with update problems @@ -373,7 +372,9 @@ * Returns true if there is a match, false otherwise or if 'patch' is 0. * @return bool **/ - bool checkPatch( ZyppPatch patch, ZyppSel selectable, string filter ); + bool checkPatch( ZyppPatch patch, + ZyppSel selectable, + NCPkgMenuFilter::PatchFilter filter ); /** * Returns whether automatic dependency is on or off Modified: trunk/ncurses-pkg/src/NCPkgMenuFilter.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuFilter.cc?rev=47321&r1=47320&r2=47321&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgMenuFilter.cc (original) +++ trunk/ncurses-pkg/src/NCPkgMenuFilter.cc Tue May 6 15:47:21 2008 @@ -19,6 +19,8 @@ #include "NCPkgMenuFilter.h" #include "NCPkgPatchSearch.h" +#include "NCPkgTable.h" +#include "NCPackageSelector.h" /* Textdomain "ncurses-pkg" @@ -43,7 +45,7 @@ // begin: needed = new YMenuItem( _( "&Needed Patches" ) ); // _( "Re&levant Patches") - satisfied = new YMenuItem( _( "&Satisfied Patches" ) ); + // _( "&Satisfied Patches" ) ); unneeded = new YMenuItem( _( "&Unneeded Patches" ) ); allPatches = new YMenuItem( _( "&All Patches" ) ); recommended = new YMenuItem( _( "&Recommended" ) ); @@ -53,7 +55,7 @@ search = new YMenuItem( _( "S&earch" ) ); items.push_back( needed ); - items.push_back( satisfied ); + items.push_back( unneeded ); items.push_back( allPatches ); items.push_back( recommended ); items.push_back( security ); @@ -86,17 +88,17 @@ // the selected menu entry. if ( event.selection == needed ) - pkg->fillPatchList( "installable" ); // show installed patches - else if ( event.selection == satisfied ) - pkg->fillPatchList( "installed" ); // show installed patches + pkg->fillPatchList( F_Needed ); // show needed patches + else if ( event.selection == unneeded ) + pkg->fillPatchList( F_Unneeded ); // show unneeded patches else if ( event.selection == allPatches ) - pkg->fillPatchList( "all" ); // show all patches + pkg->fillPatchList( F_All ); // show all patches else if ( event.selection == recommended ) - pkg->fillPatchList( "recommended" ); // patch kind recommended + pkg->fillPatchList( F_Recommended ); // patch kind recommended else if ( event.selection == security ) - pkg->fillPatchList( "security" ); // patch kind security + pkg->fillPatchList( F_Security ); // patch kind security else if ( event.selection == optional ) - pkg->fillPatchList( "optional" ); // patch kind optional + pkg->fillPatchList( F_Optional ); // patch kind optional else if ( event.selection == search ) { searchPopup = new NCPkgPatchSearch( wpos( 1, 1 ), pkg ); Modified: trunk/ncurses-pkg/src/NCPkgMenuFilter.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuFilter.h?rev=47321&r1=47320&r2=47321&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgMenuFilter.h (original) +++ trunk/ncurses-pkg/src/NCPkgMenuFilter.h Tue May 6 15:47:21 2008 @@ -25,13 +25,26 @@ #include "NCurses.h" #include "NCi18n.h" #include "NCMenuButton.h" -#include "NCPackageSelector.h" #include "NCPkgPatchSearch.h" +class NCPackageSelector; + #include "NCZypp.h" class NCPkgMenuFilter : public NCMenuButton { +public: + enum PatchFilter + { + F_Needed, + F_Unneeded, + F_All, + F_Recommended, + F_Security, + F_Optional, + F_Unknown + }; + NCPkgMenuFilter & operator=( const NCPkgMenuFilter & ); NCPkgMenuFilter ( const NCPkgMenuFilter & ); @@ -43,7 +56,6 @@ YItemCollection items; YMenuItem *needed; - YMenuItem *satisfied; YMenuItem *unneeded; YMenuItem *allPatches; YMenuItem *recommended; @@ -52,7 +64,7 @@ YMenuItem *search; public: - + NCPkgMenuFilter (YWidget *parent, string label, NCPackageSelector *pkger); virtual ~NCPkgMenuFilter(); Modified: trunk/ncurses-pkg/src/NCPkgStrings.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgStrings.cc?rev=47321&r1=47320&r2=47321&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgStrings.cc (original) +++ trunk/ncurses-pkg/src/NCPkgStrings.cc Tue May 6 15:47:21 2008 @@ -952,7 +952,7 @@ const string NCPkgStrings::YOUPatches() { // A label for a list of YOU Patches - keep it short - max 25 chars! - // (the list shows all patches which can be installed) + // (the list shows all patches which are needed) //static const string value = _( "Installable Patches" ); //static const string value = _( "Relevant Patches" ); static const string value = _( "Needed Patches" ); @@ -964,8 +964,8 @@ // A label for a list of YOU Patches - keep it short - max. 25 chars! // (the list shows all patches which are already installed) //static const string value = _( "Installed Patches" ); - //static const string value = _( "Unneeded Patches" ); - static const string value = _( "Satisfied Patches" ); + static const string value = _( "Unneeded Patches" ); + //static const string value = _( "Satisfied Patches" ); return value; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org