DevHeads.net

Review Request: KOpenWithDialog: Quote paths selected in the file dialog

Review request for kdelibs.

Description
KOpenWithDialog expects the input in its line edit to be shell-quoted. Currently, however, when the user picks a path via the provided file dialog, whitespace and other special characters in the path are inserted verbatim. This leads to an error when the user tries to select an executable whose path contains such characters.

This tiny patch addresses the issue by adding a private slot that runs all paths coming from the file dialog through KShell::quoteArg().

I believe this solution is better than the one I originally proposed in the linked bug report, since it avoids the ambiguity of having to guess whether whitespace belongs to the path or an argument to the executable.

This addresses bug 281952.
<a href="http://bugs.kde.org/show_bug.cgi?id=281952" title="http://bugs.kde.org/show_bug.cgi?id=281952">http://bugs.kde.org/show_bug.cgi?id=281952</a>

Diffs
kio/kfile/kopenwithdialog.h 86c02ab
kio/kfile/kopenwithdialog.cpp b5ebbbf

Diff: <a href="http://git.reviewboard.kde.org/r/103602/diff/diff" title="http://git.reviewboard.kde.org/r/103602/diff/diff">http://git.reviewboard.kde.org/r/103602/diff/diff</a>

Testing

Thanks,

Ingomar Wesp

Comments

Re: Review Request: KOpenWithDialog: Quote paths selected in the

By Commit Hook at 01/27/2012 - 08:21

This review has been submitted with commit cfc52e240ae5a15f049f578c50b9c58eadb3203a by Ingomar Wesp to branch KDE/4.8.

- Commit Hook

On Jan. 1, 2012, 9:49 p.m., Ingomar Wesp wrote:

Re: Review Request: KOpenWithDialog: Quote paths selected in the

By Commit Hook at 01/16/2012 - 09:50

This review has been submitted with commit 63c7ae800b22d0d9d6d5a43a21f8e4473994298d by Ingomar Wesp to branch KDE/4.8.

- Commit Hook

On Jan. 1, 2012, 9:49 p.m., Ingomar Wesp wrote:

Re: Review Request: KOpenWithDialog: Quote paths selected in the

By David Faure at 01/15/2012 - 05:04

Ship it!

Yep we want to quote only paths from the file dialog, not command lines types by the user or selected in the application tree. So this looks good.

- David Faure

On Jan. 1, 2012, 9:49 p.m., Ingomar Wesp wrote:

Re: Review Request: KOpenWithDialog: Quote paths selected in the

By Dawit A at 01/01/2012 - 18:08

Why the need for a new slot that connects to urlChanged ? Would simply quoting the user selected text in KOpenWithDialog::slotSelected not suffice ?

- Dawit Alemayehu

On Jan. 1, 2012, 9:49 p.m., Ingomar Wesp wrote:

Re: Review Request: KOpenWithDialog: Quote paths selected in the

By Ingomar Wesp at 01/01/2012 - 19:00

AFAICS, KOpenWithDialog::slotSelected is used for setting the contents of the line edit when picking an item from the KApplicationView rather than the file dialog. Unlike the paths returned by the file dialog, these should already be properly quoted.

- Ingomar

On Jan. 1, 2012, 9:49 p.m., Ingomar Wesp wrote: