~ubuntu-branches/ubuntu/quantal/kdepimlibs/quantal-proposed

« back to all changes in this revision

Viewing changes to kcal/calformat.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-09-06 22:45:39 UTC
  • Revision ID: james.westby@ubuntu.com-20060906224539-fiq8t03qdbqu7z3i
Tags: upstream-3.80.1
ImportĀ upstreamĀ versionĀ 3.80.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of the kcal library.
 
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 <klocale.h>
 
23
#include <kdebug.h>
 
24
#include <kapplication.h>
 
25
#include <krandom.h>
 
26
 
 
27
#include "calformat.h"
 
28
 
 
29
using namespace KCal;
 
30
 
 
31
//TODO: change strings to use "kcal" instead of "libkcal"?
 
32
QString CalFormat::mApplication = QLatin1String("libkcal");
 
33
QString CalFormat::mProductId = QLatin1String("-//K Desktop Environment//NONSGML libkcal 3.5//EN");
 
34
 
 
35
 
 
36
CalFormat::CalFormat()
 
37
{
 
38
  mException = 0;
 
39
}
 
40
 
 
41
CalFormat::~CalFormat()
 
42
{
 
43
  delete mException;
 
44
}
 
45
 
 
46
void CalFormat::clearException()
 
47
{
 
48
  delete mException;
 
49
  mException = 0;
 
50
}
 
51
 
 
52
void CalFormat::setException(ErrorFormat *exception)
 
53
{
 
54
  delete mException;
 
55
  mException = exception;
 
56
}
 
57
 
 
58
ErrorFormat *CalFormat::exception()
 
59
{
 
60
  return mException;
 
61
}
 
62
 
 
63
void CalFormat::setApplication(const QString& application, const QString& productID)
 
64
{
 
65
  mApplication = application;
 
66
  mProductId = productID;
 
67
}
 
68
 
 
69
QString CalFormat::createUniqueId()
 
70
{
 
71
  int hashTime = QTime::currentTime().hour() +
 
72
                 QTime::currentTime().minute() + QTime::currentTime().second() +
 
73
                 QTime::currentTime().msec();
 
74
  QString uidStr = QString("%1-%2.%3")
 
75
                           .arg(mApplication)
 
76
                           .arg(KRandom::random())
 
77
                           .arg(hashTime);
 
78
  return uidStr;
 
79
}
 
80