KCal Library
calformat.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00045 class KCal::CalFormat::Private
00046 {
00047 public:
00048 Private() : mException( 0 ) {}
00049 ~Private() { delete mException; }
00050 static QString mApplication;
00051 static QString mProductId;
00052 QString mLoadedProductId;
00053 ErrorFormat *mException;
00054 };
00055
00056
00057 QString CalFormat::Private::mApplication = QLatin1String( "libkcal" );
00058 QString CalFormat::Private::mProductId =
00059 QLatin1String( "-//K Desktop Environment//NONSGML libkcal 3.5//EN" );
00060
00061
00062 CalFormat::CalFormat()
00063 : d( new KCal::CalFormat::Private )
00064 {
00065 }
00066
00067 CalFormat::~CalFormat()
00068 {
00069 delete d;
00070 }
00071
00072 void CalFormat::clearException()
00073 {
00074 delete d->mException;
00075 d->mException = 0;
00076 }
00077
00078 void CalFormat::setException( ErrorFormat *exception )
00079 {
00080 delete d->mException;
00081 d->mException = exception;
00082 }
00083
00084 ErrorFormat *CalFormat::exception()
00085 {
00086 return d->mException;
00087 }
00088
00089 void CalFormat::setApplication( const QString &application,
00090 const QString &productID )
00091 {
00092 Private::mApplication = application;
00093 Private::mProductId = productID;
00094 }
00095
00096 const QString &CalFormat::application()
00097 {
00098 return Private::mApplication;
00099 }
00100
00101 const QString &CalFormat::productId()
00102 {
00103 return Private::mProductId;
00104 }
00105
00106 const QString &CalFormat::loadedProductId()
00107 {
00108 return d->mLoadedProductId;
00109 }
00110
00111 void CalFormat::setLoadedProductId( const QString &id )
00112 {
00113 d->mLoadedProductId = id;
00114 }
00115
00116 QString CalFormat::createUniqueId()
00117 {
00118 int hashTime = QTime::currentTime().hour() +
00119 QTime::currentTime().minute() + QTime::currentTime().second() +
00120 QTime::currentTime().msec();
00121 QString uidStr = QString( "%1-%2.%3" ).
00122 arg( Private::mApplication ).
00123 arg( KRandom::random() ).
00124 arg( hashTime );
00125 return uidStr;
00126 }