[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    [PATCH] Make man:foo, info:foo, etc. work again from KRunner
From:       Michael Pyne <mpyne () kde ! org>
Date:       2010-01-10 1:58:02
Message-ID: 201001092058.10801.mpyne () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi all,

Attached is a patch to fix bug 221371 (man: and info: syntax no longer 
working) which is caused by a strengthening of the syntax checks done in 
RunnerContext in kdelibs/plasma. It used to be that near the end of the chain 
of checks if a context hadn't been defined that a KUrl would be constructed 
and made either a network path or a local path.

This was changed a few weeks ago to only assume a path if there was a slash or 
backslash, but this was done before the network check was made to.

This caused the context passed to the location runner to change from a 
NetworkContext to an UnknownContext which stopped any matches from being 
emitted (since these URLs don't match the possibilities allowed in 
LocationRunner for UnknownContext URLs).

The attached patch changes the ambiguity test to be performed after the 
network URL check to restore the old behavior while still not ambiguously 
assuming local paths.

Note that it was always possible to workaround with man:/foo and info:/foo, 
but the other style is frequently used as examples of "cool things you can do 
in KDE" and are valid URLs anyways so I'd like that syntax to also work. I'd 
also like to get this in before 4.4 so I would appreciate a prompt review if 
possible so I can contact release-team.

Thanks!

Regards,
 - Michael Pyne

["kdelibs-fix-runner-protocol.patch" (text/x-patch)]

Index: plasma/runnercontext.cpp
===================================================================
--- plasma/runnercontext.cpp	(revision 1070191)
+++ plasma/runnercontext.cpp	(working copy)
@@ -188,16 +188,17 @@
                 // that it has arguments!
                 type = (space > 0) ? RunnerContext::ShellCommand :
                                      RunnerContext::Executable;
-            } else if (path.indexOf('/') == -1 && path.indexOf('\\') == -1 ) {
-                //if a path doesn't have any slashes is a single word or
-                //sentence: is too ambiguous to be sure we're in a filesystem context
-                return;
             } else {
                 KUrl url(term);
                 QString correctCasePath;
+                // check if we have a network location first, otherwise assume a path,
+                // but if a path doesn't have any slashes is a single word or
+                // sentence: it's too ambiguous to be sure we're in a filesystem context
                 if (!url.protocol().isEmpty() && !url.isLocalFile()) {
                     type = RunnerContext::NetworkLocation;
-                } else if (correctPathCase(path, correctCasePath)) {
+                } else if ((path.indexOf('/') != -1 || path.indexOf('\\') != -1) &&
+                           correctPathCase(path, correctCasePath))
+                { // multiline if, drop opening brace to make scope clear
                     path = correctCasePath;
                     QFileInfo info(path);
 

["signature.asc" (application/pgp-signature)]

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic