Author: dmacvicar
Date: Fri Apr 11 18:26:11 2008
New Revision: 46449
URL: http://svn.opensuse.org/viewcvs/yast?rev=46449&view=rev
Log:
- patch categories displayed nice, like patterns
Modified:
trunk/qt-pkg/src/YQPkgPatchList.cc
trunk/qt-pkg/src/YQPkgPatchList.h
trunk/qt-pkg/src/YQPkgPatternList.cc
trunk/qt-pkg/src/YQPkgRepoList.cc
Modified: trunk/qt-pkg/src/YQPkgPatchList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgPatchList.cc?rev=46449&r1=46448&r2=46449&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPkgPatchList.cc (original)
+++ trunk/qt-pkg/src/YQPkgPatchList.cc Fri Apr 11 18:26:11 2008
@@ -21,6 +21,8 @@
#define YUILogComponent "qt-pkg"
#include "YUILog.h"
+#include <QPainter>
+#include <QItemDelegate>
#include <QMenu>
#include <QAction>
#include <QEvent>
@@ -34,7 +36,7 @@
#include "YQPkgPatchList.h"
#include "YQPkgTextDialog.h"
-
+#include "YQIconPool.h"
#define VERBOSE_PATCH_LIST 1
@@ -45,6 +47,43 @@
using std::list;
using std::set;
+class YQPkgPatchItemDelegate : public QItemDelegate
+{
+ YQPkgPatchList *_view;
+public:
+ YQPkgPatchItemDelegate( YQPkgPatchList *parent ) : QItemDelegate( parent ), _view( parent ) {
+ }
+
+ virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
+ {
+ painter->save();
+ QColor background = option.palette.color(QPalette::Window);
+
+ YQPkgPatchCategoryItem *citem = dynamic_cast(_view->itemFromIndex(index));
+ // special painting for category items
+ if ( citem )
+ {
+ //std::cout << "printing category: " << index.column() << std::endl;
+ QFont f = painter->font();
+ f.setWeight(QFont::Bold);
+ f.setPointSize(f.pointSize()+1);
+ citem->setFont(_view->summaryCol(), f);
+
+ painter->fillRect(option.rect, option.palette.color(QPalette::AlternateBase));
+ QItemDelegate::paint(painter, option, index);
+ painter->restore();
+ return;
+ }
+
+ YQPkgPatchListItem *item = dynamic_cast(_view->itemFromIndex(index));
+ if ( item )
+ {
+ painter->restore();
+ QItemDelegate::paint(painter, option, index);
+ }
+ }
+};
+
YQPkgPatchList::YQPkgPatchList( QWidget * parent )
: YQPkgObjList( parent )
@@ -60,7 +99,7 @@
headers << ""; _statusCol = numCol++;
//headers << _( "Patch" ); _nameCol = numCol++;
headers << _( "Summary" ); _summaryCol = numCol++;
- headers << _( "Category" ); _categoryCol = numCol++;
+ //headers << _( "Category" ); _categoryCol = numCol++;
//headers << _( "Size" ); _sizeCol = numCol++;
//headers << _( "Version" ); _versionCol = numCol++;
@@ -76,6 +115,10 @@
header()->setResizeMode(_categoryCol, QHeaderView::ResizeToContents);
header()->setResizeMode(_summaryCol, QHeaderView::Interactive);
+
+ setItemDelegateForColumn( _summaryCol, new YQPkgPatchItemDelegate( this ) );
+ setItemDelegateForColumn( _statusCol, new YQPkgPatchItemDelegate( this ) );
+
setAllColumnsShowFocus( true );
//FIXME setColumnAlignment( sizeCol(), Qt::AlignRight );
@@ -106,6 +149,22 @@
selectSomething();
}
+YQPkgPatchCategoryItem *
+YQPkgPatchList::category( YQPkgPatchCategory category )
+{
+ YQPkgPatchCategoryItem * cat = _categories[ category ];
+
+ if ( ! cat )
+ {
+ yuiDebug() << "New patch category \""<< category << "\"" << endl;
+
+ cat = new YQPkgPatchCategoryItem( category, this );
+ Q_CHECK_PTR( cat );
+ _categories.insert( category, cat );
+ }
+
+ return cat;
+}
void
YQPkgPatchList::setFilterCriteria( FilterCriteria filterCriteria )
@@ -124,132 +183,132 @@
it != zyppPatchesEnd();
++it )
{
- ZyppSel selectable = *it;
- ZyppPatch zyppPatch = tryCastToZyppPatch( selectable->theObj() );
-
- if ( zyppPatch )
- {
- bool displayPatch = false;
+ ZyppSel selectable = *it;
+ ZyppPatch zyppPatch = tryCastToZyppPatch( selectable->theObj() );
- switch ( _filterCriteria )
- {
- 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
- {
- 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).
-
- 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?
- {
- 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;
-
- // Intentionally omitting "default" so the compiler
- // can catch unhandled enum values
- }
+ if ( zyppPatch )
+ {
+ bool displayPatch = false;
- if ( displayPatch )
- {
+ switch ( _filterCriteria )
+ {
+ 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
+ {
+ 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).
+
+ 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?
+ {
+ 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;
+
+ // Intentionally omitting "default" so the compiler
+ // can catch unhandled enum values
+ }
+
+ if ( displayPatch )
+ {
#if VERBOSE_PATCH_LIST
- yuiDebug() << "Displaying patch " << zyppPatch->name()
- << " - " << zyppPatch->summary()
- << endl;
+ yuiDebug() << "Displaying patch " << zyppPatch->name()
+ << " - " << zyppPatch->summary()
+ << endl;
#endif
- addPatchItem( *it, zyppPatch);
- }
- }
- else
- {
- yuiError() << "Found non-patch selectable" << endl;
- }
+ addPatchItem( *it, zyppPatch);
+ }
+ }
+ else
+ {
+ yuiError() << "Found non-patch selectable" << endl;
+ }
}
-
+
#if FIXME
if ( ! firstChild() )
- message( _( "No patches available." ) );
+ message( _( "No patches available." ) );
#endif
-
+
yuiDebug() << "Patch list filled" << endl;
resizeColumnToContents(_statusCol);
//resizeColumnToContents(_nameCol);
@@ -268,8 +327,6 @@
item->setBackgroundColor( 0, QColor( 0xE0, 0xE0, 0xF8 ) );
}
-
-
void
YQPkgPatchList::filterIfVisible()
{
@@ -323,12 +380,23 @@
{
if ( ! selectable )
{
- yuiError() << "NULL ZyppSel!" << endl;
- return;
+ yuiError() << "NULL ZyppSel!" << endl;
+ return;
}
- YQPkgPatchListItem * item = new YQPkgPatchListItem( this, selectable, zyppPatch );
+ YQPkgPatchCategoryItem * cat = category( YQPkgPatchCategoryItem::patchCategory(zyppPatch->category()));
+ YQPkgPatchListItem * item = 0;
+
+ if ( cat )
+ {
+ item = new YQPkgPatchListItem( this, cat, selectable, zyppPatch );
+ }
+ else
+ {
+ item = new YQPkgPatchListItem( this, selectable, zyppPatch );
+ }
applyExcludeRules( item );
+
}
@@ -432,7 +500,22 @@
}
+YQPkgPatchListItem::YQPkgPatchListItem( YQPkgPatchList * patchList,
+ YQPkgPatchCategoryItem * parentCategory,
+ ZyppSel selectable,
+ ZyppPatch zyppPatch )
+ : YQPkgObjListItem( patchList, parentCategory, selectable, zyppPatch )
+ , _patchList( patchList )
+ , _zyppPatch( zyppPatch )
+{
+ if ( ! _zyppPatch )
+ _zyppPatch = tryCastToZyppPatch( selectable->theObj() );
+
+ if ( ! _zyppPatch )
+ return;
+ init();
+}
YQPkgPatchListItem::YQPkgPatchListItem( YQPkgPatchList * patchList,
ZyppSel selectable,
@@ -441,30 +524,22 @@
, _patchList( patchList )
, _zyppPatch( zyppPatch )
{
+ if ( ! _zyppPatch )
+ _zyppPatch = tryCastToZyppPatch( selectable->theObj() );
+
if ( ! _zyppPatch )
- _zyppPatch = tryCastToZyppPatch( selectable->theObj() );
+ return;
- if ( ! _zyppPatch )
- return;
+ init();
+
+}
+void YQPkgPatchListItem::init()
+{
setStatusIcon();
- _patchCategory = patchCategory( _zyppPatch->category() );
-
- if ( categoryCol() > -1 )
- setText( categoryCol(), asString( _patchCategory ) );
-
+
if ( summaryCol() > -1 && _zyppPatch->summary().empty() )
- setText( summaryCol(), _zyppPatch->name() ); // use name as fallback
-
- switch ( _patchCategory )
- {
- case YQPkgYaSTPatch: setTextColor( 0, QColor( 0, 0, 0xC0 ) ); break; // medium blue
- case YQPkgSecurityPatch: setTextColor( 0, Qt::red ); break;
- case YQPkgRecommendedPatch: setTextColor( 0, QColor( 0, 0, 0xC0 ) ); break; // medium blue
- case YQPkgOptionalPatch: break;
- case YQPkgDocumentPatch: break;
- case YQPkgUnknownPatchCategory: break;
- }
+ setText( summaryCol(), _zyppPatch->name() ); // use name as fallback
}
@@ -473,48 +548,6 @@
// NOP
}
-
-YQPkgPatchCategory
-YQPkgPatchListItem::patchCategory( const string & category )
-{
- return patchCategory( fromUTF8( category ) );
-}
-
-
-YQPkgPatchCategory
-YQPkgPatchListItem::patchCategory( QString category )
-{
- category = category.toLower();
-
- if ( category == "yast" ) return YQPkgYaSTPatch;
- if ( category == "security" ) return YQPkgSecurityPatch;
- if ( category == "recommended" ) return YQPkgRecommendedPatch;
- if ( category == "optional" ) return YQPkgOptionalPatch;
- if ( category == "document" ) return YQPkgDocumentPatch;
-
- yuiWarning() << "Unknown patch category \"" << category << "\"" << endl;
- return YQPkgUnknownPatchCategory;
-}
-
-
-QString
-YQPkgPatchListItem::asString( YQPkgPatchCategory category )
-{
- switch ( category )
- {
- // Translators: These are patch categories
- case YQPkgYaSTPatch: return _( "YaST" );
- case YQPkgSecurityPatch: return _( "security" );
- case YQPkgRecommendedPatch: return _( "recommended" );
- case YQPkgOptionalPatch: return _( "optional" );
- case YQPkgDocumentPatch: return _( "document" );
- case YQPkgUnknownPatchCategory: return "";
- }
-
- return "";
-}
-
-
void
YQPkgPatchListItem::cycleStatus()
{
@@ -577,6 +610,114 @@
return YQPkgObjListItem::operator<( otherListViewItem );
}
+YQPkgPatchCategoryItem::YQPkgPatchCategoryItem( YQPkgPatchCategory category,
+ YQPkgPatchList * patchList )
+ : QY2ListViewItem( patchList )
+ , _patchList( patchList )
+{
+
+ _category = category;
+
+
+ if ( _patchList->categoryCol() > -1 )
+ setText( _patchList->summaryCol(), YQPkgPatchCategoryItem::asString( _category ) );
+
+
+ //setText( _patchList->summaryCol(), "Category" );
+
+ setExpanded( true );
+ setTreeIcon();
+}
+
+
+YQPkgPatchCategory
+YQPkgPatchCategoryItem::patchCategory( const string & category )
+{
+ return patchCategory( fromUTF8( category ) );
+}
+
+
+YQPkgPatchCategory
+YQPkgPatchCategoryItem::patchCategory( QString category )
+{
+ category = category.toLower();
+
+ if ( category == "yast" ) return YQPkgYaSTPatch;
+ if ( category == "security" ) return YQPkgSecurityPatch;
+ if ( category == "recommended" ) return YQPkgRecommendedPatch;
+ if ( category == "optional" ) return YQPkgOptionalPatch;
+ if ( category == "document" ) return YQPkgDocumentPatch;
+
+ yuiWarning() << "Unknown patch category \"" << category << "\"" << endl;
+ return YQPkgUnknownPatchCategory;
+}
+
+
+QString
+YQPkgPatchCategoryItem::asString( YQPkgPatchCategory category )
+{
+ switch ( category )
+ {
+ // Translators: These are patch categories
+ case YQPkgYaSTPatch: return _( "YaST" );
+ case YQPkgSecurityPatch: return _( "security" );
+ case YQPkgRecommendedPatch: return _( "recommended" );
+ case YQPkgOptionalPatch: return _( "optional" );
+ case YQPkgDocumentPatch: return _( "document" );
+ case YQPkgUnknownPatchCategory: return "";
+ }
+
+ return "";
+}
+
+
+YQPkgPatchCategoryItem::~YQPkgPatchCategoryItem()
+{
+ // NOP
+}
+
+void
+YQPkgPatchCategoryItem::addPatch( ZyppPatch patch )
+{
+ if ( ! _firstPatch )
+ {
+ _firstPatch = patch;
+ }
+ else
+ {
+ //if ( _firstPatch->order().compare( pattern->order() ) < 0 )
+ // _firstPatch = pattern;
+ }
+}
+
+
+void
+YQPkgPatchCategoryItem::setExpanded( bool open )
+{
+ QTreeWidgetItem::setExpanded( open );
+ setTreeIcon();
+}
+
+
+void
+YQPkgPatchCategoryItem::setTreeIcon()
+{
+ setIcon( _patchList->iconCol(),
+ isExpanded() ?
+ YQIconPool::treeMinus() :
+ YQIconPool::treePlus() );
+
+}
+
+
+bool YQPkgPatchCategoryItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const
+{
+ const YQPkgPatchCategoryItem * otherCategoryItem = dynamic_cast(&otherListViewItem);
+
+ return category() < otherCategoryItem->category();
+ return QTreeWidgetItem::operator<( otherListViewItem );
+}
+
#include "YQPkgPatchList.moc"
Modified: trunk/qt-pkg/src/YQPkgPatchList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgPatchList.h?rev=46449&r1=46448&r2=46449&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPkgPatchList.h (original)
+++ trunk/qt-pkg/src/YQPkgPatchList.h Fri Apr 11 18:26:11 2008
@@ -32,7 +32,7 @@
using std::string;
class YQPkgPatchListItem;
-
+class YQPkgPatchCategoryItem;
enum YQPkgPatchCategory // This is also the sort order
{
@@ -178,6 +178,10 @@
protected:
+ /**
+ * returns or creates a category item for a defined category
+ */
+ YQPkgPatchCategoryItem * category( YQPkgPatchCategory category );
/**
* Create the context menu for items that are not installed.
@@ -207,6 +211,7 @@
int _categoryCol;
YQPkgSelMapper _selMapper;
FilterCriteria _filterCriteria;
+ QMap _categories;
};
@@ -215,7 +220,7 @@
{
public:
- /**
+ /**
* Constructor. Creates a YQPkgPatchList item that corresponds to
* zyppPatch.
**/
@@ -223,31 +228,25 @@
ZyppSel selectable,
ZyppPatch zyppPatch );
- /**
- * Destructor
- **/
- virtual ~YQPkgPatchListItem();
-
- /**
- * Returns the original zyppPatch object.
- **/
- ZyppPatch zyppPatch() const { return _zyppPatch; }
/**
- * Maps a string patch category to the corresponding enum.
+ * Constructor. Creates a YQPkgPatchList item that corresponds to
+ * zyppPatch.
**/
- static YQPkgPatchCategory patchCategory( QString category );
- static YQPkgPatchCategory patchCategory( const string & category );
+ YQPkgPatchListItem( YQPkgPatchList * patchList,
+ YQPkgPatchCategoryItem * parentCategory,
+ ZyppSel selectable,
+ ZyppPatch zyppPatch );
/**
- * Converts a patch category to a user-readable (translated) string.
+ * Destructor
**/
- static QString asString( YQPkgPatchCategory category );
+ virtual ~YQPkgPatchListItem();
/**
- * Returns the category of this patch (security, recommended, ...).
+ * Returns the original zyppPatch object.
**/
- YQPkgPatchCategory patchCategory() const { return _patchCategory; }
+ ZyppPatch zyppPatch() const { return _zyppPatch; }
/**
* Cycle the package status to the next valid value.
@@ -274,9 +273,13 @@
int summaryCol() const { return _patchList->summaryCol(); }
int categoryCol() const { return _patchList->categoryCol(); }
+ /**
+ * Returns the category of this patch (security, recommended, ...).
+ **/
+ YQPkgPatchCategory patchCategory() const { return _patchCategory; }
protected:
-
+ void init();
/**
* Propagate status changes in this list to other lists:
* Have the solver transact all patches.
@@ -293,5 +296,79 @@
YQPkgPatchCategory _patchCategory;
};
+class YQPkgPatchCategoryItem: public QY2ListViewItem
+{
+public:
+
+ /**
+ * Constructor
+ **/
+ YQPkgPatchCategoryItem( YQPkgPatchCategory category, YQPkgPatchList * patternList );
+
+ /**
+ * Destructor
+ **/
+ virtual ~YQPkgPatchCategoryItem();
+
+ /**
+ * Returns the first pattern. This should be the first in sort order.
+ **/
+ ZyppPatch firstPatch() const { return _firstPatch; }
+
+ /**
+ * Add a pattern to this category. This method sets firstPatch() if necessary.
+ **/
+ void addPatch( ZyppPatch patch );
+
+ /**
+ * sorting function
+ */
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
+
+ /*
+ * Open or close this subtree
+ *
+ * Reimplemented from QListViewItem to force categories open at all times
+ **/
+ virtual void setExpanded( bool open );
+
+ /**
+ * Maps a string patch category to the corresponding enum.
+ **/
+ static YQPkgPatchCategory patchCategory( QString category );
+ static YQPkgPatchCategory patchCategory( const string & category );
+ /**
+ * Converts a patch category to a user-readable (translated) string.
+ **/
+ static QString asString( YQPkgPatchCategory category );
+
+
+ /**
+ * Category (and order ) for this item
+ */
+ YQPkgPatchCategory category() const { return _category; }
+
+
+protected:
+
+ /**
+ * Set a suitable tree open/close icon depending on this category's
+ * open/close status.
+ *
+ * The default QListView plus/minus icons would require treeStepSize() to
+ * be set >0 and rootItemDecorated( true ), but that would look very ugly
+ * in this context, so the pattern categories paint their own tree open /
+ * close icons.
+ **/
+ void setTreeIcon( void );
+ //
+ // Data members
+ //
+
+ YQPkgPatchCategory _category;
+ YQPkgPatchList * _patchList;
+ ZyppPatch _firstPatch;
+};
+
#endif // ifndef YQPkgPatchList_h
Modified: trunk/qt-pkg/src/YQPkgPatternList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgPatternList.cc?rev=46449&r1=46448&r2=46449&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPkgPatternList.cc (original)
+++ trunk/qt-pkg/src/YQPkgPatternList.cc Fri Apr 11 18:26:11 2008
@@ -286,6 +286,7 @@
}
+
void
YQPkgPatternList::filterIfVisible()
{
@@ -461,7 +462,11 @@
if (_zyppPattern)
{
- setIcon(_patternList->iconCol(), QIcon(QString("/usr/share/icons/hicolor/32x32/apps/") + _zyppPattern->icon().c_str() + QString(".png")));
+ string icon = _zyppPattern->icon().asString();
+ if ( icon == zypp::Pathname("yast-system").asString() )
+ icon = "pattern-generic";
+
+ setIcon(_patternList->iconCol(), QIcon(QString("/usr/share/icons/hicolor/32x32/apps/") + icon.c_str() + QString(".png")));
}
setStatusIcon();
Modified: trunk/qt-pkg/src/YQPkgRepoList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgRepoList.cc?rev=46449&r1=46448&r2=46449&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPkgRepoList.cc (original)
+++ trunk/qt-pkg/src/YQPkgRepoList.cc Fri Apr 11 18:26:11 2008
@@ -59,7 +59,7 @@
connect( this, SIGNAL( itemSelectionChanged() ),
this, SLOT ( filterIfVisible()) );
-
+ setIconSize(QSize(32,32));
fillList();
selectSomething();
@@ -249,23 +249,50 @@
}
#endif
- if ( ! name.empty() )
- setText( nameCol(), fromUTF8( name ));
+ if ( ! name.empty() )
+ {
+ //if ( ! repo.info().baseUrlsEmpty() )
+ // name += string("\n") + (*repo.info().baseUrlsBegin()).asString();
+ setText( nameCol(), fromUTF8( name ));
+ }
+
}
if ( urlCol() >= 0 )
{
zypp::Url repoUrl;
- if ( ! repo.info().baseUrlsEmpty() )
- repoUrl = *repo.info().baseUrlsBegin();
+ if ( ! repo.info().baseUrlsEmpty() )
+ repoUrl = *repo.info().baseUrlsBegin();
- //setText( urlCol(), repoUrl.asString().c_str() );
- setToolTip( 0, repoUrl.asString().c_str() );
- setToolTip( 1, repoUrl.asString().c_str() );
+ //setText( urlCol(), repoUrl.asString().c_str() );
+ setToolTip( 0, repoUrl.asString().c_str() );
+ setToolTip( 1, repoUrl.asString().c_str() );
}
- setIcon( 0, QIcon("/usr/share/icons/hicolor/48x48/apps/yast-sw_source.png") );
+ QString iconPath;
+ QString iconName = "yast-sw_source";
+
+ if ( ! repo.info().baseUrlsEmpty() )
+ {
+ zypp::Url repoUrl = *repo.info().baseUrlsBegin();
+ if (QString(repoUrl.asString().c_str()).contains("KDE") )
+ iconName = "pattern-kde";
+ if (QString(repoUrl.asString().c_str()).contains("GNOME") )
+ iconName = "pattern-gnome";
+ if (QString(repoUrl.asString().c_str()).contains("KDE") )
+ iconName = "pattern-kde";
+ if (QString(repoUrl.asString().c_str()).contains("update") )
+ iconName = "yast-update";
+ if (QString(repoUrl.asString().c_str()).contains("home:") )
+ iconName = "yast-users";
+ }
+
+ if ( repo.isSystemRepo() )
+ iconName = "yast-host";
+
+
+ setIcon( 0, QIcon( iconPath.sprintf("/usr/share/icons/hicolor/48x48/apps/%s.png", iconName.toUtf8().data()) ));
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org