Bug 260663 - Open documents get closed after performing a review
Summary: Open documents get closed after performing a review
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: 4.1.60
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-18 22:27 UTC by Dmitry
Modified: 2010-12-27 23:29 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry 2010-12-18 22:27:04 UTC
Version:           4.1.60 (using KDE 4.5.2) 
OS:                Linux



Reproducible: Didn't try

Steps to Reproduce:
Open a few text files in a version-controlled project.
Modify one of them, so that it has changes from the current revision.
Open context menu, call 'your version control'->Compare to Head.
Click 'Finish Review'.

Actual Results:  
Only one document is now open, the one for which a diff was called.

Expected Results:  
All documents that were open before Review should remain open.
Comment 1 Dmitry 2010-12-27 23:29:30 UTC
commit 619aa3830d965e29bdbeae7ba377eed0c5493569
branch 1.2
Author: Dmitry Risenberg <dmitry.risenberg@gmail.com>
Date:   Sat Dec 25 14:07:19 2010 +0300

    Do not mess with other active working sets when calling for a review.
    BUG: 260663

diff --git a/plugins/patchreview/patchreview.cpp b/plugins/patchreview/patchreview.cpp
index 4b4b393..3575636 100644
--- a/plugins/patchreview/patchreview.cpp
+++ b/plugins/patchreview/patchreview.cpp
@@ -66,6 +66,8 @@ std::string*/
 #include <sublime/controller.h>
 #include <sublime/mainwindow.h>
 #include <sublime/area.h>
+#include <sublime/document.h>
+#include <sublime/view.h>
 #include <interfaces/iprojectcontroller.h>
 #include "diffsettings.h"
 #include <interfaces/iplugincontroller.h>
@@ -1441,9 +1443,8 @@ void PatchReviewPlugin::updateReview()
       
       if(QFileInfo(absoluteUrl.path()).exists() && absoluteUrl.path() != "/dev/null")
       {
-        if (!documents.contains(absoluteUrl)) {
-          ICore::self()->documentController()->openDocument(absoluteUrl);
-        } else {
+        ICore::self()->documentController()->openDocument(absoluteUrl);
+        if (documents.contains(absoluteUrl)) {
           documents.remove(absoluteUrl);
         }
         seekHunk(true, absoluteUrl); //Jump to the first changed position
@@ -1454,9 +1455,13 @@ void PatchReviewPlugin::updateReview()
     }
   }
 
-  // close documents we didn't open again
-  foreach(IDocument* doc, documents.values()) {
-    doc->close();
+  // Close views for documents that were loaded from the working set, but are not in the patch
+  QList<IDocument*> documentsList = documents.values();
+  foreach(Sublime::View* view, w->area()->views()) {
+    IDocument* doc = dynamic_cast<IDocument*>(view->document());
+    if(doc && documentsList.contains(doc)) {
+      w->area()->closeView(view);
+    }
   }
 
   Q_ASSERT(futureActiveDoc);