Bug 139137 - warn on opening again the same file but as a link
Summary: warn on opening again the same file but as a link
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-22 18:42 UTC by Maciej Pilichowski
Modified: 2012-10-28 23:30 UTC (History)
2 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 Maciej Pilichowski 2006-12-22 18:42:22 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs

Open two documents, A and B, but B is a symlink to A. Edit one of them. Kate will show quite puzzling warning, about __external__ modification.

I think kate should warn or even disallow to open the same doc twice, because after that it could be only a mess. I spent some time looking for an app which could alter my file, only later I found out I have the same doc opened twice.
Comment 1 Anders Lund 2006-12-27 11:59:48 UTC
On Friday 22 December 2006 18:42, Maciej Pilichowski wrote:
> Open two documents, A and B, but B is a symlink to A. Edit one of them.
> Kate will show quite puzzling warning, about __external__ modification.


Thank you for noticing this.

I think we should check if file is a softlink and if so check if the target is 
open before opening it. And if a file is a softlink, we might keep that data 
in the document manager, so that we can easily check before opening new 
files.

-anders
Comment 2 Joseph Wenninger 2008-11-30 10:20:36 UTC
I think for a softlink we should just follow the link and open the link target and don't care that originally the softlink was handed over to findDocument or openUrl.
Comment 3 Maciej Pilichowski 2008-11-30 18:46:04 UTC
Joseph, what is the sane case of opening the same document twice (and the duplicate via link)?

It is rather more likely it was accident. So user should get some information/warning -- after all it is much easier for computer to track opened documents than for human.
Comment 4 Joseph Wenninger 2008-11-30 20:41:28 UTC
I'm not completely sure, but I guess the most transparent case for the user would be the folllowing, I could be wrong though:

scenario: ~/softlink -> ~/realfile:

case a:
    1. opening ~/softlink: resolve link, open ~/realfile and display ~/realfile as opened
    2. opening ~/realfile: file is not opened again, since it has already been opened in 1, just open the view of the existing document

case b:
    1.: opening ~/realfile: just open the file and display it as opened
    2.: opening ~/softlinkg: resolve softlink -> check if target has been opened, this is the case -> just open a view of the existing document

The same strategy would apply for symlinked symlinks ... 
Comment 5 Maciej Pilichowski 2008-12-01 07:47:52 UTC
Exactly. Plus in (2) steps -- show a little tooltip ("the file is already opened"), because it is not obvious user would know what is going on.
Comment 6 Joseph Wenninger 2008-12-02 22:26:39 UTC
Do you think the tooltip is really necessary? If yes, we have to wait for KDE 4.3, if not I could perhaps add it for 4.2 as a regular bug fix
Comment 7 Maciej Pilichowski 2008-12-03 08:57:53 UTC
Tooltip -- in general, yes. Principle of the least surprise: when user opens literally the same file it is easy to notice what happened, but it is not if the filenames are different. So giving user a hand is important here.
Comment 8 Christoph Cullmann 2009-04-22 16:02:18 UTC
This is btw. a new feature, no bug.
Comment 9 Christoph Cullmann 2012-10-28 23:30:41 UTC
We should not start to mess around with this, we use URLs everywhere anyway and don't want always to go through this islocal => file => resolve => file => url...
Beside it might confuse people if we resolve symlinks in between as the url looks completly different to what they think.