Bug 371210 - patch review shouldn't add files it opens to the recent files menu
Summary: patch review shouldn't add files it opens to the recent files menu
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: patchreview (show other bugs)
Version: unspecified
Platform: Compiled Sources All
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL: https://git.reviewboard.kde.org/r/129...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-19 10:09 UTC by RJVB
Modified: 2016-10-21 18:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.0


Attachments
patch review temporary patchfiles in the recent files menu (106.30 KB, image/png)
2016-10-19 19:11 UTC, RJVB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RJVB 2016-10-19 10:09:16 UTC
The patch review plugin can open quite a few files, which aren't always files you have been editing - for instance when you rename a directory and commit the resulting change (which KDevelop sadly records as separate delete/create events rather than renames which git does support).

When you commit or review changes to a file you've been editing that file will most likely already be in the recent files menu, or at least it won't surprise appearing there. If however that change has been pending for some time there still isn't much of a reason to add the file to the list of recent documents.

Reproducible: Always

Steps to Reproduce:
1. commit or review changes that include files you haven't touched for a while or at all (other than renaming them or the directory they live in)
2. close the review toolview
3. try to open a file from the recent files menu

Actual Results:  
If the patch review concerned enough files, the whole recent files menu will be populated with the reviewed files. This just happened to me, and it took me a while to understand why the list contained only unfamiliar files all of a sudden.

Expected Results:  
Ideally the recent files menu would only contain files you have actually opened yourself

Supposing it is not trivial to decide on the fly whether or not a file being opened should be added to the recent files menu, this could be achieved more or less easily by (order of personal preference):

- opening only the patchfile in review mode and letting the user open any modified file s/he is interested in by double-clicking in the list of modified files (which is an existing functionality)
- maintaining separate lists of recent files for the review and other modes.
Comment 1 RJVB 2016-10-19 19:11:39 UTC
Created attachment 101650 [details]
patch review temporary patchfiles in the recent files menu

The large number of changed files that overwrote my recent files menu contents hid another thing that I think is a real and recent regression: the presence of the patch files themselves in the recent files menu.
Comment 2 RJVB 2016-10-21 14:51:26 UTC
Git commit 3c559df38551ba0a0654e944ea2b68dd4b85a15d by René J.V. Bertin.
Committed on 21/10/2016 at 14:51.
Pushed by rjvbb into branch 'master'.

add an IDocumentController::DocumentActivation flag to control adding
documents to the "Files/Open Recent" menu and use it in the patchreview
plugin to prevent pollution of said menu.
DocumentController::activateDocument() no longer adds the target document
to the Open Recent menu; use DocumentController::openDocument() for that.
Additionally, the patch review plugin now handles the hardwired maximum
number of files to open (15) correctly, instead of opening no files when
that maximum is exceeded.

REVIEW: 129231

M  +2    -1    interfaces/idocumentcontroller.h
M  +21   -19   plugins/patchreview/patchreview.cpp
M  +7    -2    plugins/patchreview/patchreviewtoolview.cpp
M  +2    -2    shell/documentcontroller.cpp
M  +2    -0    shell/documentcontroller.h

http://commits.kde.org/kdevplatform/3c559df38551ba0a0654e944ea2b68dd4b85a15d