Author: gs
Date: Thu Apr 24 13:30:20 2008
New Revision: 47029
URL: http://svn.opensuse.org/viewcvs/yast?rev=47029&view=rev
Log:
deprecated zypp::ui::PatchContents replaced, patch search enabled
Modified:
trunk/ncurses-pkg/src/NCPackageSelector.cc
trunk/ncurses-pkg/src/NCPackageSelector.h
trunk/ncurses-pkg/src/NCPkgFilterSearch.cc
trunk/ncurses-pkg/src/NCPkgMenuFilter.cc
trunk/ncurses-pkg/src/NCPkgMenuFilter.h
trunk/ncurses-pkg/src/NCPkgStrings.cc
Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.cc?rev=47029&r1=47028&r2=47029&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelector.cc (original)
+++ trunk/ncurses-pkg/src/NCPackageSelector.cc Thu Apr 24 13:30:20 2008
@@ -51,13 +51,12 @@
#include "NCZypp.h" // tryCastToZyppPkg(), tryCastToZyppPatch()
#include
-#include
#include "YWidgetID.h"
#include "YPackageSelector.h"
-typedef zypp::ui::PatchContents ZyppPatchContents;
-typedef zypp::ui::PatchContents::const_iterator ZyppPatchContentsIterator;
+typedef zypp::Patch::Contents ZyppPatchContents;
+typedef zypp::Patch::Contents::Selectable_iterator ZyppPatchContentsIterator;
#include
#include "YEvent.h"
@@ -262,20 +261,6 @@
return diff;
}
-string NCPackageSelector::getMenuId( YMenuItem *menuItem )
-{
- #if 0
- if ( menuItem )
- {
- YCPMenuItem * ycpMenuItem = dynamic_cast ( menuItem );
-
- if ( ycpMenuItem )
- return ycpMenuItem->id()->toString();
- }
- #endif
- return "";
-}
-
///////////////////////////////////////////////////////////////////
//
// handleEvent
@@ -313,7 +298,6 @@
{
if ( event.widget == actionMenu )
// change package/patch status
- //retVal = StatusHandler( event );
retVal = actionMenu->handleEvent( event );
else if ( event.widget == viewMenu )
// show package/patch information
@@ -363,11 +347,17 @@
if ( patchPtr )
{
- //if ( match( (*listIt)->name(), expr, true ) )
- //{
+ string name = patchPtr->name();
+
+ string::iterator pos = search( name.begin(), name.end(),
+ expr.begin(), expr.end(),
+ ic_compare );
+
+ if ( pos != name.end() )
+ {
// search sucessful
packageList->createPatchEntry( patchPtr, *listIt );
- // }
+ }
}
++listIt;
}
@@ -520,16 +510,16 @@
if ( !patchPtr )
return false;
- ZyppPatchContents patchContents( patchPtr );
-
- zypp::Patch::AtomList atomList = patchPtr->atoms();
- yuiMilestone() << "Filtering for patch: " << patchPtr->name().c_str() << " number of atoms: " << atomList.size() << endl ;
+ ZyppPatchContents patchContents( patchPtr->contents() );
+
+ yuiMilestone() << "Filtering for patch: " << patchPtr->name().c_str() << " number of atoms: "
+ << patchContents.size() << endl ;
- for ( ZyppPatchContentsIterator it = patchContents.begin();
- it != patchContents.end();
+ for ( ZyppPatchContentsIterator it = patchContents.selectableBegin();
+ it != patchContents.selectableEnd();
++it )
{
- ZyppPkg pkg = tryCastToZyppPkg( *it );
+ ZyppPkg pkg = tryCastToZyppPkg( (*it)->theObj() );
if ( pkg )
{
@@ -541,8 +531,8 @@
if ( inContainer( patchSelectables, sel ) )
{
yuiMilestone() << "Suppressing duplicate selectable: " << (*it)->name().c_str() << "-" <<
- (*it)->edition().asString().c_str() << " " <<
- (*it)->arch().asString().c_str() << endl;
+ pkg->edition().asString().c_str() << " " <<
+ pkg->arch().asString().c_str() << endl;
}
else
{
@@ -574,30 +564,12 @@
}
}
}
- else // No ZyppPkg - some other kind of object (script, message)
+ else // No ZyppPkg - some other kind of object
{
- if ( zypp::isKindzypp::Script ( *it ) )
- {
- vector<string> pkgLine;
- pkgLine.reserve(4);
+ y2debug( "Found unknown atom of kind %s: %s",
+ (*it)->kind().asString().c_str(),
+ (*it)->name().c_str() );
- pkgLine.push_back( (*it)->name() );
- pkgLine.push_back( " " ); // versions empty
- pkgLine.push_back( " " );
- pkgLine.push_back( NCPkgStrings::Script() );
-
- pkgTable->addLine( S_NoInst,
- pkgLine,
- ZyppObj(),
- ZyppSel()
- );
- }
- else
- {
- y2debug( "Found unknown atom of kind %s: %s",
- (*it)->kind().asString().c_str(),
- (*it)->name().c_str() );
- }
}
}
@@ -633,61 +605,26 @@
{
displayPatch = true;
}
- else if ( filter == "installed" )
- {
- if ( selectable->hasInstalledObj() )
- displayPatch = true;
- }
- else if ( filter == "installable" )
+ else if ( filter == "installed" ) // now means: satisfied
{
- if ( selectable->hasInstalledObj() ) // patch installed?
- {
- // display only if broken
- if ( selectable->installedPoolItem().isBroken() )
- {
- displayPatch = true;
- yuiWarning() << "Installed patch is broken: " << patchPtr->name().c_str() << " - "
- << patchPtr->summary().c_str() << endl;
- }
- }
- else // patch not installed
-
+ if ( selectable->hasCandidateObj() &&
+ selectable->candidateObj().isRelevant() &&
+ selectable->candidateObj().isSatisfied() )
{
- if (selectable->hasCandidateObj() &&
- selectable->candidateObj().isSatisfied() )
- {
- //patch not installed, but it is satisfied (updated to the version patch requires)
- //all that is missing are patch metadata, so let's display the patch
-
- displayPatch = true;
-
- yuiMilestone() << "Patch satisfied, but not installed yet: " << patchPtr->name().c_str() << " - "
- << patchPtr->summary().c_str() << endl;
- }
- }
-
- if (selectable->hasCandidateObj()) {
-
- // isNeeded(): this patch is relevant (contains updates for installed packages)
- // isSatisfied(): all packages are installed, therefore the isNeeded() flag
- // isn't set. BUT the patch meta data aren't installed and therefore it makes
- // sense to install the patch
- if ( selectable->candidateObj().status().isInstalled()
- && selectable->candidateObj().isBroken())
- {
displayPatch = true;
- }
- else
- {
- yuiMilestone() << "Patch not needed: " << patchPtr->name().c_str() << " - "
- << patchPtr->summary().c_str() << endl;
- }
}
}
- else if ( filter == "new" )
+ else if ( filter == "installable" ) // relevant patches
{
- if ( !selectable->hasInstalledObj() )
+ // 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" )
{
@@ -705,11 +642,6 @@
if ( patchPtr->category() == "optional" )
displayPatch = true;
}
- else if ( filter == "YaST2" )
- {
- if ( patchPtr->category() == "yast" )
- displayPatch = true;
- }
if ( displayPatch )
packageList->createPatchEntry( patchPtr, selectable );
@@ -1498,13 +1430,13 @@
if ( patch )
{
- ZyppPatchContents patchContents( patch );
+ ZyppPatchContents patchContents( patch->contents() );
- for ( ZyppPatchContentsIterator contents_it = patchContents.begin();
- contents_it != patchContents.end();
+ for ( ZyppPatchContentsIterator contents_it = patchContents.selectableBegin();
+ contents_it != patchContents.selectableEnd();
++contents_it )
{
- ZyppPkg pkg = tryCastToZyppPkg( *contents_it );
+ ZyppPkg pkg = tryCastToZyppPkg( (*contents_it)->theObj() );
ZyppSel sel;
if ( pkg )
Modified: trunk/ncurses-pkg/src/NCPackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.h?rev=47029&r1=47028&r2=47029&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelector.h (original)
+++ trunk/ncurses-pkg/src/NCPackageSelector.h Thu Apr 24 13:30:20 2008
@@ -76,6 +76,11 @@
class NCMenuButton;
class YReplacePoint;
+inline bool ic_compare ( char c1, char c2 )
+{
+ return ( toupper( c1 ) == toupper( c2 ) );
+}
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : NCPackageSelector
@@ -164,10 +169,6 @@
set<string> verified_pkgs;
- protected:
-
- string getMenuId( YMenuItem *menu );
-
public:
enum FilterMode
{
Modified: trunk/ncurses-pkg/src/NCPkgFilterSearch.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgFilterSearch.cc?rev=47029&r1=47028&r2=47029&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPkgFilterSearch.cc (original)
+++ trunk/ncurses-pkg/src/NCPkgFilterSearch.cc Thu Apr 24 13:30:20 2008
@@ -39,10 +39,7 @@
Textdomain "ncurses-pkg"
*/
-bool ic_compare ( char c1, char c2 )
-{
- return ( toupper( c1 ) == toupper( c2 ) );
-}
+
///////////////////////////////////////////////////////////////////
//
//
Modified: trunk/ncurses-pkg/src/NCPkgMenuFilter.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuFilter.cc?rev=47029&r1=47028&r2=47029&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPkgMenuFilter.cc (original)
+++ trunk/ncurses-pkg/src/NCPkgMenuFilter.cc Thu Apr 24 13:30:20 2008
@@ -41,8 +41,10 @@
// menu items of the filter menu for patches - keep them short
// and use unique hotkeys from begin: to end:
// begin:
- installable = new YMenuItem( _( "&Installable Patches" ) );
- installed = new YMenuItem( _( "Installed &Patches" ) );
+ needed = new YMenuItem( _( "&Needed Patches" ) );
+ // _( "Re&levant Patches")
+ satisfied = new YMenuItem( _( "&Satisfied Patches" ) );
+ unneeded = new YMenuItem( _( "&Unneeded Patches" ) );
allPatches = new YMenuItem( _( "&All Patches" ) );
recommended = new YMenuItem( _( "&Recommended" ) );
security = new YMenuItem( _( "&Security" ) );
@@ -50,8 +52,8 @@
// end:
search = new YMenuItem( _( "S&earch" ) );
- items.push_back( installable );
- items.push_back( installed );
+ items.push_back( needed );
+ items.push_back( satisfied );
items.push_back( allPatches );
items.push_back( recommended );
items.push_back( security );
@@ -83,9 +85,9 @@
// Call the appropriate method from NCPackageSelector for
// the selected menu entry.
- if ( event.selection == installable )
+ if ( event.selection == needed )
pkg->fillPatchList( "installable" ); // show installed patches
- else if ( event.selection == installed )
+ else if ( event.selection == satisfied )
pkg->fillPatchList( "installed" ); // show installed patches
else if ( event.selection == allPatches )
pkg->fillPatchList( "all" ); // show all patches
Modified: trunk/ncurses-pkg/src/NCPkgMenuFilter.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuFilter.h?rev=47029&r1=47028&r2=47029&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPkgMenuFilter.h (original)
+++ trunk/ncurses-pkg/src/NCPkgMenuFilter.h Thu Apr 24 13:30:20 2008
@@ -42,8 +42,9 @@
YItemCollection items;
- YMenuItem *installable;
- YMenuItem *installed;
+ YMenuItem *needed;
+ YMenuItem *satisfied;
+ YMenuItem *unneeded;
YMenuItem *allPatches;
YMenuItem *recommended;
YMenuItem *security;
Modified: trunk/ncurses-pkg/src/NCPkgStrings.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgStrings.cc?rev=47029&r1=47028&r2=47029&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPkgStrings.cc (original)
+++ trunk/ncurses-pkg/src/NCPkgStrings.cc Thu Apr 24 13:30:20 2008
@@ -953,7 +953,9 @@
{
// A label for a list of YOU Patches - keep it short - max 25 chars!
// (the list shows all patches which can be installed)
- static const string value = _( "Installable Patches" );
+ //static const string value = _( "Installable Patches" );
+ //static const string value = _( "Relevant Patches" );
+ static const string value = _( "Needed Patches" );
return value;
}
@@ -961,7 +963,9 @@
{
// 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 = _( "Installed 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