[yast-commit] r39915 - in /branches/tmp/sh/mod-ui/qt/src/pkg: YQPkgPatchFilterView.cc YQPkgPatchFilterView.h YQPkgPatchList.cc YQPkgPatchList.h
Author: sh-sh-sh Date: Thu Aug 2 17:51:49 2007 New Revision: 39915 URL: http://svn.opensuse.org/viewcvs/yast?rev=39915&view=rev Log: show only update stack patches if there are any Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.cc branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.h branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.cc branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.h Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.cc?rev=39915&r1=39914&r2=39915&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.cc (original) +++ branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.cc Thu Aug 2 17:51:49 2007 @@ -53,6 +53,7 @@ : QVBox( parent ) { QVBox * vbox; + _haveUpdateStackPatches = YQPkgPatchList::haveUpdateStackPatches(); _splitter = new QSplitter( QSplitter::Vertical, this ); CHECK_PTR( _splitter ); vbox = new QVBox( _splitter ); CHECK_PTR( vbox ); @@ -68,9 +69,15 @@ _patchFilter = new QComboBox( hbox ); CHECK_PTR( _patchFilter ); - _patchFilter->insertItem( _( "Installable Patches" ), 0 ); - _patchFilter->insertItem( _( "Installable and Installed Patches" ), 1 ); - _patchFilter->insertItem( _( "All Patches" ), 2 ); + int index = 0; + + if ( _haveUpdateStackPatches ) + // Translators: This is about patches that patch the update engine (libzypp, YaST) itself + _patchFilter->insertItem( _( "Update Stack Patches" ), index++ ); + + _patchFilter->insertItem( _( "Installable Patches" ), index++ ); + _patchFilter->insertItem( _( "Installable and Installed Patches" ), index++ ); + _patchFilter->insertItem( _( "All Patches" ), index++ ); _patchFilter->setCurrentItem( 0 ); _patchFilter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert label->setBuddy( _patchFilter ); @@ -118,6 +125,7 @@ connect( _patchList, SIGNAL( statusChanged() ), this, SLOT ( updateTotalDownloadSize() ) ); + fillPatchList(); updateTotalDownloadSize(); } @@ -210,8 +218,14 @@ void YQPkgPatchFilterView::fillPatchList() { - switch ( _patchFilter->currentItem() ) + int currentIndex = _patchFilter->currentItem(); + + if ( _haveUpdateStackPatches ) + currentIndex--; + + switch ( currentIndex ) { + case -1: _patchList->setFilterCriteria( YQPkgPatchList::UpdateStackPatches ); break; case 0: _patchList->setFilterCriteria( YQPkgPatchList::RelevantPatches ); break; case 1: _patchList->setFilterCriteria( YQPkgPatchList::RelevantAndInstalledPatches ); break; case 2: _patchList->setFilterCriteria( YQPkgPatchList::AllPatches ); break; Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.h?rev=39915&r1=39914&r2=39915&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.h (original) +++ branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchFilterView.h Thu Aug 2 17:51:49 2007 @@ -90,6 +90,7 @@ QLabel * _totalDownloadSize; YQPkgSelMapper _selMapper; + bool _haveUpdateStackPatches; }; Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.cc?rev=39915&r1=39914&r2=39915&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.cc (original) +++ branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.cc Thu Aug 2 17:51:49 2007 @@ -34,7 +34,8 @@ #include "YQPkgTextDialog.h" -#define VERBOSE_PATCH_LIST 1 +#define VERBOSE_PATCH_LIST 1 +#define DEBUG_SHOW_ALL_UPDATE_STACK_PATCHES 0 typedef zypp::ui::PatchContents ZyppPatchContents; @@ -72,7 +73,6 @@ this, SLOT ( filter() ) ); setSorting( categoryCol() ); - fillList(); y2debug( "Creating patch list done" ); } @@ -122,6 +122,35 @@ switch ( _filterCriteria ) { + case UpdateStackPatches: + + if ( zyppPatch->affects_pkg_manager() ) + { +#if DEBUG_SHOW_ALL_UPDATE_STACK_PATCHES + displayPatch = true; +#endif + if ( selectable->hasCandidateObj() && + selectable->candidatePoolItem().status().isNeeded() ) + { + displayPatch = true; + + y2milestone( "Found YaST patch that should be installed: %s - %s", + zyppPatch->name().c_str(), + zyppPatch->summary().c_str() ); + } + + if ( selectable->hasInstalledObj() && + selectable->installedPoolItem().status().isIncomplete() ) // patch broken? + { + displayPatch = true; + + y2warning( "Installed YaST patch is broken: %s - %s", + zyppPatch->name().c_str(), + zyppPatch->summary().c_str() ); + } + } + break; + case RelevantPatches: // needed + broken + satisfied (but not installed) if ( selectable->hasInstalledObj() ) // installed? @@ -347,6 +376,34 @@ } +bool +YQPkgPatchList::haveUpdateStackPatches() +{ + for ( ZyppPoolIterator it = zyppPatchesBegin(); + it != zyppPatchesEnd(); + ++it ) + { + ZyppSel selectable = *it; + ZyppPatch zyppPatch = tryCastToZyppPatch( selectable->theObj() ); + + if ( zyppPatch && zyppPatch->affects_pkg_manager() ) + { +#if DEBUG_SHOW_ALL_UPDATE_STACK_PATCHES + return true; +#else + if ( selectable->hasCandidateObj() && + selectable->candidatePoolItem().status().isNeeded() ) + { + return true; + } +#endif + } + } + + return false; +} + + YQPkgPatchListItem * YQPkgPatchList::selection() const { Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.h?rev=39915&r1=39914&r2=39915&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.h (original) +++ branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgPatchList.h Thu Aug 2 17:51:49 2007 @@ -66,6 +66,7 @@ enum FilterCriteria { + UpdateStackPatches, // zypp or YaST2 RelevantPatches, // needed + broken RelevantAndInstalledPatches, // needed + broken + installed AllPatches // all @@ -111,6 +112,12 @@ public: /** + * Return 'true' if there is any patch for the update stack in the pool + * that is not installed yet or that could be updated. + **/ + static bool haveUpdateStackPatches(); + + /** * Set the filter criteria for fillList(). **/ void setFilterCriteria( FilterCriteria filterCriteria ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
sh-sh-sh@svn.opensuse.org