summaryrefslogtreecommitdiffstats
path: root/libkcal/event.h
blob: fed0e41a0194c41104d964b637d3f8cc0624eea6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
    This file is part of libkcal.

    Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/
#ifndef KCAL_EVENT_H
#define KCAL_EVENT_H

#include "incidence.h"
#include <kdepimmacros.h>

namespace KCal {

/**
  This class provides an Event in the sense of RFC2445.
*/
class LIBKCAL_EXPORT Event : public Incidence
{
  public:
    /**
      Transparency of event.

      Opaque      - event appears in free/busy time
      Transparent - event doesn't appear in free/busy time
    */
    enum Transparency { Opaque, Transparent };

    typedef ListBase<Event> List;

    Event();
    Event( const Event & );
    ~Event();
    Event& operator=( const Event &e );
    bool operator==( const Event & ) const;

    TQCString type() const { return "Event"; }

    /**
      Return copy of this Event. The caller owns the returned objet.
    */
    Event *clone();

    /**
      Set end date and time.
    */
    void setDtEnd(const TQDateTime &dtEnd);
    /**
      Return end date and time.
    */
    virtual TQDateTime dtEnd() const;
    /**
      Returns the day when the event ends. This might be different from
      dtEnd().date, since the end date/time is non-inclusive. So timed events
      ending at 0:00 have their end date on the day before.
    */
    TQDate dateEnd() const;
    /**
      Return end time as string formatted according to the users locale
      settings.
      @deprecated use IncidenceFormatter::timeToString()
    */
    TQString KDE_DEPRECATED dtEndTimeStr() const;
    /**
      Return end date as string formatted according to the users locale
      settings.

      @param shortfmt if true return string in short format, if false return
                      long format
      @deprecated use IncidenceFormatter::dateToString()
    */
    TQString KDE_DEPRECATED dtEndDateStr( bool shortfmt = true ) const;
    /**
      Return end date and time as string formatted according to the users locale
      settings.
      @deprecated use IncidenceFormatter::dateTimeToString()
    */
    TQString KDE_DEPRECATED dtEndStr() const;

    /**
      Set whether the event has an end date/time.
    */
    void setHasEndDate(bool);
    /**
      Return whether the event has an end date/time.
    */
    bool hasEndDate() const;

    /**
      Return true if the event spans multiple days, otherwise return false.
    */
    bool isMultiDay() const;

    /**
      Set the event's time transparency level.
    */
    void setTransparency( Transparency transparency );
    /**
      Return the event's time transparency level.
    */
    Transparency transparency() const;

    /**
      Set duration of this event.
    */
    void setDuration( int seconds );

  protected:
    /** Return the end date/time of the base incidence. */
    virtual TQDateTime endDateRecurrenceBase() const { return dtEnd(); }
  private:
    bool accept( Visitor &v ) { return v.visit( this ); }

    TQDateTime mDtEnd;
    bool mHasEndDate;
    Transparency mTransparency;

    class Private;
    Private *d;
};

}

#endif