YQPkgPatchList QT3_SUPPORT
authordmacvicar <dmacvicar@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Sat, 8 Dec 2007 01:02:33 +0000 (01:02 +0000)
committerdmacvicar <dmacvicar@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Sat, 8 Dec 2007 01:02:33 +0000 (01:02 +0000)
git-svn-id: http://svn.opensuse.org/svn/yast/trunk/qt4@42836 e0cc52ee-31ee-0310-8b87-e83c4596d67c

src/pkg/YQPkgPatchList.cc

index c58d002..5a90b38 100644 (file)
@@ -18,8 +18,6 @@
 
 /-*/
 
-#define QT3_SUPPORT 1
-
 #define y2log_component "qt-pkg"
 #include <ycp/y2log.h>
 
@@ -54,13 +52,15 @@ YQPkgPatchList::YQPkgPatchList( QWidget * parent )
     _filterCriteria = RelevantPatches;
 
     int numCol = 0;
-#if FIXME
-    addColumn( "" );                   _statusCol      = numCol++;
-    addColumn( _( "Patch"      ) );    _nameCol        = numCol++;
-    addColumn( _( "Summary"    ) );    _summaryCol     = numCol++;
-    addColumn( _( "Category"   ) );    _categoryCol    = numCol++;
-    addColumn( _( "Size"       ) );    _sizeCol        = numCol++;
-    addColumn( _( "Version"    ) );    _versionCol     = numCol++;
+
+    QStringList headers;
+
+    headers << "";                     _statusCol      = numCol++;
+    headers <<  _( "Patch"     );      _nameCol        = numCol++;
+    headers << _( "Summary"    );      _summaryCol     = numCol++;
+    headers << _( "Category"   );      _categoryCol    = numCol++;
+    headers << _( "Size"       );      _sizeCol        = numCol++;
+    headers << _( "Version"    );      _versionCol     = numCol++;
 
     // Can use the same colum for "broken" and "satisfied":
     // Both states are mutually exclusive
@@ -68,15 +68,16 @@ YQPkgPatchList::YQPkgPatchList( QWidget * parent )
     _satisfiedIconCol  = _summaryCol;
     _brokenIconCol     = _summaryCol;
 
+    setHeaderLabels(headers);
+
     setAllColumnsShowFocus( true );
-    setColumnAlignment( sizeCol(), Qt::AlignRight );
+    //FIXME setColumnAlignment( sizeCol(), Qt::AlignRight );
 
     connect( this,     SIGNAL( currentItemChanged      ( QTreeWidgetItem * ) ),
             this,      SLOT  ( filter()                                    ) );
 
-    setSorting( categoryCol() );
+    sortItems( categoryCol(), Qt::AscendingOrder );
     fillList();
-#endif
 
     y2debug( "Creating patch list done" );
 }
@@ -374,9 +375,9 @@ YQPkgPatchList::createNotInstalledContextMenu()
     _notInstalledContextMenu = new QMenu( this );
     Q_CHECK_PTR( _notInstalledContextMenu );
 
-    actionSetCurrentInstall->addTo( _notInstalledContextMenu );
-    actionSetCurrentDontInstall->addTo( _notInstalledContextMenu );
-    actionSetCurrentTaboo->addTo( _notInstalledContextMenu );
+    _notInstalledContextMenu->addAction(actionSetCurrentInstall);
+    _notInstalledContextMenu->addAction(actionSetCurrentDontInstall);
+    _notInstalledContextMenu->addAction(actionSetCurrentTaboo);
 
     addAllInListSubMenu( _notInstalledContextMenu );
 }
@@ -388,14 +389,14 @@ YQPkgPatchList::createInstalledContextMenu()
     _installedContextMenu = new QMenu( this );
     Q_CHECK_PTR( _installedContextMenu );
 
-    actionSetCurrentKeepInstalled->addTo( _installedContextMenu );
+    _installedContextMenu->addAction(actionSetCurrentKeepInstalled);
 
 #if ENABLE_DELETING_PATCHES
-    actionSetCurrentDelete->addTo( _installedContextMenu );
+    _installedContextMenu->addAction(actionSetCurrentDelete);
 #endif
 
-    actionSetCurrentUpdate->addTo( _installedContextMenu );
-    actionSetCurrentProtected->addTo( _installedContextMenu );
+    _installedContextMenu->addAction(actionSetCurrentUpdate);
+    _installedContextMenu->addAction(actionSetCurrentProtected);
 
     addAllInListSubMenu( _installedContextMenu );
 }
@@ -407,20 +408,21 @@ YQPkgPatchList::addAllInListSubMenu( QMenu * menu )
     QMenu * submenu = new QMenu( menu );
     Q_CHECK_PTR( submenu );
 
-    actionSetListInstall->addTo( submenu );
-    actionSetListDontInstall->addTo( submenu );
-    actionSetListKeepInstalled->addTo( submenu );
+    submenu->addAction(actionSetListInstall);
+    submenu->addAction(actionSetListDontInstall);
+    submenu->addAction(actionSetListKeepInstalled);
 
 #if ENABLE_DELETING_PATCHES
-    actionSetListDelete->addTo( submenu );
+    submenu->addAction(actionSetListDelete);
 #endif
 
-    actionSetListUpdate->addTo( submenu );
-    actionSetListUpdateForce->addTo( submenu );
-    actionSetListTaboo->addTo( submenu );
-    actionSetListProtected->addTo( submenu );
+    submenu->addAction(actionSetListUpdate);
+    submenu->addAction(actionSetListUpdateForce);
+    submenu->addAction(actionSetListTaboo);
+    submenu->addAction(actionSetListProtected);
 
-    menu->insertItem( _( "&All in This List" ), submenu );
+    QAction *action = menu->addMenu(submenu);
+    action->setText(_( "&All in This List" ));
 
     return submenu;
 }
@@ -506,7 +508,7 @@ YQPkgPatchListItem::patchCategory( const string & category )
 YQPkgPatchCategory
 YQPkgPatchListItem::patchCategory( QString category )
 {
-    category = category.lower();
+    category = category.toLower();
 
     if ( category == "yast"            ) return YQPkgYaSTPatch;
     if ( category == "security"                ) return YQPkgSecurityPatch;
@@ -514,7 +516,7 @@ YQPkgPatchListItem::patchCategory( QString category )
     if ( category == "optional"                ) return YQPkgOptionalPatch;
     if ( category == "document"                ) return YQPkgDocumentPatch;
 
-    y2warning( "Unknown patch category \"%s\"", (const char *) category );
+    y2warning( "Unknown patch category \"%s\"", qPrintable(category) );
     return YQPkgUnknownPatchCategory;
 }