Author: dmacvicar
Date: Mon Dec 10 18:46:35 2007
New Revision: 42923
URL: http://svn.opensuse.org/viewcvs/yast?rev=42923&view=rev
Log:
various fixes
Modified:
trunk/qt4/src/QY2DiskUsageList.cc
trunk/qt4/src/QY2DiskUsageList.h
trunk/qt4/src/QY2ListView.cc
trunk/qt4/src/QY2ListView.h
trunk/qt4/src/pkg/YQPackageSelector.cc
trunk/qt4/src/pkg/YQPackageSelector.h
trunk/qt4/src/pkg/YQPkgDiskUsageList.cc
trunk/qt4/src/pkg/YQPkgDiskUsageList.h
trunk/qt4/src/pkg/YQPkgList.cc
trunk/qt4/src/pkg/YQPkgList.h
trunk/qt4/src/pkg/YQPkgObjList.cc
trunk/qt4/src/pkg/YQPkgObjList.h
trunk/qt4/src/pkg/YQPkgPatchList.cc
trunk/qt4/src/pkg/YQPkgPatchList.h
trunk/qt4/src/pkg/YQPkgPatternList.cc
trunk/qt4/src/pkg/YQPkgPatternList.h
trunk/qt4/src/pkg/YQPkgVersionsView.cc
trunk/qt4/src/pkg/YQPkgVersionsView.h
Modified: trunk/qt4/src/QY2DiskUsageList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/QY2DiskUsageList.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/QY2DiskUsageList.cc (original)
+++ trunk/qt4/src/QY2DiskUsageList.cc Mon Dec 10 18:46:35 2007
@@ -287,18 +287,14 @@
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-QY2DiskUsageListItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+ * Comparison function used for sorting the list.
+ * Reimplemented from QTreeWidgetItem
+ **/
+bool
+QY2DiskUsageListItem::operator<( const QTreeWidgetItem & otherListViewItem ) const
{
- QY2DiskUsageListItem * other = dynamic_cast (otherListViewItem);
+ const QY2DiskUsageListItem * other = dynamic_cast (&otherListViewItem);
+ int col = treeWidget()->sortColumn();
if ( other )
{
@@ -306,32 +302,23 @@
col == percentageBarCol() )
{
// Intentionally reverting sort order: Fullest first
-
- if ( this->usedPercent() < other->usedPercent() ) return 1;
- if ( this->usedPercent() > other->usedPercent() ) return -1;
- return 0;
+ return ( this->usedPercent() < other->usedPercent() );
}
else if ( col == usedSizeCol() )
{
- if ( this->usedSize() < other->usedSize() ) return -1;
- if ( this->usedSize() > other->usedSize() ) return 1;
- return 0;
+ return ( this->usedSize() < other->usedSize() );
}
else if ( col == freeSizeCol() )
{
- if ( this->freeSize() < other->freeSize() ) return -1;
- if ( this->freeSize() > other->freeSize() ) return 1;
- return 0;
+ return ( this->freeSize() < other->freeSize() );
}
else if ( col == totalSizeCol() )
{
- if ( this->totalSize() < other->totalSize() ) return -1;
- if ( this->totalSize() > other->totalSize() ) return 1;
- return 0;
+ return ( this->totalSize() < other->totalSize() );
}
}
- return QY2ListViewItem::compare( otherListViewItem, col, ascending );
+ return QY2ListViewItem::operator<( otherListViewItem );
}
/**
Modified: trunk/qt4/src/QY2DiskUsageList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/QY2DiskUsageList.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/QY2DiskUsageList.h (original)
+++ trunk/qt4/src/QY2DiskUsageList.h Mon Dec 10 18:46:35 2007
@@ -192,16 +192,9 @@
/**
* Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QY2ListViewItem.
+ * Reimplemented from QTreeWidgetItem
**/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
// Columns
Modified: trunk/qt4/src/QY2ListView.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/QY2ListView.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/QY2ListView.cc (original)
+++ trunk/qt4/src/QY2ListView.cc Mon Dec 10 18:46:35 2007
@@ -213,15 +213,14 @@
if ( item && ( item->flags() & Qt::ItemIsEnabled ) && item == _mousePressedItem )
{
-// FIXME
-// int col = header()->sectionAt( ev->pos().x() );
-//
-// if ( item == _mousePressedItem &&
-// col == _mousePressedCol &&
-// ev->button() == _mousePressedButton )
-// {
-// emit( columnClicked( ev->button(), item, col, ev->globalPos() ) );
-// }
+ int col = header()->logicalIndexAt( ev->pos().x() );
+
+ if ( item == _mousePressedItem &&
+ col == _mousePressedCol &&
+ ev->button() == _mousePressedButton )
+ {
+ emit( columnClicked( ev->button(), item, col, ev->globalPos() ) );
+ }
}
@@ -327,6 +326,7 @@
_sortByInsertionSequence = sortByInsertionSequence;
//FIXME sort();
header()->setClickable( ! _sortByInsertionSequence );
+
}
@@ -360,20 +360,10 @@
// NOP
}
-
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-QY2ListViewItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+bool
+QY2ListViewItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const
{
- bool sortByInsertionSequence = false;
+ bool sortByInsertionSequence = false;
QY2ListView * parentListView = dynamic_cast (treeWidget());
if ( parentListView )
@@ -381,33 +371,27 @@
if ( sortByInsertionSequence )
{
- QY2ListViewItem * other = dynamic_cast (otherListViewItem);
+ const QY2ListViewItem * other = dynamic_cast (&otherListViewItem);
if ( other )
{
- if ( this->serial() < other->serial() ) return -1;
- if ( this->serial() > other->serial() ) return 1;
- return 0;
+ return ( this->serial() < other->serial() );
}
// Still here? Try the other version: QY2CheckListItem.
- QY2CheckListItem * otherCheckListItem = dynamic_cast (otherListViewItem);
+ const QY2CheckListItem * otherCheckListItem = dynamic_cast (&otherListViewItem);
if ( otherCheckListItem )
{
- if ( this->serial() < otherCheckListItem->serial() ) return -1;
- if ( this->serial() > otherCheckListItem->serial() ) return 1;
- return 0;
+ return ( this->serial() < otherCheckListItem->serial() );
}
}
- //return QTreeWidgetItem::compare( otherListViewItem, col, ascending );
- return 0;
+ return QTreeWidgetItem::operator<(otherListViewItem);
}
-
// void
// QY2ListViewItem::paintCell( QPainter * painter,
// const QColorGroup & colorGroup,
@@ -424,13 +408,9 @@
// }
-
-
-
-
QY2CheckListItem::QY2CheckListItem( QY2ListView * parentListView,
const QString & text )
- : QTreeWidgetItem( parentListView, QStringList(text))
+ : QY2ListViewItem( parentListView, text)
{
setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
setCheckState(0, Qt::Unchecked);
@@ -440,7 +420,7 @@
QY2CheckListItem::QY2CheckListItem( QTreeWidgetItem * parentItem,
const QString & text )
- : QTreeWidgetItem( parentItem, QStringList(text))
+ : QY2ListViewItem( parentItem, text)
{
_serial = 0;
QY2ListView * parentListView = dynamic_cast ( treeWidget() );
@@ -455,53 +435,6 @@
}
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-QY2CheckListItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
-{
- bool sortByInsertionSequence = false;
- QY2ListView * parentListView = dynamic_cast (treeWidget());
-
- if ( parentListView )
- sortByInsertionSequence = parentListView->sortByInsertionSequence();
-
- if ( sortByInsertionSequence )
- {
- QY2CheckListItem * other = dynamic_cast (otherListViewItem);
-
- if ( other )
- {
- if ( this->serial() < other->serial() ) return -1;
- if ( this->serial() > other->serial() ) return 1;
- return 0;
- }
-
-
- // Still here? Try the other version: QY2ListViewItem.
-
- QY2ListViewItem * otherCheckListItem = dynamic_cast (otherListViewItem);
-
- if ( otherCheckListItem )
- {
- if ( this->serial() < otherCheckListItem->serial() ) return -1;
- if ( this->serial() > otherCheckListItem->serial() ) return 1;
- return 0;
- }
-
- }
-
- //FIXME return QTreeWidgetItem::compare( otherListViewItem, col, ascending );
- return 0;
-}
-
/*
void
QY2CheckListItem::paintCell( QPainter * painter,
Modified: trunk/qt4/src/QY2ListView.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/QY2ListView.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/QY2ListView.h (original)
+++ trunk/qt4/src/QY2ListView.h Mon Dec 10 18:46:35 2007
@@ -252,16 +252,9 @@
/**
* Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
* Reimplemented from QTreeWidgetItem
**/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
/**
* Return this item's serial number.
@@ -322,7 +315,7 @@
/**
* Enhanced QCheckListItem
**/
-class QY2CheckListItem: public QTreeWidgetItem
+class QY2CheckListItem: public QY2ListViewItem
{
public:
@@ -361,19 +354,6 @@
virtual void updateData() {}
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QTreeWidgetItem
- **/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
-
- /**
* Return this item's serial number.
* Useful for comparison functions that order by insertion sequence.
**/
Modified: trunk/qt4/src/pkg/YQPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPackageSelector.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPackageSelector.cc (original)
+++ trunk/qt4/src/pkg/YQPackageSelector.cc Mon Dec 10 18:46:35 2007
@@ -674,17 +674,17 @@
action->setText(_( "&View" ));
// Translators: This is about packages ending in "-devel", so don't translate that "-devel"!
- action = _viewMenu->addAction( _( "Show -de&vel Packages" ),
- this, SLOT( pkgExcludeRulesChanged( int ) ), Qt::Key_F7 );
- action->setChecked(true);
+ _showDevelAction = _viewMenu->addAction( _( "Show -de&vel Packages" ),
+ this, SLOT( pkgExcludeRulesChanged() ), Qt::Key_F7 );
+ _showDevelAction->setChecked(true);
_excludeDevelPkgs = new YQPkgObjList::ExcludeRule( _pkgList, QRegExp( ".*-devel(-\\d+bit)?$" ), _pkgList->nameCol() );
Q_CHECK_PTR( _excludeDevelPkgs );
_excludeDevelPkgs->enable( false );
// Translators: This is about packages ending in "-debuginfo", so don't translate that "-debuginfo"!
- action = _viewMenu->addAction( _( "Show -&debuginfo Packages" ),
- this, SLOT( pkgExcludeRulesChanged( int ) ), Qt::Key_F8 );
- action->setChecked(true);
+ _showDebugAction = _viewMenu->addAction( _( "Show -&debuginfo Packages" ),
+ this, SLOT( pkgExcludeRulesChanged() ), Qt::Key_F8 );
+ _showDebugAction->setChecked(true);
_excludeDebugInfoPkgs = new YQPkgObjList::ExcludeRule( _pkgList, QRegExp( ".*-debuginfo$" ), _pkgList->nameCol() );
Q_CHECK_PTR( _excludeDebugInfoPkgs );
_excludeDebugInfoPkgs->enable( false );
@@ -1388,21 +1388,23 @@
void
-YQPackageSelector::pkgExcludeRulesChanged( int menuItemID )
+YQPackageSelector::pkgExcludeRulesChanged()
{
-//FIXME
-// if ( _viewMenu && _pkgList )
-// {
-// _viewMenu->setItemChecked( menuItemID, ! _viewMenu->isItemChecked( menuItemID ) );
-//
-// if ( _excludeDevelPkgs )
-// _excludeDevelPkgs->enable( ! _viewMenu->isItemChecked( _viewShowDevelID ) );
-//
-// if ( _excludeDebugInfoPkgs )
-// _excludeDebugInfoPkgs->enable( ! _viewMenu->isItemChecked( _viewShowDebugInfoID ) );
-//
-// _pkgList->applyExcludeRules();
-// }
+ QAction *action = dynamic_cast(QObject::sender());
+
+ if ( _viewMenu && _pkgList )
+ {
+ //action->setChecked();
+ //_viewMenu->setItemChecked( menuItemID, ! _viewMenu->isItemChecked( menuItemID ) );
+
+ if ( _excludeDevelPkgs )
+ _excludeDevelPkgs->enable( ! _showDevelAction->isChecked() );
+
+ if ( _excludeDebugInfoPkgs )
+ _excludeDebugInfoPkgs->enable( ! _showDebugAction->isChecked() );
+
+ _pkgList->applyExcludeRules();
+ }
}
Modified: trunk/qt4/src/pkg/YQPackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPackageSelector.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPackageSelector.h (original)
+++ trunk/qt4/src/pkg/YQPackageSelector.h Mon Dec 10 18:46:35 2007
@@ -116,7 +116,7 @@
* or -devel packages) according to the current menu settings and apply the
* exclude rules.
**/
- void pkgExcludeRulesChanged( int menuItemID );
+ void pkgExcludeRulesChanged();
/**
* Display (generic) online help.
@@ -321,8 +321,8 @@
QMenu * _extrasMenu;
QMenu * _helpMenu;
- int _viewShowDevelID;
- int _viewShowDebugInfoID;
+ QAction *_showDevelAction;
+ QAction *_showDebugAction;
YQPkgObjList::ExcludeRule * _excludeDevelPkgs;
YQPkgObjList::ExcludeRule * _excludeDebugInfoPkgs;
Modified: trunk/qt4/src/pkg/YQPkgDiskUsageList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgDiskUsageList.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgDiskUsageList.cc (original)
+++ trunk/qt4/src/pkg/YQPkgDiskUsageList.cc Mon Dec 10 18:46:35 2007
@@ -83,7 +83,7 @@
YQPkgDiskUsageListItem * item = new YQPkgDiskUsageListItem( this, partitionDu );
Q_CHECK_PTR( item );
item->updateData();
- _items.insert( QByteArray(partitionDu.dir.c_str()), item );
+ _items.insert( QString::fromUtf8(partitionDu.dir.c_str()), item );
}
}
@@ -103,7 +103,7 @@
++it )
{
const ZyppPartitionDu & partitionDu = *it;
- YQPkgDiskUsageListItem * item = _items[ partitionDu.dir.c_str() ];
+ YQPkgDiskUsageListItem * item = _items[ QString::fromUtf8(partitionDu.dir.c_str()) ];
if ( item )
item->updateDuData( partitionDu );
Modified: trunk/qt4/src/pkg/YQPkgDiskUsageList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgDiskUsageList.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgDiskUsageList.h (original)
+++ trunk/qt4/src/pkg/YQPkgDiskUsageList.h Mon Dec 10 18:46:35 2007
@@ -23,7 +23,7 @@
#include
#include
#include <QKeyEvent>
-#include <QHash>
+#include <QMap>
#include <QByteArray>
typedef zypp::DiskUsageCounter::MountPoint ZyppPartitionDu;
@@ -189,7 +189,7 @@
// Data members
- QHash _items;
+ QMap _items;
bool _debug;
};
Modified: trunk/qt4/src/pkg/YQPkgList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgList.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgList.cc (original)
+++ trunk/qt4/src/pkg/YQPkgList.cc Mon Dec 10 18:46:35 2007
@@ -623,9 +623,7 @@
YQIconPool::disabledPkgNoInst();
}
}
-#if FIXME
- setPixmap( srpmStatusCol(), icon );
-#endif
+ setData( srpmStatusCol(), Qt::DecorationRole, icon );
}
@@ -730,21 +728,12 @@
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-YQPkgListItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+bool YQPkgListItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const
{
+ int col = treeWidget()->sortColumn();
if ( col == srpmStatusCol() )
{
- YQPkgListItem * other = dynamic_cast (otherListViewItem);
+ const YQPkgListItem * other = dynamic_cast (&otherListViewItem);
if ( other )
{
@@ -752,14 +741,12 @@
int otherPoints = ( other->hasSourceRpm() ? 1 : 0 ) + ( other->installSourceRpm() ? 1 : 0 );
// Intentionally inverting order: Pkgs with source RPMs are more interesting than without.
- if ( thisPoints > otherPoints ) return -1;
- if ( thisPoints < otherPoints ) return 1;
- return 0;
+ return ( thisPoints < otherPoints );
}
}
// Fallback: Use parent class method
- return YQPkgObjListItem::compare( otherListViewItem, col, ascending );
+ return YQPkgObjListItem::operator<( otherListViewItem );
}
#if 0
Modified: trunk/qt4/src/pkg/YQPkgList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgList.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgList.h (original)
+++ trunk/qt4/src/pkg/YQPkgList.h Mon Dec 10 18:46:35 2007
@@ -21,7 +21,6 @@
#define YQPkgList_h
#include
-//Added by qt3to4:
#include <QMenu>
class YQPkgListItem;
@@ -259,20 +258,10 @@
**/
bool hasSourceRpm() const;
-
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QListViewItem
- **/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
-
+ * sorting function
+ */
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
/**
* Update this item's data completely.
Modified: trunk/qt4/src/pkg/YQPkgObjList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgObjList.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgObjList.cc (original)
+++ trunk/qt4/src/pkg/YQPkgObjList.cc Mon Dec 10 18:46:35 2007
@@ -282,8 +282,7 @@
void
YQPkgObjList::setCurrentStatus( ZyppStatus newStatus, bool doSelectNextItem )
{
-#if FIXME
- QTreeWidgetItem * listViewItem = selectedItem();
+ QTreeWidgetItem * listViewItem = currentItem();
if ( ! listViewItem )
return;
@@ -312,7 +311,6 @@
if ( doSelectNextItem )
selectNextItem();
-#endif
}
@@ -358,16 +356,17 @@
void
YQPkgObjList::selectNextItem()
{
-#if FIXME
- QTreeWidgetItem * item = selectedItem();
+ QTreeWidgetItemIterator it(this);
+ QTreeWidgetItem * item;
- if ( item && item->nextSibling() )
+ while ( item = *it)
{
- item->setSelected( false ); // Doesn't emit signals
- ensureItemVisible( item->nextSibling() ); // Scroll if necessary
- setSelected( item->nextSibling(), true ); // Emits signals
+ ++it;
+ //item->setSelected( false ); // Doesn't emit signals
+ scrollToItem( *it ); // Scroll if necessary
+ setCurrentItem( *it ); // Emits signals
+
}
-#endif
}
@@ -536,9 +535,8 @@
void
YQPkgObjList::updateActions( YQPkgObjListItem * item )
{
-#if FIXME
if ( !item)
- item = dynamic_cast ( selectedItem() );
+ item = dynamic_cast ( currentItem() );
if ( item )
{
@@ -578,19 +576,17 @@
actionSetCurrentUpdate->setEnabled( false );
actionSetCurrentProtected->setEnabled( false );
}
-#endif
}
void
YQPkgObjList::keyPressEvent( QKeyEvent * event )
{
-#if FIXME
if ( event )
{
- unsigned special_combo = ( Qt::ControlButton | Qt::ShiftButton | Qt::AltButton );
+ int special_combo = ( Qt::ControlModifier | Qt::ShiftModifier | Qt::AltModifier );
- if ( ( event->state() & special_combo ) == special_combo )
+ if ( ( event->modifiers() & special_combo ) == special_combo )
{
if ( event->key() == Qt::Key_Q )
{
@@ -599,7 +595,7 @@
}
}
- QTreeWidgetItem * selectedListViewItem = selectedItem();
+ QTreeWidgetItem * selectedListViewItem = currentItem();
if ( selectedListViewItem )
{
@@ -610,14 +606,14 @@
bool installed = item->selectable()->hasInstalledObj();
ZyppStatus status = item->status();
- switch( event->ascii() )
+ switch( event->key() )
{
case Qt::Key_Space: // Cycle
item->cycleStatus();
event->accept();
return;
- case '+': // Grab everything - install or update
+ case Qt::Key_Plus: // Grab everything - install or update
if ( installed )
{
@@ -634,13 +630,13 @@
event->accept();
return;
- case '-': // Get rid of everything - don't install or delete
+ case Qt::Key_Minus: // Get rid of everything - don't install or delete
setCurrentStatus( installed ? S_Del : S_NoInst );
selectNextItem();
event->accept();
return;
- case '!': // Taboo
+ case Qt::Key_Exclam: // Taboo
if ( ! installed )
setCurrentStatus( S_Taboo );
@@ -648,7 +644,7 @@
event->accept();
return;
- case '*': // Protected
+ case Qt::Key_Asterisk: // Protected
if ( installed )
setCurrentStatus( S_Protected );
@@ -656,7 +652,7 @@
event->accept();
return;
- case '>': // Update what is worth to be updated
+ case Qt::Key_Greater: // Update what is worth to be updated
if ( installed && item->candidateIsNewer() )
setCurrentStatus( S_Update );
@@ -664,7 +660,7 @@
event->accept();
return;
- case '<': // Revert update
+ case Qt::Key_Less: // Revert update
if ( status == S_Update ||
status == S_AutoUpdate )
@@ -675,8 +671,7 @@
event->accept();
return;
- case 'b':
- case 'B': // Toggle debugIsBroken flag
+ case Qt::Key_B: // Toggle debugIsBroken flag
if ( _debug )
{
@@ -686,8 +681,7 @@
event->accept();
break;
- case 's':
- case 'S': // Toggle debugIsSatisfied flag
+ case Qt::Key_S: // Toggle debugIsSatisfied flag
if ( _debug )
{
@@ -700,7 +694,6 @@
}
}
}
-#endif
QY2ListView::keyPressEvent( event );
}
@@ -1051,18 +1044,17 @@
void
YQPkgObjListItem::setStatusIcon()
{
-#if FIXME
if ( statusCol() >= 0 )
{
bool enabled = editable() && _pkgObjList->editable();
- setPixmap( statusCol(), _pkgObjList->statusIcon( status(), enabled, bySelection() ) );
+ setData( statusCol(), Qt::DecorationRole, _pkgObjList->statusIcon( status(), enabled, bySelection() ) );
}
if ( brokenIconCol() >= 0 )
{
// Reset this icon now - it might be the same column as satisfiedIconCol()
- setPixmap( brokenIconCol(), QPixmap() );
+ setData( brokenIconCol(), Qt::DecorationRole, QPixmap() );
}
if ( satisfiedIconCol() >= 0 )
@@ -1071,7 +1063,7 @@
// but satisfied anyway (e.g. for patches or patterns where the user
// selected all required packages manually)
- setPixmap( satisfiedIconCol(), isSatisfied() ? YQIconPool::pkgSatisfied() : QPixmap() );
+ setData( satisfiedIconCol(), Qt::DecorationRole, isSatisfied() ? YQIconPool::pkgSatisfied() : QPixmap() );
}
if ( brokenIconCol() >= 0 )
@@ -1081,14 +1073,12 @@
if ( isBroken() )
{
- setPixmap( brokenIconCol(), YQIconPool::warningSign() );
-
+ setData( brokenIconCol(), Qt::DecorationRole, YQIconPool::warningSign() );
y2warning( "Broken object: %s - %s",
_selectable->theObj()->name().c_str(),
_selectable->theObj()->summary().c_str() );
}
}
-#endif
}
@@ -1378,29 +1368,19 @@
}
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-YQPkgObjListItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+
+bool YQPkgObjListItem::operator<( const QTreeWidgetItem & otherListViewItem ) const
{
- YQPkgObjListItem * other = dynamic_cast (otherListViewItem);
+ const YQPkgObjListItem * other = dynamic_cast (&otherListViewItem);
+ int col = treeWidget()->sortColumn();
if ( other )
{
if ( col == sizeCol() )
{
// Numeric sort by size
-
- if ( this->zyppObj()->size() < other->zyppObj()->size() ) return -1;
- if ( this->zyppObj()->size() > other->zyppObj()->size() ) return 1;
- return 0;
+
+ return ( this->zyppObj()->size() < other->zyppObj()->size() );
}
else if ( col == statusCol() )
{
@@ -1410,9 +1390,7 @@
// dangerous or noteworthy states first - e.g., "taboo" which should
// seldeom occur, but when it does, it is important.
- if ( this->status() < other->status() ) return -1;
- if ( this->status() > other->status() ) return 1;
- return 0;
+ return ( this->status() < other->status() );
}
else if ( col == instVersionCol() ||
col == versionCol() )
@@ -1430,14 +1408,13 @@
int thisPoints = this->versionPoints();
int otherPoints = other->versionPoints();
- if ( thisPoints > otherPoints ) return -1;
- if ( thisPoints < otherPoints ) return 1;
- return QY2ListViewItem::compare( otherListViewItem, col, ascending );
+ return ( thisPoints < otherPoints );
+ return QY2ListViewItem::operator<( otherListViewItem );
}
}
// Fallback: Use parent class method
- return QY2ListViewItem::compare( otherListViewItem, col, ascending );
+ return QY2ListViewItem::operator<( otherListViewItem );
}
Modified: trunk/qt4/src/pkg/YQPkgObjList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgObjList.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgObjList.h (original)
+++ trunk/qt4/src/pkg/YQPkgObjList.h Mon Dec 10 18:46:35 2007
@@ -516,17 +516,9 @@
bool showLicenseAgreement();
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QListViewItem
- **/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
+ * sorting function
+ */
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
/**
* Calculate a numerical value to compare versions, based on version
Modified: trunk/qt4/src/pkg/YQPkgPatchList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgPatchList.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgPatchList.cc (original)
+++ trunk/qt4/src/pkg/YQPkgPatchList.cc Mon Dec 10 18:46:35 2007
@@ -589,30 +589,18 @@
}
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-YQPkgPatchListItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+bool YQPkgPatchListItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const
{
- YQPkgPatchListItem * other = dynamic_cast (otherListViewItem);
-
+ const YQPkgPatchListItem * other = dynamic_cast (&otherListViewItem);
+ int col = treeWidget()->sortColumn();
if ( other )
{
if ( col == categoryCol() )
{
- if ( this->patchCategory() < other->patchCategory() ) return -1;
- if ( this->patchCategory() > other->patchCategory() ) return 1;
- return 0;
+ return ( this->patchCategory() < other->patchCategory() );
}
}
- return YQPkgObjListItem::compare( otherListViewItem, col, ascending );
+ return YQPkgObjListItem::operator<( otherListViewItem );
}
Modified: trunk/qt4/src/pkg/YQPkgPatchList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgPatchList.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgPatchList.h (original)
+++ trunk/qt4/src/pkg/YQPkgPatchList.h Mon Dec 10 18:46:35 2007
@@ -264,17 +264,9 @@
virtual QString toolTip( int column );
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QListViewItem.
- **/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
+ * sorting function
+ */
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
// Columns
Modified: trunk/qt4/src/pkg/YQPkgPatternList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgPatternList.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgPatternList.cc (original)
+++ trunk/qt4/src/pkg/YQPkgPatternList.cc Mon Dec 10 18:46:35 2007
@@ -333,30 +333,19 @@
}
-
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-YQPkgPatternListItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+bool YQPkgPatternListItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const
{
- YQPkgPatternListItem * otherPatternListitem = dynamic_cast(otherListViewItem);
+ const YQPkgPatternListItem * otherPatternListitem = dynamic_cast(&otherListViewItem);
if ( _zyppPattern && otherPatternListitem && otherPatternListitem->zyppPattern() )
return _zyppPattern->order().compare( otherPatternListitem->zyppPattern()->order() );
- YQPkgPatternCategoryItem * otherCategoryItem = dynamic_cast(otherListViewItem);
+ const YQPkgPatternCategoryItem * otherCategoryItem = dynamic_cast(&otherListViewItem);
if ( otherCategoryItem ) // Patterns without category should always be sorted
- return -1; // before any category
+ return true; // before any category
- return false; //FIXME QTreeWidgetItem::compare( otherListViewItem, col, ascending );
+ return QTreeWidgetItem::operator<( otherListViewItem );
}
@@ -416,31 +405,20 @@
}
-
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-YQPkgPatternCategoryItem::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+bool YQPkgPatternCategoryItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const
{
- YQPkgPatternCategoryItem * otherCategoryItem = dynamic_cast(otherListViewItem);
+ const YQPkgPatternCategoryItem * otherCategoryItem = dynamic_cast(&otherListViewItem);
if ( _firstPattern && otherCategoryItem && otherCategoryItem->firstPattern() )
return _firstPattern->order().compare( otherCategoryItem->firstPattern()->order() );
- YQPkgPatternListItem * otherPatternListitem = dynamic_cast(otherListViewItem);
+ const YQPkgPatternListItem * otherPatternListitem = dynamic_cast(&otherListViewItem);
if ( otherPatternListitem ) // Patterns without category should always be sorted
- return 1; // before any category
+ return true; // before any category
- return false; // FIXME QTreeWidgetItem::compare( otherListViewItem, col, ascending );
+ QTreeWidgetItem::operator<( otherListViewItem );
}
Modified: trunk/qt4/src/pkg/YQPkgPatternList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgPatternList.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgPatternList.h (original)
+++ trunk/qt4/src/pkg/YQPkgPatternList.h Mon Dec 10 18:46:35 2007
@@ -187,18 +187,9 @@
ZyppPattern zyppPattern() const { return _zyppPattern; }
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QListViewItem:
- * Sort by zypp::Pattern::order() only.
- **/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
+ * sorting function
+ */
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
// Columns
@@ -255,18 +246,9 @@
void addPattern( ZyppPattern pattern );
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QListViewItem:
- * Sort by zypp::Pattern::order() only.
- **/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
+ * sorting function
+ */
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
/*
* Open or close this subtree
Modified: trunk/qt4/src/pkg/YQPkgVersionsView.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgVersionsView.cc?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgVersionsView.cc (original)
+++ trunk/qt4/src/pkg/YQPkgVersionsView.cc Mon Dec 10 18:46:35 2007
@@ -75,7 +75,7 @@
this, SLOT ( reload (QWidget *) ) );
}
- connect( this, SIGNAL( currentItemChanged () ),
+ connect( this, SIGNAL( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ),
this, SLOT ( checkForChangedCandidate() ) );
}
@@ -310,29 +310,17 @@
}
-/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- **/
-int
-YQPkgVersion::compare( QTreeWidgetItem * otherListViewItem,
- int col,
- bool ascending ) const
+bool YQPkgVersion::operator< ( const QTreeWidgetItem & otherListViewItem ) const
{
- YQPkgVersion * other = dynamic_cast (otherListViewItem);
+ const YQPkgVersion * other = dynamic_cast (&otherListViewItem);
if ( other )
{
- if ( this->zyppObj()->edition() < other->zyppObj()->edition() ) return -1;
- if ( this->zyppObj()->edition() > other->zyppObj()->edition() ) return 1;
- return 0;
+ return ( this->zyppObj()->edition() < other->zyppObj()->edition() );
}
// Fallback: Use parent class method
- return QY2CheckListItem::compare( otherListViewItem, col, ascending );
+ return QY2CheckListItem::operator<( otherListViewItem );
}
Modified: trunk/qt4/src/pkg/YQPkgVersionsView.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgVersionsView.h?rev=42923&r1=42922&r2=42923&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgVersionsView.h (original)
+++ trunk/qt4/src/pkg/YQPkgVersionsView.h Mon Dec 10 18:46:35 2007
@@ -158,17 +158,9 @@
ZyppSel selectable() const { return _selectable; }
/**
- * Comparison function used for sorting the list.
- * Returns:
- * -1 if this < other
- * 0 if this == other
- * +1 if this > other
- *
- * Reimplemented from QListViewItem
- **/
- virtual int compare( QTreeWidgetItem * other,
- int col,
- bool ascending ) const;
+ * sorting function
+ */
+ virtual bool operator< ( const QTreeWidgetItem & other ) const;
/**
* Returns a tool tip text for a specific column of this item.
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org