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

List:       kde-commits
Subject:    playground/base/plasma/runners/mediawiki
From:       Sebastian Kügler <sebas () kde ! org>
Date:       2009-11-06 0:13:00
Message-ID: 1257466380.643115.10336.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1045407 by sebas:

Cleanup

 M  +1 -17     mediawiki.cpp  
 M  +0 -6      mediawiki.h  
 M  +6 -27     mediawikirunner.cpp  
 M  +1 -9      mediawikirunner.h  


--- trunk/playground/base/plasma/runners/mediawiki/mediawiki.cpp #1045406:1045407
@@ -1,6 +1,6 @@
 /*
  *   Copyright 2009 by Richard Moore <rich@kde.org>
- *   Copyright 2009 by Sebastian Kügler <sebas@kde.org>
+ *   Copyright 2009 by Sebastian K?gler <sebas@kde.org>
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU Library General Public License as
@@ -30,7 +30,6 @@
 #include <Plasma/RunnerContext>
 
 #include "mediawiki.h"
-//#include "mediawikirunner.h"
 
 enum State {
     StateApiChanged,
@@ -48,8 +47,6 @@
     QNetworkReply *reply;
     int timeout;
     QUrl query;
-    //MediaWikiRunner *runner;
-    //Plasma::RunnerContext *context;
 };
 
 MediaWiki::MediaWiki( QObject *parent )
@@ -64,8 +61,6 @@
     d->maxItems = 10;
     d->timeout = 30 * 1000; // 30 second
     d->reply = 0;
-    //d->runner = 0;
-    //d->context = 0;
 
     connect( d->manager, SIGNAL(finished(QNetworkReply*)), SLOT(finished(QNetworkReply *)) );
 }
@@ -75,17 +70,6 @@
     delete d;
 }
 
-/*
-void MediaWiki::setRunnerContext(Plasma::RunnerContext &context)
-{
-    d->context = &context;
-}
-
-void MediaWiki::setMediaWikiRunner(MediaWikiRunner *runner)
-{
-    d->runner = runner;
-}
-*/
 QList<MediaWiki::Result> MediaWiki::results() const
 {
     return d->results;
--- trunk/playground/base/plasma/runners/mediawiki/mediawiki.h #1045406:1045407
@@ -27,9 +27,6 @@
 
 class QNetworkReply;
 
-//namespace Plasma { class RunnerContext; }
-//class MediaWikiRunner;
-
 /**
  * Searches MediaWiki based wikis like wikipedia and techbase.
  *
@@ -111,9 +108,6 @@
      */
     void setTimeout( int millis );
 
-    //void setRunnerContext(Plasma::RunnerContext &context);
-    //void setMediaWikiRunner(MediaWikiRunner *runner);
-
 signals:
     /**
      * Emitted when a search has been completed.
--- trunk/playground/base/plasma/runners/mediawiki/mediawikirunner.cpp #1045406:1045407
@@ -78,9 +78,11 @@
 
     QEventLoop loop;
     // Wait a second, we don't want to  query on every keypress
-    m_mutex.lock();
-    m_waiter.wait(&m_mutex, 1000);
-    m_mutex.unlock();
+    QMutex mutex;
+    QWaitCondition waiter;
+    mutex.lock();
+    waiter.wait(&mutex, 1000);
+    mutex.unlock();
 
     if (!context.isValid()) {
         return;
@@ -89,12 +91,10 @@
     MediaWiki mediawiki;
     mediawiki.setMaxItems(3);
     mediawiki.setApiUrl( m_apiUrl );
-    //connect( &mediawiki, SIGNAL(finished(bool)), SLOT(mediaWikiFinished(bool)) );
     connect( &mediawiki, SIGNAL(finished(bool)), &loop, SLOT(quit()) );
-    //connect( this, SIGNAL(done()), &loop, SLOT(quit()) );
 
     mediawiki.search(term);
-    kDebug() << "Wikisearch:" << term;
+    kDebug() << "Wikisearch:" << m_name << term;
 
     loop.exec();
 
@@ -110,29 +110,8 @@
         match.setData(res.url);
         context.addMatch(res.title, match);
     }
-
-    //emit done();
-
 }
 
-void MediaWikiRunner::mediaWikiFinished(bool success)
-{
-    /*
-    kDebug() << "Wikimatches:" << success << m_mediawiki->results().count();
-
-    foreach(const MediaWiki::Result& res, m_mediawiki->results()) {
-        kDebug() << "Match:" << res.url << res.title;
-        Plasma::QueryMatch match(this);
-        match.setType(Plasma::QueryMatch::PossibleMatch);
-        match.setIcon(m_icon);
-        match.setText(QString("%1: %2").arg(m_name, res.title));
-        match.setData(res.url);
-        m_context->addMatch(res.title, match);
-    }
-    */
-    emit done();
-}
-
 void MediaWikiRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
 {
     Q_UNUSED(context)
--- trunk/playground/base/plasma/runners/mediawiki/mediawikirunner.h #1045406:1045407
@@ -43,21 +43,13 @@
         void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match);
 
     signals:
-	void done();
+        void done();
 
-    private Q_SLOTS:
-        void mediaWikiFinished(bool success);
-
     private:
         KIcon m_icon;
         QString m_name;
         QString m_comment;
-        //MediaWiki* m_mediawiki;
         QUrl m_apiUrl;
-        Plasma::RunnerContext* m_context;
-
-        QMutex m_mutex;
-        QWaitCondition m_waiter;
 };
 
 K_EXPORT_PLASMA_RUNNER(mediawiki, MediaWikiRunner)
[prev in list] [next in list] [prev in thread] [next in thread] 

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