Author: dmacvicar Date: Sat Apr 12 13:55:32 2008 New Revision: 46473 URL: http://svn.opensuse.org/viewcvs/yast?rev=46473&view=rev Log: - fix crash when refilling list (category map need to be cleared) - fix patches to display relevant ones (by simplifying the code) Modified: trunk/qt-pkg/src/YQPkgPatchList.cc trunk/qt-pkg/src/YQPkgPatternList.cc Modified: trunk/qt-pkg/src/YQPkgPatchList.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgPatchList.cc?rev=... ============================================================================== --- trunk/qt-pkg/src/YQPkgPatchList.cc (original) +++ trunk/qt-pkg/src/YQPkgPatchList.cc Sat Apr 12 13:55:32 2008 @@ -110,9 +110,11 @@ _brokenIconCol = _summaryCol; setHeaderLabels(headers); + setIndentation(0); + header()->setResizeMode(_statusCol, QHeaderView::ResizeToContents); //header()->setResizeMode(_versionCol, QHeaderView::ResizeToContents); - header()->setResizeMode(_categoryCol, QHeaderView::ResizeToContents); + //header()->setResizeMode(_categoryCol, QHeaderView::ResizeToContents); header()->setResizeMode(_summaryCol, QHeaderView::Interactive); @@ -125,7 +127,7 @@ connect( this, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem* ) ), this, SLOT ( filter() ) ); - sortItems( categoryCol(), Qt::AscendingOrder ); + //sortItems( categoryCol(), Qt::AscendingOrder ); fillList(); yuiDebug() << "Creating patch list done" << endl; @@ -172,10 +174,11 @@ _filterCriteria = filterCriteria; } - void YQPkgPatchList::fillList() { + _categories.clear(); + clear(); yuiDebug() << "Filling patch list" << endl; @@ -194,92 +197,25 @@ { case RelevantPatches: // needed + broken + satisfied (but not installed) - if ( selectable->hasInstalledObj() ) // installed? - { - if ( selectable->installedPoolItem().status().isInstalled() - && selectable->installedPoolItem().isBroken() ) // patch broken? - { - // The patch is broken: It had been installed, but the user somehow - // downgraded individual packages belonging to the patch to older versions. - - displayPatch = true; - - yuiWarning() << "Installed patch is broken: " - << zyppPatch->name() - << " - " << zyppPatch->summary() - << endl; - } - } - else // not installed + // only shows patches relevant to the system + if ( selectable->hasCandidateObj() && + selectable->candidateObj().isRelevant() ) { - if ( selectable->hasCandidateObj() && - selectable->candidateObj().isSatisfied() ) - { - // This is a pretty exotic case, but still it might happen: - // - // The patch itelf is not installed, but it is satisfied because the - // user updated all the packages belonging to the patch to the versions - // the patch requires. All that is missing now is to get the patch meta - // data onto the system. So let's display the patch to give the user - // a chance to install it (if he so chooses). - + // and only those that are needed + if ( ! selectable->candidateObj().isSatisfied() ) displayPatch = true; - - yuiMilestone() << "Patch satisfied, but not installed yet: " - << zyppPatch->name() - << " - " << zyppPatch->summary() - << endl; - } } - - if ( selectable->hasCandidateObj() ) // candidate available? - { - // The most common case: There is a candidate patch, i.e. one that could be - // installed, but either no version of that patch is installed or there is a - // newer one to which the patch could be updated. - - if ( selectable->candidateObj().status().isUninstalled() - && selectable->candidateObj().isBroken() ) // patch really needed? - { - // Patches are needed if any of the packages that belong to the patch - // are installed on the system. - - displayPatch = true; - } - else - { - // None of the packages that belong to the patch is installed on the system. - - yuiDebug() << "Patch not needed: " << zyppPatch->name() - << " - " << zyppPatch->summary() - << endl; - } - } - break; - - + case RelevantAndInstalledPatches: // needed + broken + installed - if ( selectable->hasInstalledObj() ) // installed? + // only shows patches relevant to the system + if ( selectable->hasCandidateObj() && + selectable->candidateObj().isRelevant() ) { + // now we show satisfied patches too displayPatch = true; } - else // not installed - display only if needed - { - if ( selectable->candidateObj().isBroken() ) - { - displayPatch = true; - } - else - { - yuiMilestone() << "Patch not needed: " << zyppPatch->name() - << " - " << zyppPatch->summary() - << endl; - } - } - break; - - + case AllPatches: displayPatch = true; break; @@ -290,11 +226,9 @@ if ( displayPatch ) { -#if VERBOSE_PATCH_LIST yuiDebug() << "Displaying patch " << zyppPatch->name() << " - " << zyppPatch->summary() << endl; -#endif addPatchItem( *it, zyppPatch); } } @@ -304,15 +238,10 @@ } } -#if FIXME - if ( ! firstChild() ) - message( _( "No patches available." ) ); -#endif - yuiDebug() << "Patch list filled" << endl; resizeColumnToContents(_statusCol); //resizeColumnToContents(_nameCol); - resizeColumnToContents(_categoryCol); + //resizeColumnToContents(_categoryCol); } @@ -378,13 +307,15 @@ YQPkgPatchList::addPatchItem( ZyppSel selectable, ZyppPatch zyppPatch ) { - if ( ! selectable ) + if ( ! selectable || ! zyppPatch ) { yuiError() << "NULL ZyppSel!" << endl; return; } - YQPkgPatchCategoryItem * cat = category( YQPkgPatchCategoryItem::patchCategory(zyppPatch->category())); + YQPkgPatchCategory ncat = YQPkgPatchCategoryItem::patchCategory(zyppPatch->category()); + + YQPkgPatchCategoryItem * cat = category(ncat); YQPkgPatchListItem * item = 0; if ( cat ) @@ -395,7 +326,9 @@ { item = new YQPkgPatchListItem( this, selectable, zyppPatch ); } - applyExcludeRules( item ); + + if (item) + applyExcludeRules( item ); } @@ -508,11 +441,6 @@ , _patchList( patchList ) , _zyppPatch( zyppPatch ) { - if ( ! _zyppPatch ) - _zyppPatch = tryCastToZyppPatch( selectable->theObj() ); - - if ( ! _zyppPatch ) - return; init(); } @@ -524,12 +452,6 @@ , _patchList( patchList ) , _zyppPatch( zyppPatch ) { - if ( ! _zyppPatch ) - _zyppPatch = tryCastToZyppPatch( selectable->theObj() ); - - if ( ! _zyppPatch ) - return; - init(); } Modified: trunk/qt-pkg/src/YQPkgPatternList.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgPatternList.cc?re... ============================================================================== --- trunk/qt-pkg/src/YQPkgPatternList.cc (original) +++ trunk/qt-pkg/src/YQPkgPatternList.cc Sat Apr 12 13:55:32 2008 @@ -232,6 +232,8 @@ void YQPkgPatternList::fillList() { + _categories.clear(); + clear(); yuiDebug() << "Filling pattern list" << endl; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org