summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/orecur.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/orecur.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/orecur.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h
index d7ecd90..60508f5 100644
--- a/libopie2/opiepim/core/orecur.h
+++ b/libopie2/opiepim/core/orecur.h
@@ -1,107 +1,134 @@
1/* 1/*
2 * GPL from TT 2 This file is part of the Opie Project
3 */ 3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
4 29
5#ifndef OPIE_RECUR_H 30#ifndef OPIE_RECUR_H
6#define OPIE_RECUR_H 31#define OPIE_RECUR_H
7 32
8#include <sys/types.h> 33#include <sys/types.h>
9 34
10#include <qdatetime.h> 35#include <qdatetime.h>
11#include <qvaluelist.h> 36#include <qvaluelist.h>
12#include <qmap.h> 37#include <qmap.h>
13 38
14 39
40namespace Opie {
15/** 41/**
16 * Class to handle Recurrencies.. 42 * Class to handle Recurrencies..
17 */ 43 */
18 44
19class ORecur { 45class ORecur {
20public: 46public:
21 typedef QValueList<QDate> ExceptionList; 47 typedef QValueList<QDate> ExceptionList;
22 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, 48 enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay,
23 MonthlyDate, Yearly }; 49 MonthlyDate, Yearly };
24 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, 50 enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08,
25 FRI = 0x10, SAT = 0x20, SUN = 0x40 }; 51 FRI = 0x10, SAT = 0x20, SUN = 0x40 };
26 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, 52 enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate,
27 EndDate, Created, Exceptions }; 53 EndDate, Created, Exceptions };
28 54
29 ORecur(); 55 ORecur();
30 ORecur( const QMap<int, QString>& map ); 56 ORecur( const QMap<int, QString>& map );
31 ORecur( const ORecur& ); 57 ORecur( const ORecur& );
32 ~ORecur(); 58 ~ORecur();
33 59
34 ORecur &operator=( const ORecur& ); 60 ORecur &operator=( const ORecur& );
35 bool operator==(const ORecur& )const; 61 bool operator==(const ORecur& )const;
36 62
37 bool doesRecur()const; 63 bool doesRecur()const;
38 /* if it recurrs on that day */ 64 /* if it recurrs on that day */
39 bool doesRecur( const QDate& ); 65 bool doesRecur( const QDate& );
40 RepeatType type()const; 66 RepeatType type()const;
41 int frequency()const; 67 int frequency()const;
42 int position()const; 68 int position()const;
43 char days()const; 69 char days()const;
44 bool hasEndDate()const; 70 bool hasEndDate()const;
45 QDate start()const; 71 QDate start()const;
46 QDate endDate()const; 72 QDate endDate()const;
47 QDateTime createdDateTime()const; 73 QDateTime createdDateTime()const;
48 /** 74 /**
49 * starting on monday=0, sunday=6 75 * starting on monday=0, sunday=6
50 * for convience 76 * for convience
51 */ 77 */
52 bool repeatOnWeekDay( int day )const; 78 bool repeatOnWeekDay( int day )const;
53 79
54 /** 80 /**
55 * FromWhereToStart is not included!!! 81 * FromWhereToStart is not included!!!
56 */ 82 */
57 bool nextOcurrence( const QDate& FromWhereToStart, QDate &recurDate ); 83 bool nextOcurrence( const QDate& FromWhereToStart, QDate &recurDate );
58 84
59 /** 85 /**
60 * The module this ORecur belongs to 86 * The module this ORecur belongs to
61 */ 87 */
62 QString service()const; 88 QString service()const;
63 89
64 /* 90 /*
65 * reference to the exception list 91 * reference to the exception list
66 */ 92 */
67 ExceptionList &exceptions(); 93 ExceptionList &exceptions();
68 94
69 /** 95 /**
70 * the current repetition 96 * the current repetition
71 */ 97 */
72 int repetition()const; 98 int repetition()const;
73 99
74 void setType( const RepeatType& ); 100 void setType( const RepeatType& );
75 void setFrequency( int freq ); 101 void setFrequency( int freq );
76 void setPosition( int pos ); 102 void setPosition( int pos );
77 void setDays( char c); 103 void setDays( char c);
78 void setEndDate( const QDate& dt ); 104 void setEndDate( const QDate& dt );
79 void setStart( const QDate& dt ); 105 void setStart( const QDate& dt );
80 void setCreatedDateTime( const QDateTime& ); 106 void setCreatedDateTime( const QDateTime& );
81 void setHasEndDate( bool b ); 107 void setHasEndDate( bool b );
82 void setRepitition(int ); 108 void setRepitition(int );
83 109
84 void setService( const QString& ser ); 110 void setService( const QString& ser );
85 111
86 QMap<int, QString> toMap() const; 112 QMap<int, QString> toMap() const;
87 void fromMap( const QMap<int, QString>& map ); 113 void fromMap( const QMap<int, QString>& map );
88 114
89 /* almost internal */ 115 /* almost internal */
90 QString toString()const; 116 QString toString()const;
91private: 117private:
92 bool p_nextOccurrence( const QDate& from, QDate& next ); 118 bool p_nextOccurrence( const QDate& from, QDate& next );
93 void deref(); 119 void deref();
94 inline void checkOrModify(); 120 inline void checkOrModify();
95 121
96 /* Converts rType to String */ 122 /* Converts rType to String */
97 QString rTypeString() const; 123 QString rTypeString() const;
98 /* Returns a map to convert Stringname for RType to RepeatType */ 124 /* Returns a map to convert Stringname for RType to RepeatType */
99 QMap<QString, RepeatType> rTypeValueConvertMap() const; 125 QMap<QString, RepeatType> rTypeValueConvertMap() const;
100 126
101 class Data; 127 class Data;
102 Data* data; 128 Data* data;
103 class ORecurPrivate; 129 class ORecurPrivate;
104 ORecurPrivate *d; 130 ORecurPrivate *d;
105}; 131};
106 132
133}
107#endif 134#endif