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 QString CalFormat::Private::mApplication = QLatin1String( "libkcal" );
00057 QString CalFormat::Private::mProductId =
00058 QLatin1String( "-//K Desktop Environment//NONSGML libkcal 4.3//EN" );
00059
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 }