branches/KDE/4.4/kdeplasma-addons/runners/mediawiki

Sebastian Kügler sebas at kde.org
Sat Feb 20 15:41:38 CET 2010


SVN commit 1093286 by sebas:

Add wiki: as  keyword to the mediawiki runner

This way we can enable this runner (and its decendants) by default, without hammering
all kinds of webservers on every keystroke (which is also a security problem).

Trading in a bit of convenience here.

CCMAIL:rich at kde.org, plasma-devel at kde.org


 M  +11 -4     mediawikirunner.cpp  


--- branches/KDE/4.4/kdeplasma-addons/runners/mediawiki/mediawikirunner.cpp #1093285:1093286
@@ -54,9 +54,10 @@
         m_icon = KIcon(info.icon());
     }
 
+    Plasma::RunnerSyntax s(i18nc("Mediawiki runner syntax", "wiki::q:"),
+                           i18n("Searches for :q: in the MediaWiki at %1.", m_apiUrl.toString()));
+    addSyntax(s);
 
-    addSyntax(Plasma::RunnerSyntax(":q:", i18n("Searches %1 for :q:.", m_name)));
-
     setSpeed( SlowSpeed );
 }
 
@@ -69,11 +70,17 @@
 {
     // TODO: check for networkconnection
 
-    const QString term = context.query();
+    QString term = context.query();
+    if (!term.startsWith("wiki:")) {
+        return;
+    } else {
+        term = term.remove("wiki:");
+    }
     if (!m_apiUrl.isValid() || term.length() < 3) {
+        kDebug() << "yours is too short" << term;
         return;
     }
-
+    kDebug() << "QUerying ... " << term << m_apiUrl;
     QEventLoop loop;
     // Wait a second, we don't want to  query on every keypress
     QMutex mutex;


More information about the Plasma-devel mailing list