Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opimoccurrence.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003                              Copyright (C) 2003, 2004 Holger Freyther <zecke@handhelds.org>
00004               =.             Copyright (C) The Opie Team <opie-devel@handhelds.org>
00005             .=l.
00006            .>+-=
00007  _;:,     .>    :=|.         This program is free software; you can
00008 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00009 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00010 .="- .-=="i,     .._         License as published by the Free Software
00011  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00012      ._= =}       :          or (at your option) any later version.
00013     .%`+i>       _;_.
00014     .i_,=:_.      -<s.       This program is distributed in the hope that
00015      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00016     : ..    .:,     . . .    without even the implied warranty of
00017     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00018   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00019 ..}^=.=       =       ;      Library General Public License for more
00020 ++=   -.     .`     .:       details.
00021  :     =  ...= . :.=-
00022  -.   .:....=;==+<;          You should have received a copy of the GNU
00023   -_. . .   )=.  =           Library General Public License along with
00024     --        :-=`           this library; see the file COPYING.LIB.
00025                              If not, write to the Free Software Foundation,
00026                              Inc., 59 Temple Place - Suite 330,
00027                              Boston, MA 02111-1307, USA.
00028 */
00029 
00030 #ifndef OPIE_PIM_OCCURRENCE_H
00031 #define OPIE_PIM_OCCURRENCE_H
00032 
00033 #include <opie2/osharedpointer.h>
00034 #include <opie2/opimrecord.h>
00035 #include <opie2/opimevent.h>
00036 #include <opie2/opimtodo.h>
00037 #include <opie2/opimcontact.h>
00038 
00039 #include <qdatetime.h>
00040 #include <qstringlist.h>
00041 
00042 namespace Opie {
00043 
00044 template<class T> class OPimAccessTemplate;
00055 class OPimOccurrence {
00056     friend class OPimBase;
00057 public:
00058     typedef QValueList<OPimOccurrence> List;
00063     enum Position {
00064         MidWay,  /* This OPimOccurrence is somewhere in between Start and End  */
00065         Start,   /* This OPimOccurrence is the Start of a multi day Occurrence */
00066         End,     /* This OPimOccurrence is the End of a multi day Occurrence   */
00067         StartEnd /* This OPimOccurrence only spans one day                     */
00068     };
00069 
00071     OPimOccurrence();
00072     OPimOccurrence( const OPimOccurrence& );
00073     ~OPimOccurrence();
00075 
00077     void setPeriod( const QDate& from );
00078     void setPeriod( const QDateTime& from, const QDateTime& to );
00079     void setPeriod( const QDate& from,  const QTime& start, const QTime& end );
00081 
00083     bool isAllDay()const;
00084     QDate date()const;
00085     QTime startTime()const;
00086     QTime endTime()const;
00087     QDateTime startDateTime()const;
00088     QDateTime endDateTime()const;
00090 
00092     QString summary()const;
00093     QString location()const;
00094     QString note()const;
00096 
00098     int length()const;
00099     Position position()const;
00100     void setPosition( enum Position& );
00102 
00104     Opie::Core::OSharedPointer<OPimRecord> record()const;
00105     OPimEvent   toEvent()const;
00106     OPimTodo    toTodo()const;
00107     OPimContact toContact()const;
00109 
00110 
00112     bool operator< ( const OPimOccurrence& )const;
00113     bool operator<=( const OPimOccurrence& )const;
00114     bool operator==( const OPimOccurrence& )const;
00115     bool operator!=( const OPimOccurrence& )const;
00116     bool operator> ( const OPimOccurrence& )const;
00117     bool operator>=( const OPimOccurrence& )const;
00118     OPimOccurrence &operator=( const OPimOccurrence& );
00120 
00121 private:
00122     QDate m_occurrence;
00123     QTime m_start, m_end;
00124     bool m_isAllDay : 1;
00125     enum Position m_pos;
00126 
00127     void deref();
00128     inline void changeOrModify();
00129 
00130     struct Private;
00131     struct Data;
00132 
00133     Data *data;
00134     Private *d;
00135 
00136 private: // ctor
00137     OPimOccurrence( OPimOccurrence::Data *, enum Position );
00138     template<class T> T internalToRecord()const;
00139 };
00140 }
00141 
00142 #endif

Generated on Sat Nov 5 16:16:21 2005 for OPIE by  doxygen 1.4.2