1
/****************************************************************************************
2
* Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3
* Copyright (c) 2007 Leo Franchi <lfranchi@gmail.com> *
5
* This program is free software; you can redistribute it and/or modify it under *
6
* the terms of the GNU General Public License as published by the Free Software *
7
* Foundation; either version 2 of the License, or (at your option) any later *
10
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
11
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
12
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License along with *
15
* this program. If not, see <http://www.gnu.org/licenses/>. *
16
****************************************************************************************/
18
#include "InfoEngine.h"
22
#include "ContextObserver.h"
23
#include "ContextView.h"
24
#include "browsers/InfoProxy.h"
28
using namespace Context;
30
InfoEngine::InfoEngine( QObject* parent, const QList<QVariant>& args )
31
: DataEngine( parent )
36
m_sources = QStringList();
37
m_sources << "service";
39
The::infoProxy()->subscribe( this );
42
InfoEngine::~ InfoEngine()
44
The::infoProxy()->unsubscribe( this );
47
QStringList InfoEngine::sources() const
49
return m_sources; // we don't have sources, if connected, it is enabled.
52
bool InfoEngine::sourceRequestEvent( const QString& name )
55
/* m_sources << name; // we are already enabled if we are alive*/
56
setData( name, QVariant());
62
void InfoEngine::message( const ContextState& state )
65
if( state == Current && m_requested ) {
66
m_storedInfo = The::infoProxy()->info();
72
void InfoEngine::infoChanged( QVariantMap infoMap )
74
m_storedInfo = infoMap;
78
void InfoEngine::update()
80
setData( "info", "subject_name", m_storedInfo["service_name"] );
81
setData( "info", "main_info", m_storedInfo["main_info"] );
87
#include "InfoEngine.moc"