libkcal

freebusyurlstore.cpp
1/*
2 This file is part of libkcal.
3
4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#include "freebusyurlstore.h"
23
24#include <kstaticdeleter.h>
25#include <tdeconfig.h>
26#include <tdestandarddirs.h>
27
28using namespace KCal;
29
30static KStaticDeleter<FreeBusyUrlStore> selfDeleter;
31
32FreeBusyUrlStore *FreeBusyUrlStore::mSelf = 0;
33
34FreeBusyUrlStore *FreeBusyUrlStore::self()
35{
36 if ( !mSelf ) {
37 selfDeleter.setObject( mSelf, new FreeBusyUrlStore() );
38 }
39 return mSelf;
40}
41
42FreeBusyUrlStore::FreeBusyUrlStore()
43{
44 TQString configFile = locateLocal( "data", "korganizer/freebusyurls" );
45 mConfig = new TDEConfig( configFile );
46}
47
48FreeBusyUrlStore::~FreeBusyUrlStore()
49{
50 delete mConfig;
51}
52
53void FreeBusyUrlStore::writeUrl( const TQString &email, const TQString &url )
54{
55 mConfig->setGroup( email );
56
57 mConfig->writeEntry( "url", url );
58}
59
60TQString FreeBusyUrlStore::readUrl( const TQString &email )
61{
62 mConfig->setGroup( email );
63
64 return mConfig->readEntry( "url" );
65}
66
67void FreeBusyUrlStore::sync()
68{
69 mConfig->sync();
70}
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38