Bug 348757 - Project view jumps to new (random?) file after closing translation file
Summary: Project view jumps to new (random?) file after closing translation file
Status: RESOLVED FIXED
Alias: None
Product: lokalize
Classification: Applications
Component: project management (show other bugs)
Version: 2.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Simon Depiets
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-05 18:42 UTC by Karl Ove Hufthammer
Modified: 2018-08-29 02:10 UTC (History)
3 users (show)

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 Karl Ove Hufthammer 2015-06-05 18:42:29 UTC
After editing, saving and finally closing a translation file, the file selector in the project view jumps to a new, seemingly random, file. It should instead stay at just edited file.

Reproducible: Always

Steps to Reproduce:
1. Checkout a KDE translation messages folder for a language (including the subfolders).
2. Create/open a project for this folder.
3. Open a subfolder in the project view.
4. Open a file from the subfolder in step 3, either using the mouse or the keyboard.
5. Edit the file (make at least one change).
6. Save the file (Ctrl + S).
7. Close the file (Ctrl + W).

Actual Results:  
The file selector has moved to (i.e. selected) a completely different file.

Expected Results:  
The file just edited should stay selected.
Comment 1 Nick Shaforostoff 2015-11-14 17:58:27 UTC
15.12 is going to improve in this regard (actually already in the master branch)
Comment 2 Karl Ove Hufthammer 2016-01-23 11:24:20 UTC
I still have this problem in 15.12 and ‘master’.
Comment 3 Safa Alfulaij 2016-02-10 15:06:52 UTC
I can confirm that. It happens only if I translated a template pot file (there is no po file).
The problem looks like that Lokalize detects the new po file and refresh the whole list!
There should be a way to workaround this..

I'm using:
KDE Frameworks 5.18.0
Qt 5.5.1 (built against 5.5.1)
The xcb windowing system
Comment 4 Adrián Chaves (Gallaecio) 2018-06-10 08:09:02 UTC
It does indeed seem to happen due to #343371. Hopefuly, fixing #343371 will fix this issue as well.
Comment 5 Simon Depiets 2018-08-29 02:10:24 UTC
Git commit b6f3151185b746092ad1b2e2ede5130e02c9dc02 by Simon Depiets.
Committed on 29/08/2018 at 02:10.
Pushed by sdepiets into branch 'master'.

Fix project model issues on file changes

Summary:
This revision fixes some issues with the Project Model refreshes
- Project view jumps to new (random?) file after closing translation file https://bugs.kde.org/show_bug.cgi?id=348757
- Whole project is refreshed when a file is changed https://bugs.kde.org/show_bug.cgi?id=343371
- Moving or adding a file/folder into the project root will trigger a bug where only that file/folder is displayed

It mostly fixes behaviors which are applied to directories while they shouldn't (like cache requests for directories that return empty values, or unnecessary full regeneration).
Related: bug 343371

Test Plan:
I've tested the following test matrix :
* Move/Add/Remove/Save   x    File or Folder
* Within the root folder, within subfolders (same or different), between the root and a subfolder

This is for a .po project architecture, I would be interested to know if the behavior doesn't create regressions with a .po/.pot or other architecture (which might be more buggy to begin with).

Reviewers: ltoscano, #localization, aacid, mlaurent

Tags: #localization

Differential Revision: https://phabricator.kde.org/D15049

M  +29   -13   src/project/projectmodel.cpp

https://commits.kde.org/lokalize/b6f3151185b746092ad1b2e2ede5130e02c9dc02