Bug 169016 - dolphin . opening Documents folder
Summary: dolphin . opening Documents folder
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-13 06:48 UTC by Jithin Emmanuel
Modified: 2009-02-17 21:45 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
desktop file of dolphin (3.90 KB, application/octet-stream)
2009-01-18 03:14 UTC, Jithin Emmanuel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jithin Emmanuel 2008-08-13 06:48:17 UTC
Version:           1.1 (using KDE 4.1.0)
Installed from:    Fedora RPMs
OS:                Linux

dolphin . opens /home/user/Documents directory regardless of where you issue the command. and dolphin .. opens home directory. I deally dolphin . should have opened current working directory
Comment 1 Peter Penz 2008-08-13 08:50:05 UTC
I could not reproduce the issue: dolphin . and dolphin .. work without problems (-> dolphin . opens the current working directory, dolphin .. the parent of the working directory). Did you call 'dolphin .' from the terminal or inside a .desktop file?
Comment 2 Jithin Emmanuel 2008-08-13 08:52:45 UTC
I called it from terminal.
Even when I open File manager from applications->system it opens /home/user/Documents . It opens dolphin.desktop and it calls dolphin with arguments
dolphin %i -caption "%c" "%u"
Comment 3 Jithin Emmanuel 2008-09-29 06:08:48 UTC
To reproduce the bug :
If there is any open dolphin windows dolphin . will open Documents folder
irrespective of where the command is issued.
I can reproduce the bug with kde 4.1.1 using fedora 9
Comment 4 Peter Penz 2008-09-29 07:39:41 UTC
Thanks for the update, I could reproduce the issue.
Comment 5 Fred Wells 2008-10-22 06:00:13 UTC
I also have the problem using kde 4.1.2 on fedora 9.
Comment 6 Jithin Emmanuel 2008-12-01 17:33:36 UTC
The problem is still there for kde 4.2 beta 1 .
Comment 7 Marcus Woletz 2009-01-02 22:09:17 UTC
(In reply to comment #0)
on KDE 4.1.3 I have the same problems: opening Dolphin on the Desktop always opens the folder "Documents", regardless of what is set in the Dolphin Settings
"Start Folder".

bye

Marcus
Comment 8 Georg Wittenburg 2009-01-03 00:25:38 UTC
I'm seeing the same issue on 4.1.86 (using unofficial Debian packages from kde42.debian.net at version 4:4.1.86+svn902162-0r1).
Comment 9 Syam 2009-01-10 04:00:21 UTC
Any updates on this, since 4.2 is close to release..
Comment 10 Peter Penz 2009-01-10 17:58:45 UTC
Sorry, no fix has been done yet. I'm sure the fix itself should be trivial, but the startup code has not been written by me and I'm not very familiar with the startup concept :-(
Comment 11 Josep Febrer 2009-01-12 16:38:23 UTC
I had the same trouble as reported by this bug, since KDE 4.2 beta2 and discovered that it has more to do with the xdg-user-dirs-update command that it is available on more recent distributions.
This command which is executed on the session start ensures that the path some directories such as user desktop, documents, pictures, music, etc. corresponds to the user locale so for example if the user change it's locale from english to another, the desktop user path it's not /home/user/Desktop and the directory Desktop it is renamed to it's locale equivalent.

The problem with Dolphin and also in the KDE open file dialog is that it starts on the direcory specified by the variable XDG_DOCUMENTS_DIR, in my case it was set to /home/josep/Documents and even if in Dolphin I had another startup folder this one prevailed, also if I changed the Documents folder on SystemSettings when I restarted my KDE session it when back /home/josep/Documents because of xdg-user-dirs-update.

So the real fix for this was to edit the file $HOME/.config/user-dirs.update and change the value of XDG_DOCUMENTS_DIR="$HOME/Documents" to XDG_DOCUMENTS_DIR="$HOME"

But I think the more convenient fix is to see why XDG_DOCUMENTS_DIR prevailed over $HOME, or in the user paths systemsettings let to put startup folder for filemanagement.
Comment 12 Fri13 2009-01-12 23:39:21 UTC
This is bretty serious usability bug. openSUSE 11.1 and Mandriva Cooker (4.1.96) are both affected by this.

This should got fixed because it has be since 4.1.3 on MDV.

I did not go to edit the XDF value but Dolphin start parameter on K-menu. It shows this: dolphin %i -caption "%c" "%u" And when i removed it and placed it only as "Dolphin", it started work right. Even the "open" and "save" dialoges worked correctly when calling from Amarok2, K3b, Inkscape and digiKam. 

All GTK+ applications were turned to ~/Documents when the icon was set in K-menu as it was and it even affected to all GTK+ applications. So I say the bug is there, not on the XDF, but those who knows can say more by sure... I dont ;-)
Comment 13 S. Burmeister 2009-01-12 23:53:33 UTC
How can editing dolphin's kmenu entry affect the open-file dialogue used by amarok?

If so, is this rather a kdelibs than dolphin specific bug?
Comment 14 Jens Hartwig 2009-01-14 19:21:11 UTC
KDE 4.2 RC1:
not fixed yet
:(
Comment 15 Harald Sitter 2009-01-17 23:38:17 UTC
"%u" is
a) unnecessary [1]
b) confuses the startup part of dolphin because it is passing an empty location(value) (editing the desktop file to strace and write to a file unveals that), removing the quotation marks doesn't invoke dolphin with that empty location(value) and thus makes startup work again.

No clue as to why this confuses dolphin or where the startup code is hidden, removing the quotes fixes the issue though.

Also please note that respecting the XDG setting for documents path is expected behaviour for open/file dialogs (at least I would assume so).

About being able to editing said XDG settings please see bug #177474 (for example).

...committing fixes in a bit.

[1]
Implementations must take care not to expand field codes into multiple arguments unless explicitly instructed by this specification. This means that name fields, filenames and other replacements that can contain spaces must be passed as a single argument to the executable program after expansion.
http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html#exec-variables
Comment 16 Harald Sitter 2009-01-18 00:07:47 UTC
SVN commit 912654 by sitter:

Fix Dolphin's desktop file. The additional quotation of %u made dolphin be started with an empty (but existing) location value which made it fall back to XDG's document path as of KDE 4.2. Without 
quotation it doesn't get that empty value and starts using it's configured default location.
BUG: 169016


 M  +1 -1      dolphin.desktop  


WebSVN link: http://websvn.kde.org/?view=rev&revision=912654
Comment 17 Harald Sitter 2009-01-18 00:08:14 UTC
SVN commit 912655 by sitter:

Fix Dolphin's desktop file. The additional quotation of %u made dolphin be started with an empty (but existing) location value which made it fall back to XDG's document path as of KDE 4.2. Without
quotation it doesn't get that empty value and starts using it's configured default location.
BUG: 169016


 M  +1 -1      dolphin.desktop  


WebSVN link: http://websvn.kde.org/?view=rev&revision=912655
Comment 18 Jithin Emmanuel 2009-01-18 03:13:48 UTC
Its not working for me. I removed the quotation around %u in my /usr/share/applications/kde4/dolphin.desktop file. But now its always opening the first folder I opened.
Comment 19 Jithin Emmanuel 2009-01-18 03:14:42 UTC
Created attachment 30371 [details]
desktop file of dolphin
Comment 20 Harald Sitter 2009-01-20 19:21:17 UTC
Please elaborate.

When I start dolphin with /etc as dir (which would then be first folder I suppose) and then launch it from the menu it will still go to $HOME, which is my defautl folder.
Comment 21 Jithin Emmanuel 2009-01-21 05:28:06 UTC
I notice the problem when i do open folders from konsole using dolphin . ( to open current directory in dolphin) From konsole if i go to cd /home/Download and do dolphin . it opens Download folder in dolphin. If then I do cd /user and issue dolphin . It still opens Download folder.
Comment 22 Harald Sitter 2009-01-24 10:27:10 UTC
Sounds like a different problem really.

Peter might have some insight...
Comment 23 Frank Reininghaus 2009-02-15 00:26:11 UTC
I can reproduce comment 21 in 4.2.0 (Kubuntu) and trunk rev. 925858. The root cause seems to be that DolphinApplication::newInstance() contains the statement 

KCmdLineArgs::setCwd(QDir::currentPath().toUtf8());

This enforces that the 'working directory' of the command line arguments (in this case, ".") is set to the current directory of the Dolphin process, which is the directory where the first Dolphin window was opened, and this results in the mentioned irritating behaviour. Removing that line fixes the issue for me (see the patch below which also removes the corresponding #include).

The commit that introduced this line was
http://websvn.kde.org:80/?view=rev&revision=718808
with the comment "Init cwd with the current path (dolphin is a KUniqueApplication)". I don't quite understand this - IMHO, the fact that Dolphin is a KUniqueApplication is just the reason why the working directory of the command line arguments should *not* be set to the current path. But maybe I'm overlooking something here?

Index: src/dolphinapplication.cpp
===================================================================
--- src/dolphinapplication.cpp  (revision 925858)
+++ src/dolphinapplication.cpp  (working copy)
@@ -26,7 +26,6 @@
 #include <kcmdlineargs.h>
 #include <kurl.h>
 #include <QtDBus/QDBusConnection>
-#include <QtCore/QDir>

 DolphinApplication::DolphinApplication() :
     m_lastId(0)
@@ -72,7 +71,6 @@

 int DolphinApplication::newInstance()
 {
-    KCmdLineArgs::setCwd(QDir::currentPath().toUtf8());
     KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
     static bool first = true;
Comment 24 Peter Penz 2009-02-17 21:43:17 UTC
SVN commit 927544 by ppenz:

Fixed issue that invoking Dolphin with a specified path is ignored when another Dolphin window is open already. Thanks to Frank Reininghaus for the patch.

BUG: 169016

 M  +0 -2      dolphinapplication.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=927544
Comment 25 Peter Penz 2009-02-17 21:45:03 UTC
SVN commit 927549 by ppenz:

Backport of SVN commit 927544: Fixed issue that invoking Dolphin with a specified path is ignored when another
Dolphin window is open already. Thanks to Frank Reininghaus for the patch.

CCBUG: 169016


 M  +0 -2      dolphinapplication.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=927549