2 Copyright (C) 2005-2006 by Olivier Goffart <ogoffart at kde.org>
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, or (at your option)
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 Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "knotifyconfig.h"
23 #include <ksharedconfig.h>
24 #include <kconfiggroup.h>
27 KNotifyConfig::KNotifyConfig( const QString
& _appname
, const ContextList
& _contexts
, const QString
& _eventid
)
29 eventsfile(KSharedConfig::openConfig (_appname
+'/'+_appname
+ ".notifyrc" , KConfig::NoGlobals
, "data" )),
30 configfile(KSharedConfig::openConfig (_appname
+QString::fromAscii( ".notifyrc" ), KConfig::NoGlobals
)),
31 contexts(_contexts
) , eventid(_eventid
)
33 // kDebug(300) << appname << " , " << eventid;
36 KNotifyConfig::~KNotifyConfig()
40 QString
KNotifyConfig::readEntry( const QString
& entry
, bool path
)
42 QPair
<QString
, QString
> context
;
43 foreach( context
, contexts
)
45 const QString group
="Event/" + eventid
+ '/' + context
.first
+ '/' + context
.second
;
46 if( configfile
->hasGroup( group
) )
48 KConfigGroup
cg(configfile
, group
);
49 QString p
=path
? cg
.readPathEntry(entry
, QString()) : cg
.readEntry(entry
,QString());
54 // kDebug(300) << entry << " not found in contexts ";
55 const QString group
="Event/" + eventid
;
56 if(configfile
->hasGroup( group
) )
58 KConfigGroup
cg(configfile
, group
);
59 QString p
=path
? cg
.readPathEntry(entry
, QString()) : cg
.readEntry(entry
,QString());
63 // kDebug(300) << entry << " not found in config ";
64 if(eventsfile
->hasGroup( group
) )
66 KConfigGroup
cg( eventsfile
, group
);
67 QString p
=path
? cg
.readPathEntry(entry
, QString()) : cg
.readEntry(entry
, QString());
71 // kDebug(300) << entry << " not found !!! ";