KCal Library
calformat.cpp
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcal library. 00003 00004 Copyright (c) 2001 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 */ 00032 #include "calformat.h" 00033 00034 #include <klocale.h> 00035 #include <kdebug.h> 00036 #include <krandom.h> 00037 00038 using namespace KCal; 00039 00044 //@cond PRIVATE 00045 class KCal::CalFormat::Private 00046 { 00047 public: 00048 Private() : mException( 0 ) {} 00049 ~Private() { delete mException; } 00050 static QString mApplication; // Name of application, for creating unique ID strings 00051 static QString mProductId; // PRODID string to write to calendar files 00052 QString mLoadedProductId; // PRODID string loaded from calendar file 00053 ErrorFormat *mException; 00054 }; 00055 00056 QString CalFormat::Private::mApplication = QLatin1String( "libkcal" ); 00057 QString CalFormat::Private::mProductId = 00058 QLatin1String( "-//K Desktop Environment//NONSGML libkcal 4.3//EN" ); 00059 //@endcond 00060 00061 CalFormat::CalFormat() 00062 : d( new KCal::CalFormat::Private ) 00063 { 00064 } 00065 00066 CalFormat::~CalFormat() 00067 { 00068 delete d; 00069 } 00070 00071 void CalFormat::clearException() 00072 { 00073 delete d->mException; 00074 d->mException = 0; 00075 } 00076 00077 void CalFormat::setException( ErrorFormat *exception ) 00078 { 00079 delete d->mException; 00080 d->mException = exception; 00081 } 00082 00083 ErrorFormat *CalFormat::exception() 00084 { 00085 return d->mException; 00086 } 00087 00088 void CalFormat::setApplication( const QString &application, 00089 const QString &productID ) 00090 { 00091 Private::mApplication = application; 00092 Private::mProductId = productID; 00093 } 00094 00095 const QString &CalFormat::application() 00096 { 00097 return Private::mApplication; 00098 } 00099 00100 const QString &CalFormat::productId() 00101 { 00102 return Private::mProductId; 00103 } 00104 00105 const QString &CalFormat::loadedProductId() 00106 { 00107 return d->mLoadedProductId; 00108 } 00109 00110 void CalFormat::setLoadedProductId( const QString &id ) 00111 { 00112 d->mLoadedProductId = id; 00113 } 00114 00115 QString CalFormat::createUniqueId() 00116 { 00117 int hashTime = QTime::currentTime().hour() + 00118 QTime::currentTime().minute() + QTime::currentTime().second() + 00119 QTime::currentTime().msec(); 00120 QString uidStr = QString( "%1-%2.%3" ). 00121 arg( Private::mApplication ). 00122 arg( KRandom::random() ). 00123 arg( hashTime ); 00124 return uidStr; 00125 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:10:04 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:10:04 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.