Bug 63014 - Usability: KDE should mimic CD/PWD behavior
Summary: Usability: KDE should mimic CD/PWD behavior
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 123230 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-20 14:57 UTC by Dik Takken
Modified: 2006-03-11 18:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
kfileitem.cpp.diff (967 bytes, text/x-diff)
2006-03-09 12:34 UTC, David Faure
Details
libkonq.diff (1.49 KB, text/x-diff)
2006-03-09 12:34 UTC, David Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dik Takken 2003-08-20 14:57:36 UTC
Version:            (using KDE KDE 3.1.1)
Installed from:    Compiled From Sources
OS:          Linux

When you change directory in Konsole using "cd" and the directory (say "/home/user/link") is acually a link to "/home/user/target", PWD will say you are in /home/user/link.

When you change directory in Konqueror by clicking on it and the directory (say "/home/user/link") is acually a link to "/home/user/target", the address bar will say you are in /home/user/target.

This is inconsistent and confusing to unexperienced Linux users. As a system administrator, I want to be able to create links to /mnt/diskxxx for example and I want these links to be transparent to the users. Users tend to get confused if they get redirected to /mnt/. They think they're in the wrong spot, as they have left their home directory.
Comment 1 Sashmit Bhaduri 2003-11-18 00:13:53 UTC
Agreed. I've actually seen this confuse some people.
Comment 2 David Faure 2006-03-09 12:09:54 UTC
On Tuesday 07 March 2006 20:46, Andras Mantia wrote:
> Hi,
> 
>  I expect this to be a controversial patch, but it is needed to achieve 
> consistency within Konqueror itself. The problem is described in 
> http://bugs.kde.org/123230 . The reason why I changed here and not in 
> the sidebar is because it would be still inconsistent, as the user 
> could enter the directory by typing the path in the location bar.
>  I have no idea why the symlink resolving was needed, maybe it was 
> useful when running applications, but KFileItem::run anyway uses the 
> destination, not the link.


Well if you follow the comment and read KFileItem::run you can see that:
  // When clicking on a link to e.g. $HOME from the desktop, we want to open $HOME

Imagine you have a link to your home on the desktop called "MyHome", when clicking
on it you don't want to see "/home/user/Desktop/MyHome/" in konqueror, but /home/user.

So how do we solve this? In one case a symlink is used to hide the actual location
of a directory (/mnt) and in the other case the actual location (home) *is* where 
we want to go, the symlink is just a convenient way to go there. Do we need a 
desktop-specific hack (making symlink-resolution happen only if the link is on 
the desktop), or does someone have a better idea?
Comment 3 David Faure 2006-03-09 12:26:23 UTC
*** Bug 123230 has been marked as a duplicate of this bug. ***
Comment 4 David Faure 2006-03-09 12:34:00 UTC
On Thursday 09 March 2006 12:08, David Faure wrote:
> making symlink-resolution happen only if the link is on the desktop

... is done in the attached patches.

Of course when going to ~/Desktop/ in konqueror, then clicking on a link to $HOME
leads to /home/dfaure/Desktop/myhome, but I guess that's fine, it gives a consistent
behavior in konqueror, and another one on the desktop (not the first time...)


Created an attachment (id=15024)
kfileitem.cpp.diff

Created an attachment (id=15025)
libkonq.diff
Comment 5 András Manţia 2006-03-09 12:43:27 UTC
Just for the record post my answer here as well:
> Well if you follow the comment and read KFileItem::run you can see
> that: // When clicking on a link to e.g. $HOME from the desktop, we
> want to open $HOME



I read it but it wasn't clear.

> Imagine you have a link to your home on the desktop called "MyHome",
> when clicking on it you don't want to see
> "/home/user/Desktop/MyHome/" in konqueror, but /home/user.



Hm, I missed this issue.

> So how do we solve this? In one case a symlink is used to hide the
> actual location of a directory (/mnt) and in the other case the
> actual location (home) *is* where we want to go, the symlink is just
> a convenient way to go there. Do we need a desktop-specific hack
> (making symlink-resolution happen only if the link is on the
> desktop), or does someone have a better idea?



The current behavior is very confusing for a normal user and as I wrote 
it is inconsistent as well. So unless there is abetter idea I support 
the desktop-specific hack.

Andras
Comment 6 Dik Takken 2006-03-09 14:14:04 UTC
I would rather propose to only resolve symlinks that point to places inside $HOME. This way, other 'scary places' outside $HOME will always be hidden and appear to live inside $HOME. The user will never be taken outside $HOME.
Comment 7 András Manţia 2006-03-09 18:56:11 UTC
I tested and like David's solution. From my point of view you can 
commit.
Comment 8 David Faure 2006-03-11 01:05:19 UTC
Dik: having a different behavior for links on the desktop makes sense to me (it's already the case for showing the Name field of .desktop files, etc.).

Having a different behavior depending on the target of the symlink makes little sense though. If /opt is made a symlink to /mnt/something/ia64/opt, then for the same reasons as those described in this bug report, the user should only see /opt in Konqueror.
Comment 9 David Faure 2006-03-11 01:07:31 UTC
SVN commit 517437 by dfaure:

Don't resolve links in konqueror, but still resolve them on the desktop.
BUG: 63014


 M  +12 -1     kfileivi.cc  
 M  +0 -3      konq_dirpart.cc  


--- branches/KDE/3.5/kdebase/libkonq/kfileivi.cc #517436:517437
@@ -29,6 +29,7 @@
 #include <kiconeffect.h>
 #include <kfileitem.h>
 #include <kdebug.h>
+#include <krun.h>
 
 #undef Bool
 
@@ -344,7 +345,17 @@
 
 void KFileIVI::returnPressed()
 {
-    m_fileitem->run();
+    if ( static_cast<KonqIconViewWidget*>(iconView())->isDesktop() ) {
+        KURL url = m_fileitem->url();
+        // When clicking on a link to e.g. $HOME from the desktop, we want to open $HOME
+        // Symlink resolution must only happen on the desktop though (#63014)
+        if ( m_fileitem->isLink() && url.isLocalFile() )
+            url = KURL( url, m_fileitem->linkDest() );
+
+        (void) new KRun( url, m_fileitem->mode(), m_fileitem->isLocalFile() );
+    } else {
+        m_fileitem->run();
+    }
 }
 
 
--- branches/KDE/3.5/kdebase/libkonq/konq_dirpart.cc #517436:517437
@@ -318,9 +318,6 @@
         args.serviceType = fileItem->mimetype();
     args.trustedSource = true;
 
-    if ( fileItem->isLink() && fileItem->isLocalFile() ) // see KFileItem::run
-        url = KURL( url, KURL::encode_string( fileItem->linkDest() ) );
-
     if (KonqFMSettings::settings()->alwaysNewWin() && fileItem->isDir()) {
         //args.frameName = "_blank"; // open new window
         // We tried the other option, passing the path as framename so that
Comment 10 Dik Takken 2006-03-11 18:52:40 UTC
Ok, I'm fine with the changes.