summaryrefslogtreecommitdiffabout
path: root/libkcal/event.cpp
Unidiff
Diffstat (limited to 'libkcal/event.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/event.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index dd67252..dfa265b 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -1,95 +1,94 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "event.h" 25#include "event.h"
26 26
27using namespace KCal; 27using namespace KCal;
28 28
29Event::Event() : 29Event::Event() :
30 mHasEndDate( false ), mTransparency( Opaque ) 30 mHasEndDate( false ), mTransparency( Opaque )
31{ 31{
32} 32}
33 33
34Event::Event(const Event &e) : Incidence(e) 34Event::Event(const Event &e) : Incidence(e)
35{ 35{
36 mDtEnd = e.mDtEnd; 36 mDtEnd = e.mDtEnd;
37 mHasEndDate = e.mHasEndDate; 37 mHasEndDate = e.mHasEndDate;
38 mTransparency = e.mTransparency; 38 mTransparency = e.mTransparency;
39} 39}
40 40
41Event::~Event() 41Event::~Event()
42{ 42{
43} 43}
44 44
45Incidence *Event::clone() 45Incidence *Event::clone()
46{ 46{
47 kdDebug(5800) << "Event::clone()" << endl;
48 return new Event(*this); 47 return new Event(*this);
49} 48}
50 49
51bool KCal::operator==( const Event& e1, const Event& e2 ) 50bool KCal::operator==( const Event& e1, const Event& e2 )
52{ 51{
53 return operator==( (const Incidence&)e1, (const Incidence&)e2 ) && 52 return operator==( (const Incidence&)e1, (const Incidence&)e2 ) &&
54 e1.dtEnd() == e2.dtEnd() && 53 e1.dtEnd() == e2.dtEnd() &&
55 e1.hasEndDate() == e2.hasEndDate() && 54 e1.hasEndDate() == e2.hasEndDate() &&
56 e1.transparency() == e2.transparency(); 55 e1.transparency() == e2.transparency();
57} 56}
58 57
59 58
60 59
61void Event::setDtEnd(const QDateTime &dtEnd) 60void Event::setDtEnd(const QDateTime &dtEnd)
62{ 61{
63 if (mReadOnly) return; 62 if (mReadOnly) return;
64 63
65 mDtEnd = getEvenTime( dtEnd ); 64 mDtEnd = getEvenTime( dtEnd );
66 65
67 setHasEndDate(true); 66 setHasEndDate(true);
68 setHasDuration(false); 67 setHasDuration(false);
69 68
70 updated(); 69 updated();
71} 70}
72 71
73QDateTime Event::dtEnd() const 72QDateTime Event::dtEnd() const
74{ 73{
75 if (hasEndDate()) return mDtEnd; 74 if (hasEndDate()) return mDtEnd;
76 if (hasDuration()) return dtStart().addSecs(duration()); 75 if (hasDuration()) return dtStart().addSecs(duration());
77 76
78 kdDebug(5800) << "Warning! Event '" << summary() 77 kdDebug(5800) << "Warning! Event '" << summary()
79 << "' does have neither end date nor duration." << endl; 78 << "' does have neither end date nor duration." << endl;
80 return dtStart(); 79 return dtStart();
81} 80}
82 81
83QString Event::dtEndTimeStr() const 82QString Event::dtEndTimeStr() const
84{ 83{
85 return KGlobal::locale()->formatTime(mDtEnd.time()); 84 return KGlobal::locale()->formatTime(mDtEnd.time());
86} 85}
87 86
88QString Event::dtEndDateStr(bool shortfmt) const 87QString Event::dtEndDateStr(bool shortfmt) const
89{ 88{
90 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); 89 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt);
91} 90}
92 91
93QString Event::dtEndStr(bool shortfmt) const 92QString Event::dtEndStr(bool shortfmt) const
94{ 93{
95 return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); 94 return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt);