Version: (using Devel) Compiler: gcc (Gentoo 4.3.2-r3 p1.6, pie-10.1.5) 4.3.2 OS: Linux Installed from: Compiled sources The "cut and paste work" in the Shell constructor has fixed handling of the reference part of an (incomplete) "url" given on the command line, such as okular test.dvi#src:13test.tex for me. However, if the --unique switch is used and okular is already running, no new Shell is constructed (obviously) but the document is opened via dbus and Part::openDocument( const QString &doc ). Here, the string doc is converted to a url using a simple KUrl constructor. In this process, the '#' is encoded as %23 and the openUrl call fails. So, okular --unique test.dvi#src:13test.tex followed by okular --unique test.dvi#src:13test.tex opens the document correctly but gives an error for the second call. Before you say this is a feature ;-), consider the following: okular --unique file:///full/path/test.dvi#src:13test.tex followed by okular --unique file:///full/path/test.dvi#src:13test.tex works just fine*! If the url is fully qualified, the KUrl constructor recognises the '#' and splits off the reference. I am not sure what the best way of fixing this is. Simply taking the "cut and paste" code from the Shell constructor and using it in Part::openDocument works for me (with the obvious modifications), but this seems an ugly solution (code duplication). * actually, there is a separate (very tricky) bug in the actual handling of source references which I will report separately
The other bug is bug #205084. Cheers, Jochen
Created attachment 39324 [details] patch file to fix url encoding in okular Okay, unless someone has a better idea, how about adding this hotfix in the meantime (see attached patch)? It is duplicating code from ShellUtils (which appears not to be accessible from this context), but at least it solves this annoying bug and makes using source-references together with --unique less painful ...
Does this one work? Index: shell/main.cpp =================================================================== --- shell/main.cpp (revision 1067040) +++ shell/main.cpp (working copy) @@ -18,6 +18,7 @@ #include <klocale.h> #include <QtDBus/qdbusinterface.h> #include "aboutdata.h" +#include "shellutils.h" static bool attachUniqueInstance(KCmdLineArgs* args) { @@ -28,7 +29,7 @@ if (!iface.isValid()) return false; - iface.call("openDocument", args->url(0).pathOrUrl()); + iface.call("openDocument", ShellUtils::urlFromArg(args->arg(0), ShellUtils::qfileExistFunc()).url()); return true; }
Yep, that one works for me and is much more elegant than my attempt. I'll consider this bug fixed once you have committed the change. Thanks.
SVN commit 1067205 by aacid: Do the same treatment to paths passed from the command line when we are starting a new shell and when we are passing the argument through dbus BUGS: 205076 M +2 -1 main.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1067205
*** Bug 226764 has been marked as a duplicate of this bug. ***