changeset 350:293d91cf44de bug_90

Double-click on modified files shows diff instead of annotation
author Chris Cannam
date Wed, 16 Mar 2011 12:26:03 +0000
parents b422d1bcfb3c
children 39a616befdbd
files filestatuswidget.cpp
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/filestatuswidget.cpp	Wed Mar 16 12:18:50 2011 +0000
+++ b/filestatuswidget.cpp	Wed Mar 16 12:26:03 2011 +0000
@@ -251,8 +251,21 @@
 void FileStatusWidget::itemDoubleClicked(QListWidgetItem *item)
 {
     QStringList files;
-    files << item->text();
-    emit annotateFiles(files);
+    QString file = item->text();
+    files << file;
+
+    switch (m_fileStates.stateOf(file)) {
+
+    case FileStates::Modified:
+    case FileStates::InConflict:
+        emit diffFiles(files);
+        break;
+
+    case FileStates::Clean:
+    case FileStates::Missing:
+        emit annotateFiles(files);
+        break;
+    }
 }
 
 void FileStatusWidget::itemSelectionChanged()