summaryrefslogtreecommitdiff
path: root/libopie/todoevent.h
blob: ac996a11e2e7210fa528dae9d054974067b6dfa5 (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

#ifndef todoevent_h
#define todoevent_h

#include <qdatetime.h>

class ToDoEvent {
    friend class ToDoDB;
 public:
    enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW };
    ToDoEvent( bool completed = false, int priority = NORMAL, 
	       const QString &category = QString::null, 
	       const QString &description = QString::null , 
	       bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 );
    ToDoEvent(const ToDoEvent & );
    bool isCompleted() const;
    bool hasDate() const;
    int priority()const ;
    QString category()const;
    QArray<int> categories() const;
    QDate date()const;
    QString description()const;

    int uid()const { return m_uid;};
    void setCompleted(bool completed );
    void setHasDate( bool hasDate );
    // if the category doesn't exist we will create it 
    void setCategory( const QString &category );
    void setPriority(int priority );
    void setDate( QDate date );
    void setDescription(const QString& );
    bool isOverdue();

    bool match( const QRegExp &r )const;

    void setUid(int id) {m_uid = id; };
    bool operator<(const ToDoEvent &toDoEvent )const;
    bool operator<=(const ToDoEvent &toDoEvent )const;
    bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); };
    bool operator>(const ToDoEvent &toDoEvent )const;
    bool operator>=(const ToDoEvent &toDoEvent)const;
    bool operator==(const ToDoEvent &toDoEvent )const;
    ToDoEvent &operator=(const ToDoEvent &toDoEvent );
 private:
    class ToDoEventPrivate;
    ToDoEventPrivate *d;
    QDate m_date;
    bool m_isCompleted:1;
    bool m_hasDate:1;
    int m_priority;
    QString m_category;
    QString m_desc;
    int m_uid;
};


#endif