Make service info plasma applet attempt to show the html info that is normally shown...
[amarok.git] / src / context / engines / service / ServiceEngine.cpp
blobdd4ff85dd43c2cb8d414661e5f8e2730b83b36ac
1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3 * (c) 2007 Leo Franchi <lfranchi@gmail.com> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
23 #include "ServiceEngine.h"
25 #include "amarok.h"
26 #include "debug.h"
27 #include "ContextObserver.h"
28 #include "ContextView.h"
29 #include "ServiceInfoProxy.h"
30 #include "TheInstances.h"
32 #include <QVariant>
34 using namespace Context;
36 ServiceEngine::ServiceEngine( QObject* parent, const QStringList& args )
37 : DataEngine( parent )
38 , m_requested( true )
40 Q_UNUSED( args )
41 DEBUG_BLOCK
42 m_sources = QStringList();
43 m_sources << "service";
45 ServiceInfoProxy::instance()->subscribe( this );
48 QStringList ServiceEngine::sources() const
50 return m_sources; // we don't have sources, if connected, it is enabled.
53 bool ServiceEngine::sourceRequested( const QString& name )
55 Q_UNUSED( name );
56 /* m_sources << name; // we are already enabled if we are alive*/
57 setData( name, QVariant());
58 m_requested = true;
59 return true;
62 void ServiceEngine::message( const ContextState& state )
64 DEBUG_BLOCK;
65 if( state == Current && m_requested ) {
66 m_storedInfo = ServiceInfoProxy::instance()->info();
67 update();
72 void ServiceEngine::serviceInfoChanged(QVariantMap infoMap)
74 m_storedInfo = infoMap;
75 update();
78 void ServiceEngine::update()
80 DEBUG_BLOCK;
81 setData( "service", "service_name", m_storedInfo["service_name"] );
82 setData( "service", "main_info", m_storedInfo["main_info"] );
88 #include "ServiceEngine.moc"