diff filestatuswidget.cpp @ 109:1721c580c10e

* Add a queueing mechanism for Hg actions, instead of refusing to start an action if something else is already happening. This is essential now that actions can be prompted by asynchronous events (e.g. filesystem watcher). * Make Revert behave sensibly
author Chris Cannam
date Fri, 26 Nov 2010 12:48:29 +0000
parents 729438d70af8
children 78374cefa10f
line wrap: on
line diff
--- a/filestatuswidget.cpp	Thu Nov 25 21:08:17 2010 +0000
+++ b/filestatuswidget.cpp	Fri Nov 26 12:48:29 2010 +0000
@@ -68,8 +68,9 @@
     m_descriptions[FileStates::Added] = tr("These files will be added to version control next time you commit.");
     m_descriptions[FileStates::Removed] = tr("These files will be removed from version control next time you commit.<br>"
                                              "They will not be deleted from the local folder.");
-    m_descriptions[FileStates::Missing] = tr("These files are recorded in the version control but absent from your working folder.<br>"
-                                             "If you deleted them intentionally, select them here and use <b>Remove</b> to tell the version control system about it.");
+    m_descriptions[FileStates::Missing] = tr("These files are recorded in the version control, but absent from your working folder.<br>"
+                                             "If you deleted them by accident, select them here and use Revert to restore their previous contents.<br>"
+                                             "If you deleted them intentionally, select them here and use Remove to tell the version control system about it.");
     m_descriptions[FileStates::Unknown] = tr("These files are in your working folder but are not under version control.<br>"
                                              "Select a file and use Add to place it under version control or Ignore to remove it from this list.");
 
@@ -191,6 +192,33 @@
     return files;
 }
 
+QStringList FileStatusWidget::getSelectedRevertableFiles() const
+{
+    QStringList files;
+    foreach (QString f, m_selectedFiles) {
+        switch (m_fileStates.getStateOfFile(f)) {
+        case FileStates::Added:
+        case FileStates::Modified:
+        case FileStates::Removed:
+        case FileStates::Missing:
+            files.push_back(f);
+            break;
+        default: break;
+        }
+    }
+    return files;
+}
+
+QStringList FileStatusWidget::getAllRevertableFiles() const
+{
+    QStringList files;
+    files << m_fileStates.getFilesInState(FileStates::Modified);
+    files << m_fileStates.getFilesInState(FileStates::Added);
+    files << m_fileStates.getFilesInState(FileStates::Removed);
+    files << m_fileStates.getFilesInState(FileStates::Missing);
+    return files;
+}
+
 QStringList FileStatusWidget::getSelectedAddableFiles() const
 {
     QStringList files;