-rw-r--r-- | libopie/pim/opimaccessbackend.h | 4 | ||||
-rw-r--r-- | libopie/pim/opimaccesstemplate.h | 10 | ||||
-rw-r--r-- | libopie/pim/orecordlist.h | 4 | ||||
-rw-r--r-- | libopie/pim/otodo.cpp | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h index 0bd2723..4f00bc9 100644 --- a/libopie/pim/opimaccessbackend.h +++ b/libopie/pim/opimaccessbackend.h | |||
@@ -1,141 +1,141 @@ | |||
1 | #ifndef OPIE_PIM_ACCESS_BACKEND | 1 | #ifndef OPIE_PIM_ACCESS_BACKEND |
2 | #define OPIE_PIM_ACCESS_BACKEND | 2 | #define OPIE_PIM_ACCESS_BACKEND |
3 | 3 | ||
4 | #include <qarray.h> | 4 | #include <qarray.h> |
5 | 5 | ||
6 | #include <opie/otemplatebase.h> | 6 | #include <opie/otemplatebase.h> |
7 | #include <opie/opimrecord.h> | 7 | #include <opie/opimrecord.h> |
8 | 8 | ||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * OPimAccessBackend is the base class | 11 | * OPimAccessBackend is the base class |
12 | * for all private backends | 12 | * for all private backends |
13 | * it operates on OPimRecord as the base class | 13 | * it operates on OPimRecord as the base class |
14 | * and it's responsible for fast manipulating | 14 | * and it's responsible for fast manipulating |
15 | * the resource the implementation takes care | 15 | * the resource the implementation takes care |
16 | * of | 16 | * of |
17 | */ | 17 | */ |
18 | template <class T = OPimRecord> | 18 | template <class T = OPimRecord> |
19 | class OPimAccessBackend { | 19 | class OPimAccessBackend { |
20 | public: | 20 | public: |
21 | typedef OTemplateBase<T> Frontend; | 21 | typedef OTemplateBase<T> Frontend; |
22 | OPimAccessBackend(); | 22 | OPimAccessBackend(); |
23 | virtual ~OPimAccessBackend(); | 23 | virtual ~OPimAccessBackend(); |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * load the resource | 26 | * load the resource |
27 | */ | 27 | */ |
28 | virtual bool load() = 0; | 28 | virtual bool load() = 0; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * reload the resource | 31 | * reload the resource |
32 | */ | 32 | */ |
33 | virtual bool reload() = 0; | 33 | virtual bool reload() = 0; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * save the resource and | 36 | * save the resource and |
37 | * all it's changes | 37 | * all it's changes |
38 | */ | 38 | */ |
39 | virtual bool save() = 0; | 39 | virtual bool save() = 0; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * return an array of | 42 | * return an array of |
43 | * all available uids | 43 | * all available uids |
44 | */ | 44 | */ |
45 | virtual QArray<int> allRecords()const = 0; | 45 | virtual QArray<int> allRecords()const = 0; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * queryByExample for T with the SortOrder | 48 | * queryByExample for T with the SortOrder |
49 | * sort | 49 | * sort |
50 | */ | 50 | */ |
51 | virtual QArray<int> queryByExample( const T& t, int sort ) = 0; | 51 | virtual QArray<int> queryByExample( const T& t, int sort ) = 0; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * find the OPimRecord with uid @param uid | 54 | * find the OPimRecord with uid @param uid |
55 | * returns T and T.isEmpty() if nothing was found | 55 | * returns T and T.isEmpty() if nothing was found |
56 | */ | 56 | */ |
57 | virtual T find(int uid )const = 0; | 57 | virtual T find(int uid )const = 0; |
58 | 58 | ||
59 | virtual T find(int uid, const QArray<int>& items, | 59 | virtual T find(int uid, const QArray<int>& items, |
60 | uint current, Frontend::CacheDirection )const ; | 60 | uint current, typename Frontend::CacheDirection )const ; |
61 | /** | 61 | /** |
62 | * clear the back end | 62 | * clear the back end |
63 | */ | 63 | */ |
64 | virtual void clear() = 0; | 64 | virtual void clear() = 0; |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * add T | 67 | * add T |
68 | */ | 68 | */ |
69 | virtual bool add( const T& t ) = 0; | 69 | virtual bool add( const T& t ) = 0; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * remove | 72 | * remove |
73 | */ | 73 | */ |
74 | virtual bool remove( int uid ) = 0; | 74 | virtual bool remove( int uid ) = 0; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * replace a record with T.uid() | 77 | * replace a record with T.uid() |
78 | */ | 78 | */ |
79 | virtual bool replace( const T& t ) = 0; | 79 | virtual bool replace( const T& t ) = 0; |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * setTheFrontEnd!!! | 82 | * setTheFrontEnd!!! |
83 | */ | 83 | */ |
84 | void setFrontend( Frontend* front ); | 84 | void setFrontend( Frontend* front ); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * set the read ahead count | 87 | * set the read ahead count |
88 | */ | 88 | */ |
89 | void setReadAhead( uint count ); | 89 | void setReadAhead( uint count ); |
90 | protected: | 90 | protected: |
91 | void cache( const T& t )const; | 91 | void cache( const T& t )const; |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * use a prime number here! | 94 | * use a prime number here! |
95 | */ | 95 | */ |
96 | void setSaneCacheSize( int ); | 96 | void setSaneCacheSize( int ); |
97 | 97 | ||
98 | uint readAhead()const; | 98 | uint readAhead()const; |
99 | 99 | ||
100 | private: | 100 | private: |
101 | Frontend* m_front; | 101 | Frontend* m_front; |
102 | uint m_read; | 102 | uint m_read; |
103 | 103 | ||
104 | }; | 104 | }; |
105 | 105 | ||
106 | template <class T> | 106 | template <class T> |
107 | OPimAccessBackend<T>::OPimAccessBackend() { | 107 | OPimAccessBackend<T>::OPimAccessBackend() { |
108 | m_front = 0l; | 108 | m_front = 0l; |
109 | } | 109 | } |
110 | template <class T> | 110 | template <class T> |
111 | OPimAccessBackend<T>::~OPimAccessBackend() { | 111 | OPimAccessBackend<T>::~OPimAccessBackend() { |
112 | 112 | ||
113 | } | 113 | } |
114 | template <class T> | 114 | template <class T> |
115 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { | 115 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { |
116 | m_front = fr; | 116 | m_front = fr; |
117 | } | 117 | } |
118 | template <class T> | 118 | template <class T> |
119 | void OPimAccessBackend<T>::cache( const T& t )const { | 119 | void OPimAccessBackend<T>::cache( const T& t )const { |
120 | if (m_front ) | 120 | if (m_front ) |
121 | m_front->cache( t ); | 121 | m_front->cache( t ); |
122 | } | 122 | } |
123 | template <class T> | 123 | template <class T> |
124 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { | 124 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { |
125 | if (m_front ) | 125 | if (m_front ) |
126 | m_front->setSaneCacheSize( size ); | 126 | m_front->setSaneCacheSize( size ); |
127 | } | 127 | } |
128 | template <class T> | 128 | template <class T> |
129 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, | 129 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, |
130 | uint, Frontend::CacheDirection )const { | 130 | uint, typename Frontend::CacheDirection )const { |
131 | return find( uid ); | 131 | return find( uid ); |
132 | } | 132 | } |
133 | template <class T> | 133 | template <class T> |
134 | void OPimAccessBackend<T>::setReadAhead( uint count ) { | 134 | void OPimAccessBackend<T>::setReadAhead( uint count ) { |
135 | m_read = count; | 135 | m_read = count; |
136 | } | 136 | } |
137 | template <class T> | 137 | template <class T> |
138 | uint OPimAccessBackend<T>::readAhead()const { | 138 | uint OPimAccessBackend<T>::readAhead()const { |
139 | return m_read; | 139 | return m_read; |
140 | } | 140 | } |
141 | #endif | 141 | #endif |
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h index c5523a8..6de68b1 100644 --- a/libopie/pim/opimaccesstemplate.h +++ b/libopie/pim/opimaccesstemplate.h | |||
@@ -1,259 +1,259 @@ | |||
1 | #ifndef OPIE_PIM_ACCESS_TEMPLATE_H | 1 | #ifndef OPIE_PIM_ACCESS_TEMPLATE_H |
2 | #define OPIE_PIM_ACCESS_TEMPLATE_H | 2 | #define OPIE_PIM_ACCESS_TEMPLATE_H |
3 | 3 | ||
4 | #include <qarray.h> | 4 | #include <qarray.h> |
5 | 5 | ||
6 | #include <opie/opimrecord.h> | 6 | #include <opie/opimrecord.h> |
7 | #include <opie/opimaccessbackend.h> | 7 | #include <opie/opimaccessbackend.h> |
8 | #include <opie/orecordlist.h> | 8 | #include <opie/orecordlist.h> |
9 | 9 | ||
10 | #include "opimcache.h" | 10 | #include "opimcache.h" |
11 | #include "otemplatebase.h" | 11 | #include "otemplatebase.h" |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Thats the frontend to our OPIE PIM | 14 | * Thats the frontend to our OPIE PIM |
15 | * Library. Either you want to use it's | 15 | * Library. Either you want to use it's |
16 | * interface or you want to implement | 16 | * interface or you want to implement |
17 | * your own Access lib | 17 | * your own Access lib |
18 | * Just create a OPimRecord and inherit from | 18 | * Just create a OPimRecord and inherit from |
19 | * the plugins | 19 | * the plugins |
20 | */ | 20 | */ |
21 | 21 | ||
22 | template <class T = OPimRecord > | 22 | template <class T = OPimRecord > |
23 | class OPimAccessTemplate : public OTemplateBase<T> { | 23 | class OPimAccessTemplate : public OTemplateBase<T> { |
24 | public: | 24 | public: |
25 | typedef ORecordList<T> List; | 25 | typedef ORecordList<T> List; |
26 | typedef OPimAccessBackend<T> BackEnd; | 26 | typedef OPimAccessBackend<T> BackEnd; |
27 | typedef OPimCache<T> Cache; | 27 | typedef OPimCache<T> Cache; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * c'tor BackEnd | 30 | * c'tor BackEnd |
31 | */ | 31 | */ |
32 | OPimAccessTemplate( BackEnd* end); | 32 | OPimAccessTemplate( BackEnd* end); |
33 | virtual ~OPimAccessTemplate(); | 33 | virtual ~OPimAccessTemplate(); |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * load from the backend | 36 | * load from the backend |
37 | */ | 37 | */ |
38 | virtual bool load(); | 38 | virtual bool load(); |
39 | 39 | ||
40 | /** Reload database. | 40 | /** Reload database. |
41 | * You should execute this function if the external database | 41 | * You should execute this function if the external database |
42 | * was changed. | 42 | * was changed. |
43 | * This function will load the external database and afterwards | 43 | * This function will load the external database and afterwards |
44 | * rejoin the local changes. Therefore the local database will be set consistent. | 44 | * rejoin the local changes. Therefore the local database will be set consistent. |
45 | */ | 45 | */ |
46 | virtual bool reload(); | 46 | virtual bool reload(); |
47 | 47 | ||
48 | /** Save contacts database. | 48 | /** Save contacts database. |
49 | * Save is more a "commit". After calling this function, all changes are public available. | 49 | * Save is more a "commit". After calling this function, all changes are public available. |
50 | * @return true if successful | 50 | * @return true if successful |
51 | */ | 51 | */ |
52 | virtual bool save(); | 52 | virtual bool save(); |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * if the resource was changed externally | 55 | * if the resource was changed externally |
56 | * You should use the signal handling instead of polling possible changes ! | 56 | * You should use the signal handling instead of polling possible changes ! |
57 | * zecke: Do you implement a signal for otodoaccess ? | 57 | * zecke: Do you implement a signal for otodoaccess ? |
58 | */ | 58 | */ |
59 | bool wasChangedExternally()const; | 59 | bool wasChangedExternally()const; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * return a List of records | 62 | * return a List of records |
63 | * you can iterate over them | 63 | * you can iterate over them |
64 | */ | 64 | */ |
65 | virtual List allRecords()const; | 65 | virtual List allRecords()const; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * queryByExample. | 68 | * queryByExample. |
69 | * @see otodoaccess, ocontactaccess | 69 | * @see otodoaccess, ocontactaccess |
70 | */ | 70 | */ |
71 | virtual List queryByExample( const T& t, int querySettings ); | 71 | virtual List queryByExample( const T& t, int querySettings ); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * find the OPimRecord uid | 74 | * find the OPimRecord uid |
75 | */ | 75 | */ |
76 | virtual T find( int uid )const; | 76 | virtual T find( int uid )const; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * read ahead cache find method ;) | 79 | * read ahead cache find method ;) |
80 | */ | 80 | */ |
81 | virtual T find( int uid, const QArray<int>&, | 81 | virtual T find( int uid, const QArray<int>&, |
82 | uint current, CacheDirection dir = Forward )const; | 82 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; |
83 | 83 | ||
84 | /* invalidate cache here */ | 84 | /* invalidate cache here */ |
85 | /** | 85 | /** |
86 | * clears the backend and invalidates the backend | 86 | * clears the backend and invalidates the backend |
87 | */ | 87 | */ |
88 | virtual void clear() ; | 88 | virtual void clear() ; |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * add T to the backend | 91 | * add T to the backend |
92 | * @param t The item to add. | 92 | * @param t The item to add. |
93 | * @return <i>true</i> if added successfully. | 93 | * @return <i>true</i> if added successfully. |
94 | */ | 94 | */ |
95 | virtual bool add( const T& t ) ; | 95 | virtual bool add( const T& t ) ; |
96 | 96 | ||
97 | /* only the uid matters */ | 97 | /* only the uid matters */ |
98 | /** | 98 | /** |
99 | * remove T from the backend | 99 | * remove T from the backend |
100 | * @param t The item to remove | 100 | * @param t The item to remove |
101 | * @return <i>true</i> if successful. | 101 | * @return <i>true</i> if successful. |
102 | */ | 102 | */ |
103 | virtual bool remove( const T& t ); | 103 | virtual bool remove( const T& t ); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * remove the OPimRecord with uid | 106 | * remove the OPimRecord with uid |
107 | * @param uid The ID of the item to remove | 107 | * @param uid The ID of the item to remove |
108 | * @return <i>true</i> if successful. | 108 | * @return <i>true</i> if successful. |
109 | */ | 109 | */ |
110 | virtual bool remove( int uid ); | 110 | virtual bool remove( int uid ); |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * replace T from backend | 113 | * replace T from backend |
114 | * @param t The item to replace | 114 | * @param t The item to replace |
115 | * @return <i>true</i> if successful. | 115 | * @return <i>true</i> if successful. |
116 | */ | 116 | */ |
117 | virtual bool replace( const T& t) ; | 117 | virtual bool replace( const T& t) ; |
118 | 118 | ||
119 | void setReadAhead( uint count ); | 119 | void setReadAhead( uint count ); |
120 | /** | 120 | /** |
121 | * @internal | 121 | * @internal |
122 | */ | 122 | */ |
123 | void cache( const T& )const; | 123 | void cache( const T& )const; |
124 | void setSaneCacheSize( int ); | 124 | void setSaneCacheSize( int ); |
125 | protected: | 125 | protected: |
126 | /** | 126 | /** |
127 | * invalidate the cache | 127 | * invalidate the cache |
128 | */ | 128 | */ |
129 | void invalidateCache(); | 129 | void invalidateCache(); |
130 | 130 | ||
131 | void setBackEnd( BackEnd* end ); | 131 | void setBackEnd( BackEnd* end ); |
132 | /** | 132 | /** |
133 | * returns the backend | 133 | * returns the backend |
134 | */ | 134 | */ |
135 | BackEnd* backEnd(); | 135 | BackEnd* backEnd(); |
136 | BackEnd* m_backEnd; | 136 | BackEnd* m_backEnd; |
137 | Cache m_cache; | 137 | Cache m_cache; |
138 | 138 | ||
139 | }; | 139 | }; |
140 | 140 | ||
141 | template <class T> | 141 | template <class T> |
142 | OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) | 142 | OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) |
143 | : OTemplateBase<T>(), m_backEnd( end ) | 143 | : OTemplateBase<T>(), m_backEnd( end ) |
144 | { | 144 | { |
145 | if (end ) | 145 | if (end ) |
146 | end->setFrontend( this ); | 146 | end->setFrontend( this ); |
147 | } | 147 | } |
148 | template <class T> | 148 | template <class T> |
149 | OPimAccessTemplate<T>::~OPimAccessTemplate() { | 149 | OPimAccessTemplate<T>::~OPimAccessTemplate() { |
150 | qWarning("~OPimAccessTemplate<T>"); | 150 | qWarning("~OPimAccessTemplate<T>"); |
151 | delete m_backEnd; | 151 | delete m_backEnd; |
152 | } | 152 | } |
153 | template <class T> | 153 | template <class T> |
154 | bool OPimAccessTemplate<T>::load() { | 154 | bool OPimAccessTemplate<T>::load() { |
155 | invalidateCache(); | 155 | invalidateCache(); |
156 | return m_backEnd->load(); | 156 | return m_backEnd->load(); |
157 | } | 157 | } |
158 | template <class T> | 158 | template <class T> |
159 | bool OPimAccessTemplate<T>::reload() { | 159 | bool OPimAccessTemplate<T>::reload() { |
160 | invalidateCache(); // zecke: I think this should be added (se) | 160 | invalidateCache(); // zecke: I think this should be added (se) |
161 | return m_backEnd->reload(); | 161 | return m_backEnd->reload(); |
162 | } | 162 | } |
163 | template <class T> | 163 | template <class T> |
164 | bool OPimAccessTemplate<T>::save() { | 164 | bool OPimAccessTemplate<T>::save() { |
165 | return m_backEnd->save(); | 165 | return m_backEnd->save(); |
166 | } | 166 | } |
167 | template <class T> | 167 | template <class T> |
168 | OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { | 168 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { |
169 | QArray<int> ints = m_backEnd->allRecords(); | 169 | QArray<int> ints = m_backEnd->allRecords(); |
170 | List lis(ints, this ); | 170 | List lis(ints, this ); |
171 | return lis; | 171 | return lis; |
172 | } | 172 | } |
173 | template <class T> | 173 | template <class T> |
174 | OPimAccessTemplate<T>::List | 174 | typename OPimAccessTemplate<T>::List |
175 | OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) { | 175 | OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) { |
176 | QArray<int> ints = m_backEnd->queryByExample( t, sortOrder ); | 176 | QArray<int> ints = m_backEnd->queryByExample( t, sortOrder ); |
177 | 177 | ||
178 | List lis(ints, this ); | 178 | List lis(ints, this ); |
179 | return lis; | 179 | return lis; |
180 | } | 180 | } |
181 | template <class T> | 181 | template <class T> |
182 | T OPimAccessTemplate<T>::find( int uid ) const{ | 182 | T OPimAccessTemplate<T>::find( int uid ) const{ |
183 | T t = m_backEnd->find( uid ); | 183 | T t = m_backEnd->find( uid ); |
184 | cache( t ); | 184 | cache( t ); |
185 | return t; | 185 | return t; |
186 | } | 186 | } |
187 | template <class T> | 187 | template <class T> |
188 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, | 188 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, |
189 | uint current, CacheDirection dir )const { | 189 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { |
190 | /* | 190 | /* |
191 | * better do T.isEmpty() | 191 | * better do T.isEmpty() |
192 | * after a find this way we would | 192 | * after a find this way we would |
193 | * avoid two finds in QCache... | 193 | * avoid two finds in QCache... |
194 | */ | 194 | */ |
195 | // qWarning("find it now %d", uid ); | 195 | // qWarning("find it now %d", uid ); |
196 | if (m_cache.contains( uid ) ) { | 196 | if (m_cache.contains( uid ) ) { |
197 | return m_cache.find( uid ); | 197 | return m_cache.find( uid ); |
198 | } | 198 | } |
199 | 199 | ||
200 | T t = m_backEnd->find( uid, ar, current, dir ); | 200 | T t = m_backEnd->find( uid, ar, current, dir ); |
201 | cache( t ); | 201 | cache( t ); |
202 | return t; | 202 | return t; |
203 | } | 203 | } |
204 | template <class T> | 204 | template <class T> |
205 | void OPimAccessTemplate<T>::clear() { | 205 | void OPimAccessTemplate<T>::clear() { |
206 | invalidateCache(); | 206 | invalidateCache(); |
207 | m_backEnd->clear(); | 207 | m_backEnd->clear(); |
208 | } | 208 | } |
209 | template <class T> | 209 | template <class T> |
210 | bool OPimAccessTemplate<T>::add( const T& t ) { | 210 | bool OPimAccessTemplate<T>::add( const T& t ) { |
211 | cache( t ); | 211 | cache( t ); |
212 | return m_backEnd->add( t ); | 212 | return m_backEnd->add( t ); |
213 | } | 213 | } |
214 | template <class T> | 214 | template <class T> |
215 | bool OPimAccessTemplate<T>::remove( const T& t ) { | 215 | bool OPimAccessTemplate<T>::remove( const T& t ) { |
216 | return remove( t.uid() ); | 216 | return remove( t.uid() ); |
217 | } | 217 | } |
218 | template <class T> | 218 | template <class T> |
219 | bool OPimAccessTemplate<T>::remove( int uid ) { | 219 | bool OPimAccessTemplate<T>::remove( int uid ) { |
220 | m_cache.remove( uid ); | 220 | m_cache.remove( uid ); |
221 | return m_backEnd->remove( uid ); | 221 | return m_backEnd->remove( uid ); |
222 | } | 222 | } |
223 | template <class T> | 223 | template <class T> |
224 | bool OPimAccessTemplate<T>::replace( const T& t ) { | 224 | bool OPimAccessTemplate<T>::replace( const T& t ) { |
225 | m_cache.replace( t ); | 225 | m_cache.replace( t ); |
226 | return m_backEnd->replace( t ); | 226 | return m_backEnd->replace( t ); |
227 | } | 227 | } |
228 | template <class T> | 228 | template <class T> |
229 | void OPimAccessTemplate<T>::invalidateCache() { | 229 | void OPimAccessTemplate<T>::invalidateCache() { |
230 | m_cache.invalidate(); | 230 | m_cache.invalidate(); |
231 | } | 231 | } |
232 | template <class T> | 232 | template <class T> |
233 | OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { | 233 | typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { |
234 | return m_backEnd; | 234 | return m_backEnd; |
235 | } | 235 | } |
236 | template <class T> | 236 | template <class T> |
237 | bool OPimAccessTemplate<T>::wasChangedExternally()const { | 237 | bool OPimAccessTemplate<T>::wasChangedExternally()const { |
238 | return false; | 238 | return false; |
239 | } | 239 | } |
240 | template <class T> | 240 | template <class T> |
241 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { | 241 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { |
242 | m_backEnd = end; | 242 | m_backEnd = end; |
243 | if (m_backEnd ) | 243 | if (m_backEnd ) |
244 | m_backEnd->setFrontend( this ); | 244 | m_backEnd->setFrontend( this ); |
245 | } | 245 | } |
246 | template <class T> | 246 | template <class T> |
247 | void OPimAccessTemplate<T>::cache( const T& t ) const{ | 247 | void OPimAccessTemplate<T>::cache( const T& t ) const{ |
248 | /* hacky we need to work around the const*/ | 248 | /* hacky we need to work around the const*/ |
249 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); | 249 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); |
250 | } | 250 | } |
251 | template <class T> | 251 | template <class T> |
252 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { | 252 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { |
253 | m_cache.setSize( size ); | 253 | m_cache.setSize( size ); |
254 | } | 254 | } |
255 | template <class T> | 255 | template <class T> |
256 | void OPimAccessTemplate<T>::setReadAhead( uint count ) { | 256 | void OPimAccessTemplate<T>::setReadAhead( uint count ) { |
257 | m_backEnd->setReadAhead( count ); | 257 | m_backEnd->setReadAhead( count ); |
258 | } | 258 | } |
259 | #endif | 259 | #endif |
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h index 8ed41e2..b77a4ab 100644 --- a/libopie/pim/orecordlist.h +++ b/libopie/pim/orecordlist.h | |||
@@ -1,300 +1,300 @@ | |||
1 | 1 | ||
2 | #ifndef OPIE_RECORD_LIST_H | 2 | #ifndef OPIE_RECORD_LIST_H |
3 | #define OPIE_RECORD_LIST_H | 3 | #define OPIE_RECORD_LIST_H |
4 | 4 | ||
5 | #include <qarray.h> | 5 | #include <qarray.h> |
6 | 6 | ||
7 | #include "otemplatebase.h" | 7 | #include "otemplatebase.h" |
8 | #include "opimrecord.h" | 8 | #include "opimrecord.h" |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Our List Iterator | 11 | * Our List Iterator |
12 | * it behaves like STL or Qt | 12 | * it behaves like STL or Qt |
13 | * | 13 | * |
14 | * for(it = list.begin(); it != list.end(); ++it ) | 14 | * for(it = list.begin(); it != list.end(); ++it ) |
15 | * doSomeCoolStuff( (*it) ); | 15 | * doSomeCoolStuff( (*it) ); |
16 | */ | 16 | */ |
17 | template <class T> class ORecordList; | 17 | template <class T> class ORecordList; |
18 | template <class T = OPimRecord> | 18 | template <class T = OPimRecord> |
19 | class ORecordListIterator { | 19 | class ORecordListIterator { |
20 | friend class ORecordList<T>; | 20 | friend class ORecordList<T>; |
21 | public: | 21 | public: |
22 | typedef OTemplateBase<T> Base; | 22 | typedef OTemplateBase<T> Base; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * The c'tor used internally from | 25 | * The c'tor used internally from |
26 | * ORecordList | 26 | * ORecordList |
27 | */ | 27 | */ |
28 | ORecordListIterator( const QArray<int>, const Base* ); | 28 | ORecordListIterator( const QArray<int>, const Base* ); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * The standard c'tor | 31 | * The standard c'tor |
32 | */ | 32 | */ |
33 | ORecordListIterator(); | 33 | ORecordListIterator(); |
34 | ~ORecordListIterator(); | 34 | ~ORecordListIterator(); |
35 | 35 | ||
36 | ORecordListIterator( const ORecordListIterator& ); | 36 | ORecordListIterator( const ORecordListIterator& ); |
37 | ORecordListIterator &operator=(const ORecordListIterator& ); | 37 | ORecordListIterator &operator=(const ORecordListIterator& ); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * a * operator ;) | 40 | * a * operator ;) |
41 | * use it like this T = (*it); | 41 | * use it like this T = (*it); |
42 | */ | 42 | */ |
43 | T operator*(); | 43 | T operator*(); |
44 | ORecordListIterator &operator++(); | 44 | ORecordListIterator &operator++(); |
45 | ORecordListIterator &operator--(); | 45 | ORecordListIterator &operator--(); |
46 | 46 | ||
47 | bool operator==( const ORecordListIterator& it ); | 47 | bool operator==( const ORecordListIterator& it ); |
48 | bool operator!=( const ORecordListIterator& it ); | 48 | bool operator!=( const ORecordListIterator& it ); |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * the current item | 51 | * the current item |
52 | */ | 52 | */ |
53 | uint current()const; | 53 | uint current()const; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * the number of items | 56 | * the number of items |
57 | */ | 57 | */ |
58 | uint count()const; | 58 | uint count()const; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * sets the current item | 61 | * sets the current item |
62 | */ | 62 | */ |
63 | void setCurrent( uint cur ); | 63 | void setCurrent( uint cur ); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | QArray<int> m_uids; | 66 | QArray<int> m_uids; |
67 | uint m_current; | 67 | uint m_current; |
68 | const Base* m_temp; | 68 | const Base* m_temp; |
69 | bool m_end : 1; | 69 | bool m_end : 1; |
70 | T m_record; | 70 | T m_record; |
71 | bool m_direction :1; | 71 | bool m_direction :1; |
72 | 72 | ||
73 | /* d pointer for future versions */ | 73 | /* d pointer for future versions */ |
74 | class IteratorPrivate; | 74 | class IteratorPrivate; |
75 | IteratorPrivate *d; | 75 | IteratorPrivate *d; |
76 | }; | 76 | }; |
77 | /** | 77 | /** |
78 | * The recordlist used as a return type | 78 | * The recordlist used as a return type |
79 | * from OPimAccessTemplate | 79 | * from OPimAccessTemplate |
80 | */ | 80 | */ |
81 | template <class T = OPimRecord > | 81 | template <class T = OPimRecord > |
82 | class ORecordList { | 82 | class ORecordList { |
83 | public: | 83 | public: |
84 | typedef OTemplateBase<T> Base; | 84 | typedef OTemplateBase<T> Base; |
85 | typedef ORecordListIterator<T> Iterator; | 85 | typedef ORecordListIterator<T> Iterator; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * c'tor | 88 | * c'tor |
89 | */ | 89 | */ |
90 | ORecordList () { | 90 | ORecordList () { |
91 | } | 91 | } |
92 | ORecordList( const QArray<int>& ids, | 92 | ORecordList( const QArray<int>& ids, |
93 | const Base* ); | 93 | const Base* ); |
94 | ~ORecordList(); | 94 | ~ORecordList(); |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * the first iterator | 97 | * the first iterator |
98 | */ | 98 | */ |
99 | Iterator begin(); | 99 | Iterator begin(); |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * the end | 102 | * the end |
103 | */ | 103 | */ |
104 | Iterator end(); | 104 | Iterator end(); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * the number of items in the list | 107 | * the number of items in the list |
108 | */ | 108 | */ |
109 | uint count()const; | 109 | uint count()const; |
110 | 110 | ||
111 | T operator[]( uint i ); | 111 | T operator[]( uint i ); |
112 | int uidAt(uint i ); | 112 | int uidAt(uint i ); |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Remove the contact with given uid | 115 | * Remove the contact with given uid |
116 | */ | 116 | */ |
117 | bool remove( int uid ); | 117 | bool remove( int uid ); |
118 | 118 | ||
119 | /* | 119 | /* |
120 | ConstIterator begin()const; | 120 | ConstIterator begin()const; |
121 | ConstIterator end()const; | 121 | ConstIterator end()const; |
122 | */ | 122 | */ |
123 | private: | 123 | private: |
124 | QArray<int> m_ids; | 124 | QArray<int> m_ids; |
125 | const Base* m_acc; | 125 | const Base* m_acc; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | /* ok now implement it */ | 128 | /* ok now implement it */ |
129 | template <class T> | 129 | template <class T> |
130 | ORecordListIterator<T>::ORecordListIterator() { | 130 | ORecordListIterator<T>::ORecordListIterator() { |
131 | m_current = 0; | 131 | m_current = 0; |
132 | m_temp = 0l; | 132 | m_temp = 0l; |
133 | m_end = true; | 133 | m_end = true; |
134 | m_record = T(); | 134 | m_record = T(); |
135 | /* forward */ | 135 | /* forward */ |
136 | m_direction = TRUE; | 136 | m_direction = TRUE; |
137 | } | 137 | } |
138 | template <class T> | 138 | template <class T> |
139 | ORecordListIterator<T>::~ORecordListIterator() { | 139 | ORecordListIterator<T>::~ORecordListIterator() { |
140 | /* nothing to delete */ | 140 | /* nothing to delete */ |
141 | } | 141 | } |
142 | 142 | ||
143 | template <class T> | 143 | template <class T> |
144 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { | 144 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { |
145 | // qWarning("ORecordListIterator copy c'tor"); | 145 | // qWarning("ORecordListIterator copy c'tor"); |
146 | m_uids = it.m_uids; | 146 | m_uids = it.m_uids; |
147 | m_current = it.m_current; | 147 | m_current = it.m_current; |
148 | m_temp = it.m_temp; | 148 | m_temp = it.m_temp; |
149 | m_end = it.m_end; | 149 | m_end = it.m_end; |
150 | m_record = it.m_record; | 150 | m_record = it.m_record; |
151 | m_direction = it.m_direction; | 151 | m_direction = it.m_direction; |
152 | } | 152 | } |
153 | 153 | ||
154 | template <class T> | 154 | template <class T> |
155 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { | 155 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { |
156 | m_uids = it.m_uids; | 156 | m_uids = it.m_uids; |
157 | m_current = it.m_current; | 157 | m_current = it.m_current; |
158 | m_temp = it.m_temp; | 158 | m_temp = it.m_temp; |
159 | m_end = it.m_end; | 159 | m_end = it.m_end; |
160 | m_record = it.m_record; | 160 | m_record = it.m_record; |
161 | 161 | ||
162 | return *this; | 162 | return *this; |
163 | } | 163 | } |
164 | 164 | ||
165 | template <class T> | 165 | template <class T> |
166 | T ORecordListIterator<T>::operator*() { | 166 | T ORecordListIterator<T>::operator*() { |
167 | //qWarning("operator* %d %d", m_current, m_uids[m_current] ); | 167 | //qWarning("operator* %d %d", m_current, m_uids[m_current] ); |
168 | if (!m_end ) | 168 | if (!m_end ) |
169 | m_record = m_temp->find( m_uids[m_current], m_uids, m_current, | 169 | m_record = m_temp->find( m_uids[m_current], m_uids, m_current, |
170 | m_direction ? Base::Forward : | 170 | m_direction ? Base::Forward : |
171 | Base::Reverse ); | 171 | Base::Reverse ); |
172 | else | 172 | else |
173 | m_record = T(); | 173 | m_record = T(); |
174 | 174 | ||
175 | return m_record; | 175 | return m_record; |
176 | } | 176 | } |
177 | 177 | ||
178 | template <class T> | 178 | template <class T> |
179 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | 179 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { |
180 | m_direction = true; | 180 | m_direction = true; |
181 | if (m_current < m_uids.count() ) { | 181 | if (m_current < m_uids.count() ) { |
182 | m_end = false; | 182 | m_end = false; |
183 | ++m_current; | 183 | ++m_current; |
184 | }else | 184 | }else |
185 | m_end = true; | 185 | m_end = true; |
186 | 186 | ||
187 | return *this; | 187 | return *this; |
188 | } | 188 | } |
189 | template <class T> | 189 | template <class T> |
190 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { | 190 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { |
191 | m_direction = false; | 191 | m_direction = false; |
192 | if ( m_current > 0 ) { | 192 | if ( m_current > 0 ) { |
193 | --m_current; | 193 | --m_current; |
194 | m_end = false; | 194 | m_end = false; |
195 | } else | 195 | } else |
196 | m_end = true; | 196 | m_end = true; |
197 | 197 | ||
198 | return *this; | 198 | return *this; |
199 | } | 199 | } |
200 | 200 | ||
201 | template <class T> | 201 | template <class T> |
202 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { | 202 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { |
203 | 203 | ||
204 | /* if both are at we're the same.... */ | 204 | /* if both are at we're the same.... */ |
205 | if ( m_end == it.m_end ) return true; | 205 | if ( m_end == it.m_end ) return true; |
206 | 206 | ||
207 | if ( m_uids != it.m_uids ) return false; | 207 | if ( m_uids != it.m_uids ) return false; |
208 | if ( m_current != it.m_current ) return false; | 208 | if ( m_current != it.m_current ) return false; |
209 | if ( m_temp != it.m_temp ) return false; | 209 | if ( m_temp != it.m_temp ) return false; |
210 | 210 | ||
211 | return true; | 211 | return true; |
212 | } | 212 | } |
213 | template <class T> | 213 | template <class T> |
214 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { | 214 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { |
215 | return !(*this == it ); | 215 | return !(*this == it ); |
216 | } | 216 | } |
217 | template <class T> | 217 | template <class T> |
218 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | 218 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, |
219 | const Base* t ) | 219 | const Base* t ) |
220 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), | 220 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), |
221 | m_direction( false ) | 221 | m_direction( false ) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | template <class T> | 224 | template <class T> |
225 | uint ORecordListIterator<T>::current()const { | 225 | uint ORecordListIterator<T>::current()const { |
226 | return m_current; | 226 | return m_current; |
227 | } | 227 | } |
228 | template <class T> | 228 | template <class T> |
229 | void ORecordListIterator<T>::setCurrent( uint cur ) { | 229 | void ORecordListIterator<T>::setCurrent( uint cur ) { |
230 | if( cur < m_uids.count() ) { | 230 | if( cur < m_uids.count() ) { |
231 | m_end = false; | 231 | m_end = false; |
232 | m_current= cur; | 232 | m_current= cur; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | template <class T> | 235 | template <class T> |
236 | uint ORecordListIterator<T>::count()const { | 236 | uint ORecordListIterator<T>::count()const { |
237 | return m_uids.count(); | 237 | return m_uids.count(); |
238 | } | 238 | } |
239 | template <class T> | 239 | template <class T> |
240 | ORecordList<T>::ORecordList( const QArray<int>& ids, | 240 | ORecordList<T>::ORecordList( const QArray<int>& ids, |
241 | const Base* acc ) | 241 | const Base* acc ) |
242 | : m_ids( ids ), m_acc( acc ) | 242 | : m_ids( ids ), m_acc( acc ) |
243 | { | 243 | { |
244 | } | 244 | } |
245 | template <class T> | 245 | template <class T> |
246 | ORecordList<T>::~ORecordList() { | 246 | ORecordList<T>::~ORecordList() { |
247 | /* nothing to do here */ | 247 | /* nothing to do here */ |
248 | } | 248 | } |
249 | template <class T> | 249 | template <class T> |
250 | ORecordList<T>::Iterator ORecordList<T>::begin() { | 250 | typename ORecordList<T>::Iterator ORecordList<T>::begin() { |
251 | Iterator it( m_ids, m_acc ); | 251 | Iterator it( m_ids, m_acc ); |
252 | return it; | 252 | return it; |
253 | } | 253 | } |
254 | template <class T> | 254 | template <class T> |
255 | ORecordList<T>::Iterator ORecordList<T>::end() { | 255 | typename ORecordList<T>::Iterator ORecordList<T>::end() { |
256 | Iterator it( m_ids, m_acc ); | 256 | Iterator it( m_ids, m_acc ); |
257 | it.m_end = true; | 257 | it.m_end = true; |
258 | it.m_current = m_ids.count(); | 258 | it.m_current = m_ids.count(); |
259 | 259 | ||
260 | return it; | 260 | return it; |
261 | } | 261 | } |
262 | template <class T> | 262 | template <class T> |
263 | uint ORecordList<T>::count()const { | 263 | uint ORecordList<T>::count()const { |
264 | return m_ids.count(); | 264 | return m_ids.count(); |
265 | } | 265 | } |
266 | template <class T> | 266 | template <class T> |
267 | T ORecordList<T>::operator[]( uint i ) { | 267 | T ORecordList<T>::operator[]( uint i ) { |
268 | if ( i < 0 || (i+1) > m_ids.count() ) | 268 | if ( i < 0 || (i+1) > m_ids.count() ) |
269 | return T(); | 269 | return T(); |
270 | /* forward */ | 270 | /* forward */ |
271 | return m_acc->find( m_ids[i], m_ids, i ); | 271 | return m_acc->find( m_ids[i], m_ids, i ); |
272 | } | 272 | } |
273 | template <class T> | 273 | template <class T> |
274 | int ORecordList<T>::uidAt( uint i ) { | 274 | int ORecordList<T>::uidAt( uint i ) { |
275 | return m_ids[i]; | 275 | return m_ids[i]; |
276 | } | 276 | } |
277 | 277 | ||
278 | template <class T> | 278 | template <class T> |
279 | bool ORecordList<T>::remove( int uid ) { | 279 | bool ORecordList<T>::remove( int uid ) { |
280 | QArray<int> copy( m_ids.count() ); | 280 | QArray<int> copy( m_ids.count() ); |
281 | int counter = 0; | 281 | int counter = 0; |
282 | bool ret_val = false; | 282 | bool ret_val = false; |
283 | 283 | ||
284 | for (uint i = 0; i < m_ids.count(); i++){ | 284 | for (uint i = 0; i < m_ids.count(); i++){ |
285 | if ( m_ids[i] != uid ){ | 285 | if ( m_ids[i] != uid ){ |
286 | copy[counter++] = m_ids[i]; | 286 | copy[counter++] = m_ids[i]; |
287 | 287 | ||
288 | }else | 288 | }else |
289 | ret_val = true; | 289 | ret_val = true; |
290 | } | 290 | } |
291 | 291 | ||
292 | copy.resize( counter ); | 292 | copy.resize( counter ); |
293 | m_ids = copy; | 293 | m_ids = copy; |
294 | 294 | ||
295 | 295 | ||
296 | return ret_val; | 296 | return ret_val; |
297 | } | 297 | } |
298 | 298 | ||
299 | 299 | ||
300 | #endif | 300 | #endif |
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 0d5b1d3..4d5cb79 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -18,388 +18,388 @@ | |||
18 | 18 | ||
19 | 19 | ||
20 | struct OTodo::OTodoData : public QShared { | 20 | struct OTodo::OTodoData : public QShared { |
21 | OTodoData() : QShared() { | 21 | OTodoData() : QShared() { |
22 | }; | 22 | }; |
23 | 23 | ||
24 | QDate date; | 24 | QDate date; |
25 | bool isCompleted:1; | 25 | bool isCompleted:1; |
26 | bool hasDate:1; | 26 | bool hasDate:1; |
27 | int priority; | 27 | int priority; |
28 | QString desc; | 28 | QString desc; |
29 | QString sum; | 29 | QString sum; |
30 | QMap<QString, QString> extra; | 30 | QMap<QString, QString> extra; |
31 | ushort prog; | 31 | ushort prog; |
32 | bool hasAlarmDateTime :1; | 32 | bool hasAlarmDateTime :1; |
33 | QDateTime alarmDateTime; | 33 | QDateTime alarmDateTime; |
34 | OPimState state; | 34 | OPimState state; |
35 | ORecur recur; | 35 | ORecur recur; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | OTodo::OTodo(const OTodo &event ) | 38 | OTodo::OTodo(const OTodo &event ) |
39 | : OPimRecord( event ), data( event.data ) | 39 | : OPimRecord( event ), data( event.data ) |
40 | { | 40 | { |
41 | data->ref(); | 41 | data->ref(); |
42 | // qWarning("ref up"); | 42 | // qWarning("ref up"); |
43 | } | 43 | } |
44 | OTodo::~OTodo() { | 44 | OTodo::~OTodo() { |
45 | 45 | ||
46 | // qWarning("~OTodo " ); | 46 | // qWarning("~OTodo " ); |
47 | if ( data->deref() ) { | 47 | if ( data->deref() ) { |
48 | // qWarning("OTodo::dereffing"); | 48 | // qWarning("OTodo::dereffing"); |
49 | delete data; | 49 | delete data; |
50 | data = 0l; | 50 | data = 0l; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | OTodo::OTodo(bool completed, int priority, | 53 | OTodo::OTodo(bool completed, int priority, |
54 | const QArray<int> &category, | 54 | const QArray<int> &category, |
55 | const QString& summary, | 55 | const QString& summary, |
56 | const QString &description, | 56 | const QString &description, |
57 | ushort progress, | 57 | ushort progress, |
58 | bool hasDate, QDate date, int uid ) | 58 | bool hasDate, QDate date, int uid ) |
59 | : OPimRecord( uid ) | 59 | : OPimRecord( uid ) |
60 | { | 60 | { |
61 | // qWarning("OTodoData " + summary); | 61 | // qWarning("OTodoData " + summary); |
62 | setCategories( category ); | 62 | setCategories( category ); |
63 | 63 | ||
64 | data = new OTodoData; | 64 | data = new OTodoData; |
65 | 65 | ||
66 | data->date = date; | 66 | data->date = date; |
67 | data->isCompleted = completed; | 67 | data->isCompleted = completed; |
68 | data->hasDate = hasDate; | 68 | data->hasDate = hasDate; |
69 | data->priority = priority; | 69 | data->priority = priority; |
70 | data->sum = summary; | 70 | data->sum = summary; |
71 | data->prog = progress; | 71 | data->prog = progress; |
72 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 72 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
73 | data->hasAlarmDateTime = false; | 73 | data->hasAlarmDateTime = false; |
74 | 74 | ||
75 | } | 75 | } |
76 | OTodo::OTodo(bool completed, int priority, | 76 | OTodo::OTodo(bool completed, int priority, |
77 | const QStringList &category, | 77 | const QStringList &category, |
78 | const QString& summary, | 78 | const QString& summary, |
79 | const QString &description, | 79 | const QString &description, |
80 | ushort progress, | 80 | ushort progress, |
81 | bool hasDate, QDate date, int uid ) | 81 | bool hasDate, QDate date, int uid ) |
82 | : OPimRecord( uid ) | 82 | : OPimRecord( uid ) |
83 | { | 83 | { |
84 | // qWarning("OTodoData" + summary); | 84 | // qWarning("OTodoData" + summary); |
85 | setCategories( idsFromString( category.join(";") ) ); | 85 | setCategories( idsFromString( category.join(";") ) ); |
86 | 86 | ||
87 | data = new OTodoData; | 87 | data = new OTodoData; |
88 | 88 | ||
89 | data->date = date; | 89 | data->date = date; |
90 | data->isCompleted = completed; | 90 | data->isCompleted = completed; |
91 | data->hasDate = hasDate; | 91 | data->hasDate = hasDate; |
92 | data->priority = priority; | 92 | data->priority = priority; |
93 | data->sum = summary; | 93 | data->sum = summary; |
94 | data->prog = progress; | 94 | data->prog = progress; |
95 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 95 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
96 | data->hasAlarmDateTime = false; | 96 | data->hasAlarmDateTime = false; |
97 | 97 | ||
98 | } | 98 | } |
99 | bool OTodo::match( const QRegExp ®Exp )const | 99 | bool OTodo::match( const QRegExp ®Exp )const |
100 | { | 100 | { |
101 | if( QString::number( data->priority ).find( regExp ) != -1 ){ | 101 | if( QString::number( data->priority ).find( regExp ) != -1 ){ |
102 | return true; | 102 | return true; |
103 | }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ | 103 | }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ |
104 | return true; | 104 | return true; |
105 | }else if(data->desc.find( regExp ) != -1 ){ | 105 | }else if(data->desc.find( regExp ) != -1 ){ |
106 | return true; | 106 | return true; |
107 | }else if(data->sum.find( regExp ) != -1 ) { | 107 | }else if(data->sum.find( regExp ) != -1 ) { |
108 | return true; | 108 | return true; |
109 | } | 109 | } |
110 | return false; | 110 | return false; |
111 | } | 111 | } |
112 | bool OTodo::isCompleted() const | 112 | bool OTodo::isCompleted() const |
113 | { | 113 | { |
114 | return data->isCompleted; | 114 | return data->isCompleted; |
115 | } | 115 | } |
116 | bool OTodo::hasDueDate() const | 116 | bool OTodo::hasDueDate() const |
117 | { | 117 | { |
118 | return data->hasDate; | 118 | return data->hasDate; |
119 | } | 119 | } |
120 | bool OTodo::hasAlarmDateTime() const | 120 | bool OTodo::hasAlarmDateTime() const |
121 | { | 121 | { |
122 | return data->hasAlarmDateTime; | 122 | return data->hasAlarmDateTime; |
123 | } | 123 | } |
124 | int OTodo::priority()const | 124 | int OTodo::priority()const |
125 | { | 125 | { |
126 | return data->priority; | 126 | return data->priority; |
127 | } | 127 | } |
128 | QString OTodo::summary() const | 128 | QString OTodo::summary() const |
129 | { | 129 | { |
130 | return data->sum; | 130 | return data->sum; |
131 | } | 131 | } |
132 | ushort OTodo::progress() const | 132 | ushort OTodo::progress() const |
133 | { | 133 | { |
134 | return data->prog; | 134 | return data->prog; |
135 | } | 135 | } |
136 | QDate OTodo::dueDate()const | 136 | QDate OTodo::dueDate()const |
137 | { | 137 | { |
138 | return data->date; | 138 | return data->date; |
139 | } | 139 | } |
140 | 140 | ||
141 | QDateTime OTodo::alarmDateTime() const | 141 | QDateTime OTodo::alarmDateTime() const |
142 | { | 142 | { |
143 | return data->alarmDateTime; | 143 | return data->alarmDateTime; |
144 | } | 144 | } |
145 | 145 | ||
146 | QString OTodo::description()const | 146 | QString OTodo::description()const |
147 | { | 147 | { |
148 | return data->desc; | 148 | return data->desc; |
149 | } | 149 | } |
150 | OPimState OTodo::state()const { | 150 | OPimState OTodo::state()const { |
151 | return data->state; | 151 | return data->state; |
152 | } | 152 | } |
153 | ORecur OTodo::recurrence()const { | 153 | ORecur OTodo::recurrence()const { |
154 | return data->recur; | 154 | return data->recur; |
155 | } | 155 | } |
156 | void OTodo::setCompleted( bool completed ) | 156 | void OTodo::setCompleted( bool completed ) |
157 | { | 157 | { |
158 | changeOrModify(); | 158 | changeOrModify(); |
159 | data->isCompleted = completed; | 159 | data->isCompleted = completed; |
160 | } | 160 | } |
161 | void OTodo::setHasDueDate( bool hasDate ) | 161 | void OTodo::setHasDueDate( bool hasDate ) |
162 | { | 162 | { |
163 | changeOrModify(); | 163 | changeOrModify(); |
164 | data->hasDate = hasDate; | 164 | data->hasDate = hasDate; |
165 | } | 165 | } |
166 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | 166 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) |
167 | { | 167 | { |
168 | changeOrModify(); | 168 | changeOrModify(); |
169 | data->hasAlarmDateTime = hasAlarmDateTime; | 169 | data->hasAlarmDateTime = hasAlarmDateTime; |
170 | } | 170 | } |
171 | void OTodo::setDescription(const QString &desc ) | 171 | void OTodo::setDescription(const QString &desc ) |
172 | { | 172 | { |
173 | // qWarning( "desc " + desc ); | 173 | // qWarning( "desc " + desc ); |
174 | changeOrModify(); | 174 | changeOrModify(); |
175 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 175 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
176 | } | 176 | } |
177 | void OTodo::setSummary( const QString& sum ) | 177 | void OTodo::setSummary( const QString& sum ) |
178 | { | 178 | { |
179 | changeOrModify(); | 179 | changeOrModify(); |
180 | data->sum = sum; | 180 | data->sum = sum; |
181 | } | 181 | } |
182 | void OTodo::setPriority(int prio ) | 182 | void OTodo::setPriority(int prio ) |
183 | { | 183 | { |
184 | changeOrModify(); | 184 | changeOrModify(); |
185 | data->priority = prio; | 185 | data->priority = prio; |
186 | } | 186 | } |
187 | void OTodo::setDueDate( QDate date ) | 187 | void OTodo::setDueDate( QDate date ) |
188 | { | 188 | { |
189 | changeOrModify(); | 189 | changeOrModify(); |
190 | data->date = date; | 190 | data->date = date; |
191 | } | 191 | } |
192 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) | 192 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) |
193 | { | 193 | { |
194 | changeOrModify(); | 194 | changeOrModify(); |
195 | data->alarmDateTime = alarm; | 195 | data->alarmDateTime = alarm; |
196 | } | 196 | } |
197 | void OTodo::setState( const OPimState& state ) { | 197 | void OTodo::setState( const OPimState& state ) { |
198 | changeOrModify(); | 198 | changeOrModify(); |
199 | data->state = state; | 199 | data->state = state; |
200 | } | 200 | } |
201 | void OTodo::setRecurrence( const ORecur& rec) { | 201 | void OTodo::setRecurrence( const ORecur& rec) { |
202 | changeOrModify(); | 202 | changeOrModify(); |
203 | data->recur = rec; | 203 | data->recur = rec; |
204 | } | 204 | } |
205 | bool OTodo::isOverdue( ) | 205 | bool OTodo::isOverdue( ) |
206 | { | 206 | { |
207 | if( data->hasDate && !data->isCompleted) | 207 | if( data->hasDate && !data->isCompleted) |
208 | return QDate::currentDate() > data->date; | 208 | return QDate::currentDate() > data->date; |
209 | return false; | 209 | return false; |
210 | } | 210 | } |
211 | void OTodo::setProgress(ushort progress ) | 211 | void OTodo::setProgress(ushort progress ) |
212 | { | 212 | { |
213 | changeOrModify(); | 213 | changeOrModify(); |
214 | data->prog = progress; | 214 | data->prog = progress; |
215 | } | 215 | } |
216 | QString OTodo::toShortText() const { | 216 | QString OTodo::toShortText() const { |
217 | return summary(); | 217 | return summary(); |
218 | } | 218 | } |
219 | /*! | 219 | /*! |
220 | Returns a richt text string | 220 | Returns a richt text string |
221 | */ | 221 | */ |
222 | QString OTodo::toRichText() const | 222 | QString OTodo::toRichText() const |
223 | { | 223 | { |
224 | QString text; | 224 | QString text; |
225 | QStringList catlist; | 225 | QStringList catlist; |
226 | 226 | ||
227 | // Description of the todo | 227 | // Description of the todo |
228 | if ( !summary().isEmpty() ) { | 228 | if ( !summary().isEmpty() ) { |
229 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; | 229 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; |
230 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 230 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
231 | } | 231 | } |
232 | if( !description().isEmpty() ){ | 232 | if( !description().isEmpty() ){ |
233 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 233 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
234 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; | 234 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; |
235 | } | 235 | } |
236 | text += "<br><br><br>"; | 236 | text += "<br><br><br>"; |
237 | 237 | ||
238 | text += "<b>" + QObject::tr( "Priority:") +" </b>" | 238 | text += "<b>" + QObject::tr( "Priority:") +" </b>" |
239 | + QString::number( priority() ) + " <br>"; | 239 | + QString::number( priority() ) + " <br>"; |
240 | text += "<b>" + QObject::tr( "Progress:") + " </b>" | 240 | text += "<b>" + QObject::tr( "Progress:") + " </b>" |
241 | + QString::number( progress() ) + " %<br>"; | 241 | + QString::number( progress() ) + " %<br>"; |
242 | if (hasDueDate() ){ | 242 | if (hasDueDate() ){ |
243 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; | 243 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; |
244 | text += dueDate().toString(); | 244 | text += dueDate().toString(); |
245 | text += "<br>"; | 245 | text += "<br>"; |
246 | } | 246 | } |
247 | if (hasAlarmDateTime() ){ | 247 | if (hasAlarmDateTime() ){ |
248 | text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; | 248 | text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; |
249 | text += alarmDateTime().toString(); | 249 | text += alarmDateTime().toString(); |
250 | text += "<br>"; | 250 | text += "<br>"; |
251 | } | 251 | } |
252 | 252 | ||
253 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 253 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
254 | text += categoryNames().join(", "); | 254 | text += categoryNames().join(", "); |
255 | text += "<br>"; | 255 | text += "<br>"; |
256 | 256 | ||
257 | return text; | 257 | return text; |
258 | } | 258 | } |
259 | 259 | ||
260 | bool OTodo::operator<( const OTodo &toDoEvent )const{ | 260 | bool OTodo::operator<( const OTodo &toDoEvent )const{ |
261 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 261 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
262 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 262 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
263 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 263 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
264 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 264 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
265 | return priority() < toDoEvent.priority(); | 265 | return priority() < toDoEvent.priority(); |
266 | }else{ | 266 | }else{ |
267 | return dueDate() < toDoEvent.dueDate(); | 267 | return dueDate() < toDoEvent.dueDate(); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | return false; | 270 | return false; |
271 | } | 271 | } |
272 | bool OTodo::operator<=(const OTodo &toDoEvent )const | 272 | bool OTodo::operator<=(const OTodo &toDoEvent )const |
273 | { | 273 | { |
274 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 274 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
275 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; | 275 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; |
276 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 276 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
277 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 277 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
278 | return priority() <= toDoEvent.priority(); | 278 | return priority() <= toDoEvent.priority(); |
279 | }else{ | 279 | }else{ |
280 | return dueDate() <= toDoEvent.dueDate(); | 280 | return dueDate() <= toDoEvent.dueDate(); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | return true; | 283 | return true; |
284 | } | 284 | } |
285 | bool OTodo::operator>(const OTodo &toDoEvent )const | 285 | bool OTodo::operator>(const OTodo &toDoEvent )const |
286 | { | 286 | { |
287 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; | 287 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; |
288 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 288 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
289 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 289 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
290 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 290 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
291 | return priority() > toDoEvent.priority(); | 291 | return priority() > toDoEvent.priority(); |
292 | }else{ | 292 | }else{ |
293 | return dueDate() > toDoEvent.dueDate(); | 293 | return dueDate() > toDoEvent.dueDate(); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | return false; | 296 | return false; |
297 | } | 297 | } |
298 | bool OTodo::operator>=(const OTodo &toDoEvent )const | 298 | bool OTodo::operator>=(const OTodo &toDoEvent )const |
299 | { | 299 | { |
300 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 300 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
301 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 301 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
302 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 302 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
303 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 303 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
304 | return priority() > toDoEvent.priority(); | 304 | return priority() > toDoEvent.priority(); |
305 | }else{ | 305 | }else{ |
306 | return dueDate() > toDoEvent.dueDate(); | 306 | return dueDate() > toDoEvent.dueDate(); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | return true; | 309 | return true; |
310 | } | 310 | } |
311 | bool OTodo::operator==(const OTodo &toDoEvent )const | 311 | bool OTodo::operator==(const OTodo &toDoEvent )const |
312 | { | 312 | { |
313 | if ( data->priority != toDoEvent.data->priority ) return false; | 313 | if ( data->priority != toDoEvent.data->priority ) return false; |
314 | if ( data->priority != toDoEvent.data->prog ) return false; | 314 | if ( data->priority != toDoEvent.data->prog ) return false; |
315 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 315 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
316 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 316 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
317 | if ( data->date != toDoEvent.data->date ) return false; | 317 | if ( data->date != toDoEvent.data->date ) return false; |
318 | if ( data->sum != toDoEvent.data->sum ) return false; | 318 | if ( data->sum != toDoEvent.data->sum ) return false; |
319 | if ( data->desc != toDoEvent.data->desc ) return false; | 319 | if ( data->desc != toDoEvent.data->desc ) return false; |
320 | if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) | 320 | if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) |
321 | return false; | 321 | return false; |
322 | if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) | 322 | if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) |
323 | return false; | 323 | return false; |
324 | 324 | ||
325 | return OPimRecord::operator==( toDoEvent ); | 325 | return OPimRecord::operator==( toDoEvent ); |
326 | } | 326 | } |
327 | void OTodo::deref() { | 327 | void OTodo::deref() { |
328 | 328 | ||
329 | // qWarning("deref in ToDoEvent"); | 329 | // qWarning("deref in ToDoEvent"); |
330 | if ( data->deref() ) { | 330 | if ( data->deref() ) { |
331 | // qWarning("deleting"); | 331 | // qWarning("deleting"); |
332 | delete data; | 332 | delete data; |
333 | data= 0; | 333 | data= 0; |
334 | } | 334 | } |
335 | } | 335 | } |
336 | OTodo &OTodo::operator=(const OTodo &item ) | 336 | OTodo &OTodo::operator=(const OTodo &item ) |
337 | { | 337 | { |
338 | OPimRecord::operator=( item ); | 338 | OPimRecord::operator=( item ); |
339 | //qWarning("operator= ref "); | 339 | //qWarning("operator= ref "); |
340 | item.data->ref(); | 340 | item.data->ref(); |
341 | deref(); | 341 | deref(); |
342 | data = item.data; | 342 | data = item.data; |
343 | 343 | ||
344 | return *this; | 344 | return *this; |
345 | } | 345 | } |
346 | 346 | ||
347 | QMap<int, QString> OTodo::toMap() const { | 347 | QMap<int, QString> OTodo::toMap() const { |
348 | QMap<int, QString> map; | 348 | QMap<int, QString> map; |
349 | 349 | ||
350 | map.insert( Uid, QString::number( uid() ) ); | 350 | map.insert( Uid, QString::number( uid() ) ); |
351 | map.insert( Category, idsToString( categories() ) ); | 351 | map.insert( Category, idsToString( categories() ) ); |
352 | map.insert( HasDate, QString::number( data->hasDate ) ); | 352 | map.insert( HasDate, QString::number( data->hasDate ) ); |
353 | map.insert( Completed, QString::number( data->isCompleted ) ); | 353 | map.insert( Completed, QString::number( data->isCompleted ) ); |
354 | map.insert( Description, data->desc ); | 354 | map.insert( Description, data->desc ); |
355 | map.insert( Summary, data->sum ); | 355 | map.insert( Summary, data->sum ); |
356 | map.insert( Priority, QString::number( data->priority ) ); | 356 | map.insert( Priority, QString::number( data->priority ) ); |
357 | map.insert( DateDay, QString::number( data->date.day() ) ); | 357 | map.insert( DateDay, QString::number( data->date.day() ) ); |
358 | map.insert( DateMonth, QString::number( data->date.month() ) ); | 358 | map.insert( DateMonth, QString::number( data->date.month() ) ); |
359 | map.insert( DateYear, QString::number( data->date.year() ) ); | 359 | map.insert( DateYear, QString::number( data->date.year() ) ); |
360 | map.insert( Progress, QString::number( data->prog ) ); | 360 | map.insert( Progress, QString::number( data->prog ) ); |
361 | map.insert( CrossReference, crossToString() ); | 361 | map.insert( CrossReference, crossToString() ); |
362 | map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); | 362 | map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); |
363 | map.insert( AlarmDateTime, data->alarmDateTime.toString() ); | 363 | map.insert( AlarmDateTime, data->alarmDateTime.toString() ); |
364 | 364 | ||
365 | return map; | 365 | return map; |
366 | } | 366 | } |
367 | 367 | ||
368 | QMap<QString, QString> OTodo::toExtraMap()const { | 368 | QMap<QString, QString> OTodo::toExtraMap()const { |
369 | return data->extra; | 369 | return data->extra; |
370 | } | 370 | } |
371 | /** | 371 | /** |
372 | * change or modify looks at the ref count and either | 372 | * change or modify looks at the ref count and either |
373 | * creates a new QShared Object or it can modify it | 373 | * creates a new QShared Object or it can modify it |
374 | * right in place | 374 | * right in place |
375 | */ | 375 | */ |
376 | void OTodo::changeOrModify() { | 376 | void OTodo::changeOrModify() { |
377 | if ( data->count != 1 ) { | 377 | if ( data->count != 1 ) { |
378 | qWarning("changeOrModify"); | 378 | qWarning("changeOrModify"); |
379 | data->deref(); | 379 | data->deref(); |
380 | OTodoData* d2 = new OTodoData(); | 380 | OTodoData* d2 = new OTodoData(); |
381 | copy(data, d2 ); | 381 | copy(data, d2 ); |
382 | data = d2; | 382 | data = d2; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { | 385 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { |
386 | dest->date = src->date; | 386 | dest->date = src->date; |
387 | dest->isCompleted = src->isCompleted; | 387 | dest->isCompleted = src->isCompleted; |
388 | dest->hasDate = src->hasDate; | 388 | dest->hasDate = src->hasDate; |
389 | dest->priority = src->priority; | 389 | dest->priority = src->priority; |
390 | dest->desc = src->desc; | 390 | dest->desc = src->desc; |
391 | dest->sum = src->sum; | 391 | dest->sum = src->sum; |
392 | dest->extra = src->extra; | 392 | dest->extra = src->extra; |
393 | dest->prog = src->prog; | 393 | dest->prog = src->prog; |
394 | dest->hasAlarmDateTime = src->hasAlarmDateTime; | 394 | dest->hasAlarmDateTime = src->hasAlarmDateTime; |
395 | dest->alarmDateTime = src->alarmDateTime; | 395 | dest->alarmDateTime = src->alarmDateTime; |
396 | dest->state = src->state; | 396 | dest->state = src->state; |
397 | dest->recur = src->recur; | 397 | dest->recur = src->recur; |
398 | } | 398 | } |
399 | QString OTodo::type() const { | 399 | QString OTodo::type() const { |
400 | return QString::fromLatin1("OTodo"); | 400 | return QString::fromLatin1("OTodo"); |
401 | } | 401 | } |
402 | QString OTodo::recordField(int id )const { | 402 | QString OTodo::recordField(int /*id*/ )const { |
403 | return QString::null; | 403 | return QString::null; |
404 | } | 404 | } |
405 | 405 | ||