KCal Library
freebusyurlstore.cpp
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcal library. 00003 00004 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00029 #include "freebusyurlstore.h" 00030 #include <kconfig.h> 00031 #include <kstandarddirs.h> 00032 #include <kconfiggroup.h> 00033 #include <QtCore/QCoreApplication> 00034 00035 using namespace KCal; 00036 00037 //@cond PRIVATE 00038 class FreeBusyUrlStore::Private 00039 { 00040 public: 00041 Private() 00042 : mConfig(0) 00043 {} 00044 ~Private() 00045 { 00046 qRemovePostRoutine(cleanupFreeBusyUrlStore); 00047 } 00048 KConfig *mConfig; 00049 00050 static FreeBusyUrlStore *sSelf; 00051 static void cleanupFreeBusyUrlStore() 00052 { 00053 delete sSelf; 00054 sSelf = 0; 00055 } 00056 }; 00057 FreeBusyUrlStore *FreeBusyUrlStore::Private::sSelf = 0; 00058 //@endcond 00059 00060 FreeBusyUrlStore *FreeBusyUrlStore::self() 00061 { 00062 static Private p; 00063 if ( !p.sSelf ) { 00064 p.sSelf = new FreeBusyUrlStore(); 00065 qAddPostRoutine( Private::cleanupFreeBusyUrlStore ); 00066 } 00067 return p.sSelf; 00068 } 00069 00070 FreeBusyUrlStore::FreeBusyUrlStore() : d( new Private() ) 00071 { 00072 QString configFile = 00073 KStandardDirs::locateLocal( "data", "korganizer/freebusyurls" ); 00074 d->mConfig = new KConfig( configFile ); 00075 } 00076 00077 FreeBusyUrlStore::~FreeBusyUrlStore() 00078 { 00079 delete d->mConfig; 00080 delete d; 00081 } 00082 00083 void FreeBusyUrlStore::writeUrl( const QString &email, const QString &url ) 00084 { 00085 KConfigGroup group = d->mConfig->group( email ); 00086 group.writeEntry( "url", url ); 00087 } 00088 00089 QString FreeBusyUrlStore::readUrl( const QString &email ) 00090 { 00091 KConfigGroup group = d->mConfig->group( email ); 00092 return group.readEntry( "url" ); 00093 } 00094 00095 void FreeBusyUrlStore::sync() 00096 { 00097 d->mConfig->sync(); 00098 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:49:42 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:49:42 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.