changeset 206:49bf8cc4f6b2

Merge
author Chris Cannam
date Tue, 04 Jan 2011 16:24:27 +0000
parents 3cc6455e58c2 (current diff) d256cc418fa3 (diff)
children fccfd12faac1
files
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgtabwidget.cpp	Tue Jan 04 15:34:12 2011 +0000
+++ b/hgtabwidget.cpp	Tue Jan 04 16:24:27 2011 +0000
@@ -115,10 +115,17 @@
 
 bool HgTabWidget::canAdd() const
 {
-    if (m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
-    if (!m_fileStatusWidget->getSelectedCommittableFiles().empty()) return false;
-    if (!m_fileStatusWidget->getSelectedRemovableFiles().empty()) return false;
-    return true;
+    QStringList addable = m_fileStatusWidget->getSelectedAddableFiles();
+    if (addable.empty()) return false;
+
+    QStringList removable = m_fileStatusWidget->getSelectedRemovableFiles();
+    if (!removable.empty()) return false;
+
+    QStringList committable = m_fileStatusWidget->getSelectedCommittableFiles();
+    // "Removed" files are both committable and addable; don't return
+    // a false positive if the selection only contains these
+    if (committable == addable || committable.empty()) return true;
+    return false;
 }
 
 bool HgTabWidget::canRemove() const