- Don't crash on warnings (where is that NDEBUG defined?)
authordmacvicar <dmacvicar@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Fri, 14 Dec 2007 17:16:59 +0000 (17:16 +0000)
committerdmacvicar <dmacvicar@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Fri, 14 Dec 2007 17:16:59 +0000 (17:16 +0000)
- Fix iterating the hash on ComboTabWidget

Now sw_single starts!

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

src/QY2ComboTabWidget.cc
src/QY2ComboTabWidget.h
src/YQUI_core.cc
src/pkg/YQPkgConflictList.cc
src/pkg/YQPkgVersionsView.cc

index eebe9f7..66d6476 100644 (file)
@@ -68,7 +68,7 @@ QY2ComboTabWidget::QY2ComboTabWidget( const QString & label,
     combo_label->setBuddy( combo_box );
     combo_box->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert
     connect( combo_box, SIGNAL( activated( int ) ),
-            this,      SLOT  ( showPage ( int ) ) );
+            this,      SLOT  ( showPageIndex ( int ) ) );
     
     widget_stack = new QStackedWidget( this );
     Q_CHECK_PTR( widget_stack );
@@ -96,12 +96,11 @@ QY2ComboTabWidget::addPage( const QString & page_label, QWidget * new_page )
 
 
 void
-QY2ComboTabWidget::showPage( int index )
+QY2ComboTabWidget::showPageIndex( int index )
 {
-    QWidget * page = pages[ index ];
-
-    if ( page )
+    if ( pages.contains(index) )
     {
+        QWidget * page = pages[ index ];
        widget_stack->setCurrentWidget( page );
        // y2debug( "Changing current page" );
        emit currentChanged( page );
@@ -121,12 +120,11 @@ QY2ComboTabWidget::showPage( QWidget * page )
 
     if ( page == pages[ combo_box->currentIndex() ] )
     {
-       // Shortcut: If the requested page is the one that belongs to the item
-       // currently selected in the combo box, don't bother searching the
-       // correct combo box item.
-       return;
+          // Shortcut: If the requested page is the one that belongs to the item
+          // currently selected in the combo box, don't bother searching the
+          // correct combo box item.
+          return;
     }
-
     
     // Search the dict for this page
     
@@ -134,13 +132,12 @@ QY2ComboTabWidget::showPage( QWidget * page )
 
     while ( it.hasNext() )
     {
+        it.next();
        if ( page == it.value() )
        {
            combo_box->setCurrentIndex( it.key() );
            return;
        }
-
-       it.next();
     }
 
     // If we come this far, that page isn't present in the dict.
index 030e9c1..d981ed8 100644 (file)
@@ -87,7 +87,7 @@ protected slots:
      * Show a page identified by its index. Does NOT update the combo box
      * contents.
      **/
-    void showPage( int index );
+    void showPageIndex( int index );
 
 
 protected:
index 7272122..55e12de 100644 (file)
@@ -581,13 +581,13 @@ qMessageHandler( QtMsgType type, const char * msg )
        case QtWarningMsg:
            y2warning ("qt-warning: %s\n", msg);
 #ifndef NDEBUG
-           abort();
+           //abort();
 #endif
            break;
        case QtCriticalMsg:
            y2warning ("qt-critical: %s\n", msg);
 #ifndef NDEBUG
-            abort();
+            //abort();
 #endif
            break;
        case QtFatalMsg:
index ec2701f..e948880 100644 (file)
@@ -341,9 +341,8 @@ YQPkgConflict::addSolutions()
                                               // how to resolve this conflict
                                               _( "Conflict Resolution:" ) );
     Q_CHECK_PTR( _resolutionsHeader );
-#if FIXME
+
     _resolutionsHeader->setExpanded( true );
-#endif
     _resolutionsHeader->setBackgroundColor( LIGHT_GREY );
 
     zypp::ProblemSolutionList solutions = problem()->solutions();
@@ -377,15 +376,14 @@ YQPkgConflict::addSolutions()
 zypp::ProblemSolution_Ptr
 YQPkgConflict::userSelectedResolution()
 {
-    int count = 0;
     QTreeWidgetItem * item;
+    QTreeWidgetItemIterator it(_resolutionsHeader);
 
-#if FIXME
-    while ( item = _resolutionsHeader->topLevelItem(count) )
+    while ( (item = *it) )
     {
        YQPkgConflictResolution * res = dynamic_cast<YQPkgConflictResolution *> (item);
 
-       if ( res && res->( checkState(0) == Qt::Checked ) )
+       if ( res && ( res->checkState(0) == Qt::Checked ) )
        {
            zypp::ProblemSolution_Ptr solution = res->solution();
 
@@ -395,10 +393,9 @@ YQPkgConflict::userSelectedResolution()
            return solution;
        }
 
-       count++;
+        ++it;
     }
 
-#endif
     return zypp::ProblemSolution_Ptr();                // Null pointer
 }
 
index 45124d4..cea23cf 100644 (file)
@@ -163,7 +163,7 @@ YQPkgVersionsView::checkForChangedCandidate()
 {
     QTreeWidgetItemIterator iter(this);
     QTreeWidgetItem *first = *iter;
-#if FIXME
+
     if ( ! first || ! _selectable )
        return;
 
@@ -174,7 +174,7 @@ YQPkgVersionsView::checkForChangedCandidate()
     {
        YQPkgVersion * versionItem = dynamic_cast<YQPkgVersion *> (*iter_c);
 
-       if ( versionItem && versionItem->isOn() )
+       if ( versionItem && (versionItem->checkState(0) == Qt::Checked) )
        {
            ZyppObj newCandidate = versionItem->zyppObj();
 
@@ -230,7 +230,6 @@ YQPkgVersionsView::checkForChangedCandidate()
 
        ++iter_c;
     }
-#endif
 }