libkcal

calformat.cpp
1/*
2 This file is part of libkcal.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#include <tdelocale.h>
23#include <kdebug.h>
24#include <tdeapplication.h>
25
26#include "calformat.h"
27
28using namespace KCal;
29
30TQString CalFormat::mApplication = TQString::fromLatin1("libkcal");
31TQString CalFormat::mProductId = TQString::fromLatin1("-//K Desktop Environment//NONSGML libkcal 3.5//EN");
32
33
34CalFormat::CalFormat()
35{
36 mException = 0;
37}
38
40{
41 delete mException;
42}
43
45{
46 delete mException;
47 mException = 0;
48}
49
51{
52 delete mException;
53 mException = exception;
54}
55
57{
58 return mException;
59}
60
61void CalFormat::setApplication(const TQString& application, const TQString& productID)
62{
63 mApplication = application;
64 mProductId = productID;
65}
66
68{
69 int hashTime = TQTime::currentTime().hour() +
70 TQTime::currentTime().minute() + TQTime::currentTime().second() +
71 TQTime::currentTime().msec();
72 TQString uidStr = TQString("%1-%2.%3")
73 .arg(mApplication)
74 .arg(TDEApplication::random())
75 .arg(hashTime);
76 return uidStr;
77}
78
static const TQString & application()
Return the application name used in unique IDs and error messages.
Definition: calformat.h:85
void setException(ErrorFormat *error)
Set exception for this object.
Definition: calformat.cpp:50
void clearException()
Clear exception status of this format object.
Definition: calformat.cpp:44
virtual ~CalFormat()
Destruct calendar format.
Definition: calformat.cpp:39
ErrorFormat * exception()
Return exception, if there is any, containing information about the last error that occurred.
Definition: calformat.cpp:56
static TQString createUniqueId()
Create a unique id string.
Definition: calformat.cpp:67
static void setApplication(const TQString &app, const TQString &productID)
Set the application name for use in unique IDs and error messages, and product ID for incidence PRODI...
Definition: calformat.cpp:61
Calendar format related error class.
Definition: exceptions.h:65
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38