clicking packages work! so the package selector is now master
authordmacvicar <dmacvicar@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Sat, 15 Dec 2007 00:18:15 +0000 (00:18 +0000)
committerdmacvicar <dmacvicar@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Sat, 15 Dec 2007 00:18:15 +0000 (00:18 +0000)
at least usable, except for conflict solving

git-svn-id: http://svn.opensuse.org/svn/yast/trunk/qt@43101 e0cc52ee-31ee-0310-8b87-e83c4596d67c

src/QY2ListView.cc
src/QY2ListView.h
src/pkg/YQPkgConflictList.cc
src/pkg/YQPkgLangList.cc
src/pkg/YQPkgObjList.cc
src/pkg/YQPkgPatternList.cc
src/pkg/YQPkgPatternList.h

index 516bb9e..55d9f78 100644 (file)
@@ -24,6 +24,8 @@
 #include <QMouseEvent>
 #include "QY2ListView.h"
 
+#define y2log_component "qt-pkg"
+#include <ycp/y2log.h>
 
 QY2ListView::QY2ListView( QWidget * parent )
     : QTreeWidget( parent )
@@ -183,15 +185,16 @@ QY2ListView::restoreColumnWidths()
 
 
 void
-QY2ListView::contentsMousePressEvent( QMouseEvent * ev )
+QY2ListView::mousePressEvent( QMouseEvent * ev )
 {
-    //FIXME may be convert to global
-    QTreeWidgetItem * item = itemAt( mapToGlobal( ev->pos() ) );
+    //y2internal("POS is %d %d", ev->pos().x(), ev->pos().y() );
+    QTreeWidgetItem * item = itemAt( ev->pos() );
+
 
     if ( item && ( item->flags() & Qt::ItemIsEnabled ) )
     {
        _mousePressedItem       = item;
-//FIXME        _mousePressedCol        = header()->sectionAt( ev->pos().x() );
+                _mousePressedCol       = header()->logicalIndexAt( ev->pos().x() );
        _mousePressedButton     = ev->button();
     }
     else       // invalidate last click data
@@ -202,19 +205,20 @@ QY2ListView::contentsMousePressEvent( QMouseEvent * ev )
     }
 
     // Call base class method
-    //FIXME QTreeWidget::contentsMousePressEvent( ev );
+    QTreeWidget::mousePressEvent( ev );
 }
 
 
 void
-QY2ListView::contentsMouseReleaseEvent( QMouseEvent * ev )
+QY2ListView::mouseReleaseEvent( QMouseEvent * ev )
 {
-    QTreeWidgetItem * item = itemAt( mapToGlobal( ev->pos() ) );
+    //y2internal("REPOS is %d %d", ev->pos().x(), ev->pos().y() );
+    QTreeWidgetItem * item = itemAt( ev->pos() );
 
     if ( item && ( item->flags() & Qt::ItemIsEnabled ) && item == _mousePressedItem )
     {
        int col = header()->logicalIndexAt( ev->pos().x() );
-
+        //y2internal("COL %d", col);
        if ( item == _mousePressedItem  &&
             col  == _mousePressedCol   &&
             ev->button() == _mousePressedButton )
@@ -231,12 +235,12 @@ QY2ListView::contentsMouseReleaseEvent( QMouseEvent * ev )
     _mousePressedButton        = Qt::NoButton;
 
     // Call base class method
-    //FIXME QTreeWidget::contentsMouseReleaseEvent( ev );
+    QTreeWidget::mouseReleaseEvent( ev );
 }
 
 
 void
-QY2ListView::contentsMouseDoubleClickEvent( QMouseEvent * ev )
+QY2ListView::mouseDoubleClickEvent( QMouseEvent * ev )
 {
     QTreeWidgetItem * item = itemAt( mapToGlobal( ev->pos() ) );
 
@@ -252,8 +256,8 @@ QY2ListView::contentsMouseDoubleClickEvent( QMouseEvent * ev )
      _mousePressedCol  = -1;
      _mousePressedButton       = Qt::NoButton;
 
-//     // Call base class method
-//     QTreeWidget::contentsMouseDoubleClickEvent( ev );
+     // Call base class method
+     QTreeWidget::mouseDoubleClickEvent( ev );
 }
 
 
index 6bbe422..3aec4df 100644 (file)
@@ -175,19 +175,19 @@ protected:
      * Handle mouse clicks.
      * Reimplemented from QScrollView.
      **/
-    virtual void contentsMousePressEvent( QMouseEvent * e );
+    virtual void mousePressEvent( QMouseEvent * e );
 
     /**
      * Handle mouse clicks.
      * Reimplemented from QScrollView.
      **/
-    virtual void contentsMouseReleaseEvent( QMouseEvent * );
+    virtual void mouseReleaseEvent( QMouseEvent * );
 
     /**
      * Handle mouse clicks.
      * Reimplemented from QScrollView.
      **/
-    virtual void contentsMouseDoubleClickEvent( QMouseEvent * );
+    virtual void mouseDoubleClickEvent( QMouseEvent * );
 
 
     //
index e948880..f5baa37 100644 (file)
@@ -308,9 +308,7 @@ YQPkgConflict::YQPkgConflict( YQPkgConflictList *           parentList,
     , _resolutionsHeader( 0 )
 {
     setBackgroundColor( LIGHT_BLUE );
-#if FIXME
     setExpanded( true );
-#endif
 
     formatHeading();
     YQPkgConflictList::dumpList( this, fromUTF8( _problem->details() ) );
@@ -326,9 +324,7 @@ YQPkgConflict::formatHeading()
     QPixmap icon = YQIconPool::normalPkgConflict();
     setTextColor( BRIGHT_RED );
 
-#if FIXME
-    setText( 0, Qt::DisplayRole, fromUTF8( problem()->description() ) );
-#endif
+    setData( 0, Qt::DisplayRole, fromUTF8( problem()->description() ) );
     setData( 0, Qt::DecorationRole, icon );
 }
 
index 2f3f03d..1be27f8 100644 (file)
@@ -174,16 +174,12 @@ YQPkgLangList::addLangItem( ZyppSel       selectable,
 YQPkgLangListItem *
 YQPkgLangList::selection() const
 {
-#if FIXME
-    Q3ListViewItem * item = selectedItem();
+    QTreeWidgetItem * item = currentItem();
 
     if ( ! item )
        return 0;
 
     return dynamic_cast<YQPkgLangListItem *> (item);
-#else
-    return 0;
-#endif
 }
 
 
index b2ee8c4..ab3a82a 100644 (file)
@@ -145,6 +145,7 @@ YQPkgObjList::pkgObjClicked( int            button,
 
     if ( item )
     {
+        //y2internal("CLICKED: %s", item->zyppObj()->name().c_str());
        if ( button == Qt::LeftButton )
        {
            if ( col == statusCol() )
index ff89505..3c2301c 100644 (file)
@@ -215,16 +215,12 @@ YQPkgPatternList::addPatternItem( ZyppSel selectable,
 YQPkgPatternListItem *
 YQPkgPatternList::selection() const
 {
-#if FIXME
     QTreeWidgetItem * item = currentItem();
 
     if ( ! item )
        return 0;
 
     return dynamic_cast<YQPkgPatternListItem *> (item);
-#else
-    return 0;
-#endif
 }
 
 
@@ -234,7 +230,6 @@ YQPkgPatternList::pkgObjClicked( int                        button,
                                 int                    col,
                                 const QPoint &         pos )
 {
-#if FIXME
     YQPkgPatternCategoryItem * categoryItem
        = dynamic_cast<YQPkgPatternCategoryItem *> (listViewItem);
 
@@ -244,7 +239,7 @@ YQPkgPatternList::pkgObjClicked( int                        button,
        {
            if ( col == statusCol() )
            {
-               categoryItem->setOpen( ! categoryItem->isExpanded() );
+               categoryItem->setExpanded( ! categoryItem->isExpanded() );
            }
        }
     }
@@ -252,7 +247,6 @@ YQPkgPatternList::pkgObjClicked( int                        button,
     {
        YQPkgObjList::pkgObjClicked( button, listViewItem, col, pos );
     }
-#endif
 }
 
 
@@ -360,7 +354,7 @@ YQPkgPatternCategoryItem::YQPkgPatternCategoryItem( YQPkgPatternList *      patternLi
 {
     setText( _patternList->summaryCol(), category );
     setBackgroundColor( CATEGORY_BACKGROUND );
-    setOpen( true );
+    setExpanded( true );
     setTreeIcon();
 }
 
@@ -386,9 +380,9 @@ YQPkgPatternCategoryItem::addPattern( ZyppPattern pattern )
 
 
 void
-YQPkgPatternCategoryItem::setOpen( bool open )
+YQPkgPatternCategoryItem::setExpanded( bool open )
 {
-    //FIXME QTreeWidgetItem::setOpen( open );
+    QTreeWidgetItem::setExpanded( open );
     setTreeIcon();
 }
 
@@ -396,12 +390,11 @@ YQPkgPatternCategoryItem::setOpen( bool open )
 void
 YQPkgPatternCategoryItem::setTreeIcon()
 {
-#if FIXME
-    setPixmap( _patternList->statusCol(),
-              isOpen() ?
+    setData( _patternList->statusCol(), Qt::DecorationRole,
+              isExpanded() ?
               YQIconPool::treeMinus() :
               YQIconPool::treePlus()   );
-#endif
+
 }
 
 
index 8f5ac33..72ff411 100644 (file)
@@ -255,7 +255,7 @@ public:
      *
      * Reimplemented from QListViewItem to force categories open at all times
      **/
-    virtual void setOpen( bool open );
+    virtual void setExpanded( bool open );
     
 
 protected: