• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

KCalCore 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 */
00028 #include "freebusyurlstore.h"
00029 
00030 #include <KConfig>
00031 #include <KConfigGroup>
00032 #include <KStandardDirs>
00033 
00034 #include <QtCore/QCoreApplication>
00035 
00036 using namespace KCalCore;
00037 
00038 //@cond PRIVATE
00039 class FreeBusyUrlStore::Private
00040 {
00041   public:
00042     Private()
00043      : mConfig(0)
00044     {}
00045     ~Private()
00046     {
00047       qRemovePostRoutine(cleanupFreeBusyUrlStore);
00048     }
00049     KConfig *mConfig;
00050 
00051     static FreeBusyUrlStore *sSelf;
00052     static void cleanupFreeBusyUrlStore()
00053     {
00054       delete sSelf;
00055       sSelf = 0;
00056     }
00057 };
00058 FreeBusyUrlStore *FreeBusyUrlStore::Private::sSelf = 0;
00059 //@endcond
00060 
00061 FreeBusyUrlStore *FreeBusyUrlStore::self()
00062 {
00063   static Private p;
00064   if ( !p.sSelf ) {
00065     p.sSelf = new FreeBusyUrlStore();
00066     qAddPostRoutine( Private::cleanupFreeBusyUrlStore );
00067   }
00068   return p.sSelf;
00069 }
00070 
00071 FreeBusyUrlStore::FreeBusyUrlStore() : d( new Private() )
00072 {
00073   QString configFile =
00074     KStandardDirs::locateLocal( "data", "korganizer/freebusyurls" );
00075   d->mConfig = new KConfig( configFile );
00076 }
00077 
00078 FreeBusyUrlStore::~FreeBusyUrlStore()
00079 {
00080   delete d->mConfig;
00081   delete d;
00082 }
00083 
00084 void FreeBusyUrlStore::writeUrl( const QString &email, const QString &url )
00085 {
00086   KConfigGroup group = d->mConfig->group( email );
00087   group.writeEntry( "url", url );
00088 }
00089 
00090 QString FreeBusyUrlStore::readUrl( const QString &email )
00091 {
00092   KConfigGroup group = d->mConfig->group( email );
00093   return group.readEntry( "url" );
00094 }
00095 
00096 void FreeBusyUrlStore::sync()
00097 {
00098   d->mConfig->sync();
00099 }

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal