-rw-r--r-- | libopie/todoevent.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index 7dbf907..28b2e98 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp | |||
@@ -6,13 +6,13 @@ | |||
6 | 6 | ||
7 | ToDoEvent::ToDoEvent(const ToDoEvent &event ) | 7 | ToDoEvent::ToDoEvent(const ToDoEvent &event ) |
8 | { | 8 | { |
9 | *this = event; | 9 | *this = event; |
10 | } | 10 | } |
11 | 11 | ||
12 | ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, | 12 | ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, |
13 | const QString &description, bool hasDate, QDate date, int uid ) | 13 | const QString &description, bool hasDate, QDate date, int uid ) |
14 | { | 14 | { |
15 | qWarning("todoEvent c'tor" ); | 15 | qWarning("todoEvent c'tor" ); |
16 | m_date = date; | 16 | m_date = date; |
17 | m_isCompleted = completed; | 17 | m_isCompleted = completed; |
18 | m_hasDate = hasDate; | 18 | m_hasDate = hasDate; |
@@ -25,14 +25,14 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, | |||
25 | delete uidgen; | 25 | delete uidgen; |
26 | }// generate the ids | 26 | }// generate the ids |
27 | m_uid = uid; | 27 | m_uid = uid; |
28 | } | 28 | } |
29 | QArray<int> ToDoEvent::categories()const | 29 | QArray<int> ToDoEvent::categories()const |
30 | { | 30 | { |
31 | QArray<int> array(1); // currently the datebook can be only in one category | 31 | QArray<int> array(m_category.count() ); // currently the datebook can be only in one category |
32 | array = Qtopia::Record::idsFromString( category() ); | 32 | array = Qtopia::Record::idsFromString( m_category.join(";") ); |
33 | return array; | 33 | return array; |
34 | } | 34 | } |
35 | bool ToDoEvent::match( const QRegExp ®Exp )const | 35 | bool ToDoEvent::match( const QRegExp ®Exp )const |
36 | { | 36 | { |
37 | if( QString::number( m_priority ).find( regExp ) != -1 ){ | 37 | if( QString::number( m_priority ).find( regExp ) != -1 ){ |
38 | return true; | 38 | return true; |
@@ -52,20 +52,34 @@ bool ToDoEvent::hasDate() const | |||
52 | return m_hasDate; | 52 | return m_hasDate; |
53 | } | 53 | } |
54 | int ToDoEvent::priority()const | 54 | int ToDoEvent::priority()const |
55 | { | 55 | { |
56 | return m_priority; | 56 | return m_priority; |
57 | } | 57 | } |
58 | QString ToDoEvent::category()const | 58 | QStringList ToDoEvent::allCategories()const |
59 | { | 59 | { |
60 | return m_category; | 60 | return m_category; |
61 | } | 61 | } |
62 | void ToDoEvent::insertCategory(const QString &str ) | ||
63 | { | ||
64 | m_category.append( str ); | ||
65 | } | ||
66 | void ToDoEvent::clearCategories() | ||
67 | { | ||
68 | m_category.clear(); | ||
69 | } | ||
70 | void ToDoEvent::setCategories(const QStringList &list ) | ||
71 | { | ||
72 | m_category = list; | ||
73 | qWarning("todoevent: %s", list.join(";" ).latin1() ); | ||
74 | } | ||
62 | QDate ToDoEvent::date()const | 75 | QDate ToDoEvent::date()const |
63 | { | 76 | { |
64 | return m_date; | 77 | return m_date; |
65 | } | 78 | } |
79 | |||
66 | QString ToDoEvent::description()const | 80 | QString ToDoEvent::description()const |
67 | { | 81 | { |
68 | return m_desc; | 82 | return m_desc; |
69 | } | 83 | } |
70 | void ToDoEvent::setCompleted( bool completed ) | 84 | void ToDoEvent::setCompleted( bool completed ) |
71 | { | 85 | { |
@@ -79,13 +93,14 @@ void ToDoEvent::setDescription(const QString &desc ) | |||
79 | { | 93 | { |
80 | m_desc = Qtopia::simplifyMultiLineSpace(desc ); | 94 | m_desc = Qtopia::simplifyMultiLineSpace(desc ); |
81 | } | 95 | } |
82 | void ToDoEvent::setCategory( const QString &cat ) | 96 | void ToDoEvent::setCategory( const QString &cat ) |
83 | { | 97 | { |
84 | qWarning("setCategory %s", cat.latin1() ); | 98 | qWarning("setCategory %s", cat.latin1() ); |
85 | m_category = cat; | 99 | m_category.clear(); |
100 | m_category << cat; | ||
86 | } | 101 | } |
87 | void ToDoEvent::setPriority(int prio ) | 102 | void ToDoEvent::setPriority(int prio ) |
88 | { | 103 | { |
89 | m_priority = prio; | 104 | m_priority = prio; |
90 | } | 105 | } |
91 | void ToDoEvent::setDate( QDate date ) | 106 | void ToDoEvent::setDate( QDate date ) |
@@ -148,13 +163,13 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const | |||
148 | } | 163 | } |
149 | } | 164 | } |
150 | return true; | 165 | return true; |
151 | } | 166 | } |
152 | bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const | 167 | bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const |
153 | { | 168 | { |
154 | if( m_date == toDoEvent.m_date && m_isCompleted == toDoEvent.m_isCompleted && m_hasDate == toDoEvent.m_hasDate && m_priority == toDoEvent.m_priority && m_category == toDoEvent.m_category && m_desc == toDoEvent.m_category ) | 169 | if( m_date == toDoEvent.m_date && m_isCompleted == toDoEvent.m_isCompleted && m_hasDate == toDoEvent.m_hasDate && m_priority == toDoEvent.m_priority && m_category == toDoEvent.m_category && m_desc == toDoEvent.m_desc ) |
155 | return true; | 170 | return true; |
156 | return false; | 171 | return false; |
157 | } | 172 | } |
158 | ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) | 173 | ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) |
159 | { | 174 | { |
160 | m_date = item.m_date; | 175 | m_date = item.m_date; |