[tor-commits] [vidalia/alpha] Fix wrong behavior when closing a detached tab

chiiph at torproject.org chiiph at torproject.org
Sat Jul 2 21:59:21 UTC 2011


commit 9703e5eef492e34d80c95bec6912e531158f42b9
Author: Tomas Touceda <chiiph at gentoo.org>
Date:   Tue May 24 15:15:49 2011 -0300

    Fix wrong behavior when closing a detached tab
    
    The reattach menu didn't remove the corresponding action when a detached
    tab was closed without being reattached first.
---
 src/vidalia/MainWindow.cpp |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index 6ee1883..73f610c 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -1556,11 +1556,27 @@ MainWindow::handleAttachedClose()
   qWarning() << index;
   if(index < 0) {
     qWarning() << "DETACHEEEEDDDDDDDDDDDDD";
-    tab->setParent(ui.tabWidget);
+    QAction *act = 0;
+    foreach(QAction *tmpAct, _reattachMenu.actions()) {
+      if(tmpAct->parent() == tab) {
+        act = tmpAct;
+        break;
+      }
+    }
+
+    if(act != 0)
+      _reattachMenu.removeAction(act);
 
     _detachedTabMap.removeAll(tab->getTitle());
 
+    tab->setParent(ui.tabWidget);
     addTab(tab);
+
+    if(_reattachMenu.actions().size() < 1) {
+      _reattachMenu.addAction(_dummy);
+      _dummy->setEnabled(false);
+    }
+
     delTab(ui.tabWidget->currentIndex());
   } else {
     qWarning() << "ATTACHEEEEEDDDD";





More information about the tor-commits mailing list