author | zecke <zecke> | 2003-02-22 16:12:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-22 16:12:49 (UTC) |
commit | 66b00525256255290dfcd9d48ebe1539f15b8dce (patch) (unidiff) | |
tree | e0857ba9251d6ebcd7df5d23b9269c69d6edd944 /libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | |
parent | 397a7b1635488deda02b36df70692e27f59bb3e0 (diff) | |
download | opie-66b00525256255290dfcd9d48ebe1539f15b8dce.zip opie-66b00525256255290dfcd9d48ebe1539f15b8dce.tar.gz opie-66b00525256255290dfcd9d48ebe1539f15b8dce.tar.bz2 |
Remove some testing code
Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp index 5239d84..bc51996 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | |||
@@ -142,26 +142,25 @@ ODateBookAccessBackend_XML::ODateBookAccessBackend_XML( const QString& , | |||
142 | m_changed = false; | 142 | m_changed = false; |
143 | } | 143 | } |
144 | ODateBookAccessBackend_XML::~ODateBookAccessBackend_XML() { | 144 | ODateBookAccessBackend_XML::~ODateBookAccessBackend_XML() { |
145 | } | 145 | } |
146 | bool ODateBookAccessBackend_XML::load() { | 146 | bool ODateBookAccessBackend_XML::load() { |
147 | return loadFile(); | 147 | return loadFile(); |
148 | } | 148 | } |
149 | bool ODateBookAccessBackend_XML::reload() { | 149 | bool ODateBookAccessBackend_XML::reload() { |
150 | clear(); | 150 | clear(); |
151 | return load(); | 151 | return load(); |
152 | } | 152 | } |
153 | bool ODateBookAccessBackend_XML::save() { | 153 | bool ODateBookAccessBackend_XML::save() { |
154 | qWarning("going to save now"); | 154 | if (!m_changed) return true; |
155 | // if (!m_changed) return true; | ||
156 | 155 | ||
157 | int total_written; | 156 | int total_written; |
158 | QString strFileNew = m_name + ".new"; | 157 | QString strFileNew = m_name + ".new"; |
159 | 158 | ||
160 | QFile f( strFileNew ); | 159 | QFile f( strFileNew ); |
161 | if (!f.open( IO_WriteOnly | IO_Raw ) ) return false; | 160 | if (!f.open( IO_WriteOnly | IO_Raw ) ) return false; |
162 | 161 | ||
163 | QString buf( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ); | 162 | QString buf( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ); |
164 | buf += "<!DOCTYPE DATEBOOK><DATEBOOK>\n"; | 163 | buf += "<!DOCTYPE DATEBOOK><DATEBOOK>\n"; |
165 | buf += "<events>\n"; | 164 | buf += "<events>\n"; |
166 | QCString str = buf.utf8(); | 165 | QCString str = buf.utf8(); |
167 | total_written = f.writeBlock( str.data(), str.length() ); | 166 | total_written = f.writeBlock( str.data(), str.length() ); |
@@ -183,25 +182,24 @@ bool ODateBookAccessBackend_XML::save() { | |||
183 | } | 182 | } |
184 | 183 | ||
185 | buf = "</events>\n</DATEBOOK>\n"; | 184 | buf = "</events>\n</DATEBOOK>\n"; |
186 | str = buf.utf8(); | 185 | str = buf.utf8(); |
187 | total_written = f.writeBlock( str.data(), str.length() ); | 186 | total_written = f.writeBlock( str.data(), str.length() ); |
188 | if ( total_written != int(str.length() ) ) { | 187 | if ( total_written != int(str.length() ) ) { |
189 | f.close(); | 188 | f.close(); |
190 | QFile::remove( strFileNew ); | 189 | QFile::remove( strFileNew ); |
191 | return false; | 190 | return false; |
192 | } | 191 | } |
193 | f.close(); | 192 | f.close(); |
194 | 193 | ||
195 | exit(0); | ||
196 | if ( ::rename( strFileNew, m_name ) < 0 ) { | 194 | if ( ::rename( strFileNew, m_name ) < 0 ) { |
197 | QFile::remove( strFileNew ); | 195 | QFile::remove( strFileNew ); |
198 | return false; | 196 | return false; |
199 | } | 197 | } |
200 | 198 | ||
201 | m_changed = false; | 199 | m_changed = false; |
202 | return true; | 200 | return true; |
203 | } | 201 | } |
204 | QArray<int> ODateBookAccessBackend_XML::allRecords()const { | 202 | QArray<int> ODateBookAccessBackend_XML::allRecords()const { |
205 | QArray<int> ints( m_raw.count()+ m_rep.count() ); | 203 | QArray<int> ints( m_raw.count()+ m_rep.count() ); |
206 | uint i = 0; | 204 | uint i = 0; |
207 | QMap<int, OEvent>::ConstIterator it; | 205 | QMap<int, OEvent>::ConstIterator it; |