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

List:       kde-commits
Subject:    branches/KDE/4.5/kdebase/workspace/plasma/generic/runners/locations
From:       Matthias Fuchs <mat69 () gmx ! net>
Date:       2010-11-27 19:41:18
Message-ID: 20101127194118.862B2AC8A3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1201443 by mfuchs:

Backport r1201441
Supports KDE3 way of starting man-pages (#term) and info-pages (##term).
CCBUG:200556

 M  +20 -3     locationrunner.cpp  


--- branches/KDE/4.5/kdebase/workspace/plasma/generic/runners/locations/locationrunner.cpp \
#1201442:1201443 @@ -64,6 +64,19 @@
     }
 }
 
+//Replaces the '#' sign with "man" and "##" with "info:" as it was in KDE3
+static QString manInfoLookup(QString term)
+{
+    //Suports KDE3 way of accessing man/info-pages
+    if (term.startsWith("##")) {
+        return term.replace(0, 2, "info:");
+    } else if (term.startsWith("#")) {
+        return term.replace(0, 1, "man:");
+    }
+
+    return term;
+}
+
 void LocationsRunner::match(Plasma::RunnerContext &context)
 {
     QString term = context.query();
@@ -96,8 +109,10 @@
         context.addMatch(term, match);
     } else if (type == Plasma::RunnerContext::NetworkLocation ||
                (type == Plasma::RunnerContext::UnknownType &&
-                term.contains(QRegExp("^[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,6}")))) {
-        KUrl url(term);
+                (term.startsWith('#') ||
+                term.contains(QRegExp("^[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,6}"))))) {
+
+        KUrl url(manInfoLookup(term));
         processUrl(url, term);
 
         if (!KProtocolInfo::isKnownProtocol(url.protocol())) {
@@ -146,7 +161,9 @@
 
     KUrl urlToRun(location);
 
-    if ((type == Plasma::RunnerContext::NetworkLocation || type == \
Plasma::RunnerContext::UnknownType) && +    if (location.startsWith('#')) {
+        urlToRun = manInfoLookup(location);
+    } else if ((type == Plasma::RunnerContext::NetworkLocation || type == \
Plasma::RunnerContext::UnknownType) &&  (data.startsWith("http://") || \
                data.startsWith("ftp://"))) {
         // the text may have changed while we were running, so we have to refresh
         // our content


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

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