Bug 242156 - some web shortcuts (e.g. CPAN) are not correctly handled by runner
Summary: some web shortcuts (e.g. CPAN) are not correctly handled by runner
Status: RESOLVED FIXED
Alias: None
Product: krunner
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-19 12:20 UTC by Jonathan Marten
Modified: 2010-06-30 11:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2010-06-19 12:20:00 UTC
Version:           unspecified (using Devel) 
OS:                Linux

For example, the CPAN search (kdebase/runtime/kurifilter-plugins/ikws/searchproviders/cpan.desktop).  If typed in Konqueror's location bar, "cpan:SEARCH" expands to the URL

  http://search.cpan.org/search?mode=dist&query=SEARCH

and the correct results are returned.  However, if this same web shortcut is entered in the Alt+F2 run box, the URL passed to Konqueror is:

  http://search.cpan.org/search?mode=%5C%7Bmode,2,%22dist%22%7D&query=%5C%7Bquery,q,1%7D

It appears that a web shortcut in the runner does not understand anything other than the "\\{@}" substitution.

Other web shortcuts (from kdebase) using other than this syntax are:

cpan.desktop              as above
docbook.desktop           uses \\{1}
google_code.desktop       uses \\{%2520}
nl-telephone.desktop      uses \\{1} and \\{2}


Reproducible: Always



Expected Results:  
The search URL and returned results should be the same in both cases.
Comment 1 Jonathan Marten 2010-06-19 12:28:48 UTC
Aha, just spotted in kdebase/workspace/plasma/generic/runners/webshortcuts/webshortcutrunner.cpp,  WebshortcutRunner::searchQuery(const QString &query, const QString &term):

  // FIXME? currently only basic searches are supported
Comment 2 Jonathan Marten 2010-06-19 13:12:05 UTC
Would replacing WebshortcutRunner::searchQuery() with the following achieve the required result, without any unwanted side effects?

QString WebshortcutRunner::searchQuery(const QString &query, const QString &term)
{
    QString q = term;
    if (!KUriFilter::self()->filterUri(q, QStringList("kurisearchfilter")))
        return (QString());
    return (q);
}
Comment 3 Jonathan Marten 2010-06-28 22:30:22 UTC
Submitted review at http://reviewboard.kde.org/r/4490/
Comment 4 Jonathan Marten 2010-06-30 11:17:46 UTC
SVN commit 1144555 by marten:

Use KUriFilter to expand the query, in order to support
complex substitutions.

BUG:242156


 M  +5 -10     webshortcutrunner.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1144555
Comment 5 Jonathan Marten 2010-06-30 11:26:05 UTC
SVN commit 1144562 by marten:

Backport of commit 1144555 to trunk:

Use KUriFilter to expand the query, in order to support
complex substitutions.

BUG:242156


 M  +5 -10     webshortcutrunner.cpp  


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