author | zecke <zecke> | 2003-02-15 13:55:04 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-15 13:55:04 (UTC) |
commit | 4049351d6bd48c8e5866f3bc047f567dfe4b35d6 (patch) (unidiff) | |
tree | 738c8375b87976e6b905b42d404f78b6cc48966f /libopie | |
parent | b50692ba650418aa06cbd2662b4ff698c7d3f961 (diff) | |
download | opie-4049351d6bd48c8e5866f3bc047f567dfe4b35d6.zip opie-4049351d6bd48c8e5866f3bc047f567dfe4b35d6.tar.gz opie-4049351d6bd48c8e5866f3bc047f567dfe4b35d6.tar.bz2 |
clear before reloading
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp index 21f93a0..c3416cb 100644 --- a/libopie/pim/otodoaccessxml.cpp +++ b/libopie/pim/otodoaccessxml.cpp | |||
@@ -143,48 +143,49 @@ bool OTodoAccessXML::load() { | |||
143 | todo( &dict, ev, attr, str ); | 143 | todo( &dict, ev, attr, str ); |
144 | 144 | ||
145 | } | 145 | } |
146 | /* | 146 | /* |
147 | * now add it | 147 | * now add it |
148 | */ | 148 | */ |
149 | qWarning("End at %d", i ); | 149 | qWarning("End at %d", i ); |
150 | if (m_events.contains( ev.uid() ) || ev.uid() == 0) { | 150 | if (m_events.contains( ev.uid() ) || ev.uid() == 0) { |
151 | ev.setUid( 1 ); | 151 | ev.setUid( 1 ); |
152 | m_changed = true; | 152 | m_changed = true; |
153 | } | 153 | } |
154 | if ( ev.hasDueDate() ) { | 154 | if ( ev.hasDueDate() ) { |
155 | ev.setDueDate( QDate(m_year, m_month, m_day) ); | 155 | ev.setDueDate( QDate(m_year, m_month, m_day) ); |
156 | } | 156 | } |
157 | m_events.insert(ev.uid(), ev ); | 157 | m_events.insert(ev.uid(), ev ); |
158 | m_year = m_month = m_day = -1; | 158 | m_year = m_month = m_day = -1; |
159 | } | 159 | } |
160 | 160 | ||
161 | munmap(map_addr, attribut.st_size ); | 161 | munmap(map_addr, attribut.st_size ); |
162 | 162 | ||
163 | qWarning("counts %d records loaded!", m_events.count() ); | 163 | qWarning("counts %d records loaded!", m_events.count() ); |
164 | return true; | 164 | return true; |
165 | } | 165 | } |
166 | bool OTodoAccessXML::reload() { | 166 | bool OTodoAccessXML::reload() { |
167 | m_events.clear(); | ||
167 | return load(); | 168 | return load(); |
168 | } | 169 | } |
169 | bool OTodoAccessXML::save() { | 170 | bool OTodoAccessXML::save() { |
170 | // qWarning("saving"); | 171 | // qWarning("saving"); |
171 | if (!m_opened || !m_changed ) { | 172 | if (!m_opened || !m_changed ) { |
172 | // qWarning("not saving"); | 173 | // qWarning("not saving"); |
173 | return true; | 174 | return true; |
174 | } | 175 | } |
175 | QString strNewFile = m_file + ".new"; | 176 | QString strNewFile = m_file + ".new"; |
176 | QFile f( strNewFile ); | 177 | QFile f( strNewFile ); |
177 | if (!f.open( IO_WriteOnly|IO_Raw ) ) | 178 | if (!f.open( IO_WriteOnly|IO_Raw ) ) |
178 | return false; | 179 | return false; |
179 | 180 | ||
180 | int written; | 181 | int written; |
181 | QString out; | 182 | QString out; |
182 | out = "<!DOCTYPE Tasks>\n<Tasks>\n"; | 183 | out = "<!DOCTYPE Tasks>\n<Tasks>\n"; |
183 | 184 | ||
184 | // for all todos | 185 | // for all todos |
185 | QMap<int, OTodo>::Iterator it; | 186 | QMap<int, OTodo>::Iterator it; |
186 | for (it = m_events.begin(); it != m_events.end(); ++it ) { | 187 | for (it = m_events.begin(); it != m_events.end(); ++it ) { |
187 | out+= "<Task " + toString( (*it) ) + " />\n"; | 188 | out+= "<Task " + toString( (*it) ) + " />\n"; |
188 | QCString cstr = out.utf8(); | 189 | QCString cstr = out.utf8(); |
189 | written = f.writeBlock( cstr.data(), cstr.length() ); | 190 | written = f.writeBlock( cstr.data(), cstr.length() ); |
190 | 191 | ||