• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KCal Library

  • kcal
calformat.cpp
Go to the documentation of this file.
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*/
32#include "calformat.h"
33
34#include <klocalizedstring.h>
35#include <kdebug.h>
36#include <krandom.h>
37
38using namespace KCal;
39
44//@cond PRIVATE
45class KCal::CalFormat::Private
46{
47 public:
48 Private() : mException( 0 ) {}
49 ~Private() { delete mException; }
50 static QString mApplication; // Name of application, for creating unique ID strings
51 static QString mProductId; // PRODID string to write to calendar files
52 QString mLoadedProductId; // PRODID string loaded from calendar file
53 ErrorFormat *mException;
54};
55
56QString CalFormat::Private::mApplication = QLatin1String( "libkcal" );
57QString CalFormat::Private::mProductId =
58 QLatin1String( "-//K Desktop Environment//NONSGML libkcal 4.3//EN" );
59//@endcond
60
61CalFormat::CalFormat()
62 : d( new KCal::CalFormat::Private )
63{
64}
65
66CalFormat::~CalFormat()
67{
68 delete d;
69}
70
71void CalFormat::clearException()
72{
73 delete d->mException;
74 d->mException = 0;
75}
76
77void CalFormat::setException( ErrorFormat *exception )
78{
79 delete d->mException;
80 d->mException = exception;
81}
82
83ErrorFormat *CalFormat::exception()
84{
85 return d->mException;
86}
87
88void CalFormat::setApplication( const QString &application,
89 const QString &productID )
90{
91 Private::mApplication = application;
92 Private::mProductId = productID;
93}
94
95const QString &CalFormat::application()
96{
97 return Private::mApplication;
98}
99
100const QString &CalFormat::productId()
101{
102 return Private::mProductId;
103}
104
105const QString &CalFormat::loadedProductId()
106{
107 return d->mLoadedProductId;
108}
109
110void CalFormat::setLoadedProductId( const QString &id )
111{
112 d->mLoadedProductId = id;
113}
114
115QString CalFormat::createUniqueId()
116{
117 int hashTime = QTime::currentTime().hour() +
118 QTime::currentTime().minute() + QTime::currentTime().second() +
119 QTime::currentTime().msec();
120 QString uidStr = QString( "%1-%2.%3" ).
121 arg( Private::mApplication ).
122 arg( KRandom::random() ).
123 arg( hashTime );
124 return uidStr;
125}
calformat.h
This file is part of the API for handling calendar data and defines the CalFormat abstract base class...
KCal::CalFormat
An abstract base class that provides an interface to various calendar formats.
Definition: calformat.h:52
KCal::CalFormat::createUniqueId
static QString createUniqueId()
Creates a unique id string.
Definition: calformat.cpp:115
KCal::CalFormat::setException
void setException(ErrorFormat *error)
Sets an exception that is to be used by the functions of this class to report errors.
Definition: calformat.cpp:77
KCal::CalFormat::setLoadedProductId
void setLoadedProductId(const QString &id)
PRODID string loaded from calendar file.
Definition: calformat.cpp:110
KCal::CalFormat::clearException
void clearException()
Clears the exception status.
Definition: calformat.cpp:71
KCal::CalFormat::~CalFormat
virtual ~CalFormat()
Destructor.
Definition: calformat.cpp:66
KCal::CalFormat::CalFormat
CalFormat()
Constructs a new Calendar Format object.
Definition: calformat.cpp:61
KCal::CalFormat::setApplication
static void setApplication(const QString &application, const QString &productID)
Sets the application name for use in unique IDs and error messages, and product ID for incidence PROD...
Definition: calformat.cpp:88
KCal::CalFormat::application
static const QString & application()
Returns the application name used in unique IDs and error messages.
Definition: calformat.cpp:95
KCal::CalFormat::loadedProductId
const QString & loadedProductId()
Returns the PRODID string loaded from calendar file.
Definition: calformat.cpp:105
KCal::CalFormat::productId
static const QString & productId()
Returns the PRODID string to write into calendar files.
Definition: calformat.cpp:100
KCal::CalFormat::exception
ErrorFormat * exception()
Returns an exception, if there is any, containing information about the last error that occurred.
Definition: calformat.cpp:83
KCal::ErrorFormat
Calendar format related error class.
Definition: exceptions.h:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal