changeset 327:f166f70c64f9 filelist_right_button_menu

Make Add/Remove active only when Work tab is selected (again!) -- because they are the only selection-modal toolbar buttons now
author Chris Cannam
date Fri, 11 Mar 2011 17:42:12 +0000
parents 6e1fdda1dff2
children ea62eb083ed4
files hgtabwidget.cpp mainwindow.cpp
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgtabwidget.cpp	Fri Mar 11 15:33:16 2011 +0000
+++ b/hgtabwidget.cpp	Fri Mar 11 17:42:12 2011 +0000
@@ -163,6 +163,9 @@
 
 bool HgTabWidget::canAdd() const
 {
+    // Permit this only when work tab is visible
+    if (currentIndex() != 0) return false;
+
     QStringList addable = m_fileStatusWidget->getSelectedAddableFiles();
     if (addable.empty()) return false;
 
@@ -174,6 +177,9 @@
 
 bool HgTabWidget::canRemove() const
 {
+    // Permit this only when work tab is visible
+    if (currentIndex() != 0) return false;
+
     if (m_fileStatusWidget->getSelectedRemovableFiles().empty()) return false;
     if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
     return true;
--- a/mainwindow.cpp	Fri Mar 11 15:33:16 2011 +0000
+++ b/mainwindow.cpp	Fri Mar 11 17:42:12 2011 +0000
@@ -2221,6 +2221,9 @@
 
 void MainWindow::connectTabsSignals()
 {
+    connect(m_hgTabs, SIGNAL(currentChanged(int)),
+            this, SLOT(enableDisableActions()));
+
     connect(m_hgTabs, SIGNAL(commit()),
             this, SLOT(hgCommit()));