1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3 * (c) 2007 Leo Franchi <lfranchi@gmail.com> *
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. *
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. *
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"
27 #include "ContextObserver.h"
28 #include "ContextView.h"
29 #include "ServiceInfoProxy.h"
30 #include "TheInstances.h"
34 using namespace Context
;
36 ServiceEngine::ServiceEngine( QObject
* parent
, const QStringList
& args
)
37 : DataEngine( parent
)
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
)
56 /* m_sources << name; // we are already enabled if we are alive*/
57 setData( name
, QVariant());
62 void ServiceEngine::message( const ContextState
& state
)
65 if( state
== Current
&& m_requested
) {
66 m_storedInfo
= ServiceInfoProxy::instance()->info();
72 void ServiceEngine::serviceInfoChanged(QVariantMap infoMap
)
74 m_storedInfo
= infoMap
;
78 void ServiceEngine::update()
81 setData( "service", "service_name", m_storedInfo
["service_name"] );
82 setData( "service", "main_info", m_storedInfo
["main_info"] );
88 #include "ServiceEngine.moc"