ref: refs/heads/master
commit d34ec05cc261640694b9c186eb853a89bf18c2f5
Author: Michael Andres
Date: Thu Dec 3 12:43:35 2009 +0100
Avoid null items in picklist
---
zypp/ui/SelectableImpl.h | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/zypp/ui/SelectableImpl.h b/zypp/ui/SelectableImpl.h
index f8f1fd5..54bb1e8 100644
--- a/zypp/ui/SelectableImpl.h
+++ b/zypp/ui/SelectableImpl.h
@@ -253,7 +253,7 @@ namespace zypp
{
if ( ! _picklistPtr )
{
- _picklistPtr.reset( new PickList( _availableItems.size() ) );
+ _picklistPtr.reset( new PickList );
// installed without identical avaialble first:
for_( it, _installedItems.begin(), _installedItems.end() )
{
@@ -467,6 +467,31 @@ namespace zypp
str << "} ";
}
+ if ( obj.picklistEmpty() )
+ {
+ str << "(P 0) {}";
+ }
+ else
+ {
+ PoolItem cand( obj.candidateObj() );
+ PoolItem up( obj.updateCandidateObj() );
+ str << "(P " << obj.picklistSize() << ") {" << endl;
+ for_( it, obj.picklistBegin(), obj.picklistEnd() )
+ {
+ char t = ' ';
+ if ( *it == cand )
+ {
+ t = *it == up ? 'C' : 'c';
+ }
+ else if ( *it == up )
+ {
+ t = 'u';
+ }
+ str << " " << t << " " << *it << "\t" << obj.pickStatus( *it ) << endl;
+ }
+ str << "} ";
+ }
+
return str;
}
/////////////////////////////////////////////////////////////////
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org