1 /***************************************************************************
2 service.cpp - A DCOP Service to provide RSS data
4 begin : Saturday 15 February 2003
5 copyright : (C) 2003 by Ian Reinhart Geiser
6 email : geiseri@kde.org
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include <kapplication.h>
24 RSSService::RSSService() :
25 DCOPObject("RSSService")
27 m_list
.setAutoDelete( true );
32 RSSService::~RSSService()
37 QStringList
RSSService::list()
40 Q3DictIterator
<RSSDocument
> itr(m_list
);
41 for(; itr
.current(); ++itr
)
42 lst
.append(itr
.currentKey());
46 DCOPRef
RSSService::add(QString id
)
48 if(m_list
.find(id
) == 0L) { // add a new one only if we need to
49 m_list
.insert(id
, new RSSDocument(id
));
56 void RSSService::remove(QString id
)
63 DCOPRef
RSSService::document(QString id
)
66 return DCOPRef(m_list
[id
]);
71 void RSSService::exit()
73 //Save all current RSS links.
80 void RSSService::loadLinks()
82 KConfig
*conf
= KGlobal::config();
83 conf
->setGroup("RSS Links");
84 const QStringList links
= conf
->readEntry ("links",QStringList());
85 QStringList::ConstIterator it
= links
.begin();
86 QStringList::ConstIterator end
= links
.end();
87 for ( ; it
!= end
; ++it
)
91 void RSSService::saveLinks()
93 KConfig
*conf
= KGlobal::config();
94 conf
->setGroup("RSS Links");
96 Q3DictIterator
<RSSDocument
> itr(m_list
);
97 for(; itr
.current(); ++itr
)
98 lst
.append(itr
.currentKey());
100 conf
->writeEntry("links", lst
);