diff src/historywidget.cpp @ 621:f635e227775c

History widget stays on top when closing a branch.
author fpozo <pozofelipe@yahoo.es>
date Wed, 17 Oct 2012 12:15:25 +0200
parents 6f90bb52eee6
children 66adbedb69a9
line wrap: on
line diff
--- a/src/historywidget.cpp	Wed Sep 26 21:29:48 2012 +0100
+++ b/src/historywidget.cpp	Wed Oct 17 12:15:25 2012 +0200
@@ -71,7 +71,7 @@
     connect(m_showClosedBranches, SIGNAL(toggled(bool)), 
             this, SLOT(showClosedChanged(bool)));
     optLayout->addWidget(m_showClosedBranches, 0, 1, Qt::AlignRight);
-    m_showClosedBranches->hide();
+    //    m_showClosedBranches->hide();
 
     setLayout(layout);
 }
@@ -243,11 +243,24 @@
         toFocus = g.getUncommittedItem();
         if (!toFocus) {
             if (!m_currentIds.empty()) {
-                toFocus = g.getItemFor(m_currentIds[0]);
+                for (int i = 0; i < m_currentIds.size(); ++i) {
+                    toFocus = g.getItemFor(m_currentIds[i]);
+                    if (toFocus != 0) {
+                        break;
+                    }
+                }
             } else {
                 toFocus = g.getItemFor(m_changesets[0]);
             }
         }
+        if (!toFocus) {
+            for (int i = 0; i < m_changesets.size(); ++i) {
+                toFocus = g.getItemFor(m_changesets[i]);
+                if (toFocus != 0) {
+                    break;
+                }
+            }
+        }
     }
 
     m_panned->setScene(scene);