author | zecke <zecke> | 2002-09-22 23:32:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-22 23:32:49 (UTC) |
commit | d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f (patch) (side-by-side diff) | |
tree | 5ff52b48fd514c6f24da6d3204bc98b66c48a652 /libopie2/opiepim/backend | |
parent | 4f142e98ee63e88fa0df61161b93228ee719d551 (diff) | |
download | opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.zip opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.tar.gz opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.tar.bz2 |
Two brown paper bags later OTodo is ok again... pointers can be so fscking awesome
I had problems with QShared because I forgot to copy it in &operator=
And the other one was d = 0
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index 21756c9..3a72881 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp @@ -39,72 +39,72 @@ bool OTodoAccessXML::load() { dict.insert("DateDay" , new int(OTodo::DateDay) ); dict.insert("DateMonth" , new int(OTodo::DateMonth) ); dict.insert("DateYear" , new int(OTodo::DateYear) ); dict.insert("Progress" , new int(OTodo::Progress) ); dict.insert("Completed", new int(OTodo::Completed) ); dict.insert("CrossReference", new int(OTodo::CrossReference) ); dict.insert("HasAlarmDateTime",new int(OTodo::HasAlarmDateTime) ); dict.insert("AlarmDateTime", new int(OTodo::AlarmDateTime) ); Opie::XMLElement *root = Opie::XMLElement::load( m_file ); int day, year, month; day = year = month = -1; /* if opened */ if ( root != 0l ) { Opie::XMLElement *element = root->firstChild(); if ( element == 0l ) return false; element = element->firstChild(); while ( element ) { if ( element->tagName() != QString::fromLatin1("Task") ) { element = element->nextChild(); continue; } /* here is the right element for a task */ OTodo ev = todo( &dict, element ); m_events.insert( ev.uid(), ev ); element = element->nextChild(); } - return true; }else { qWarning("could not parse"); return false;; } delete root; m_opened = true; + qWarning("Access %d" + m_events.count() ); return true; } bool OTodoAccessXML::reload() { return load(); } bool OTodoAccessXML::save() { if (!m_opened || !m_changed ) return true; QString strNewFile = m_file + ".new"; QFile f( strNewFile ); if (!f.open( IO_WriteOnly|IO_Raw ) ) return false; int written; QString out; out = "<!DOCTYPE Tasks>\n<Tasks>\n"; // for all todos QMap<int, OTodo>::Iterator it; for (it = m_events.begin(); it != m_events.end(); ++it ) { out+= "<Task " + toString( (*it) ) + " />\n"; QCString cstr = out.utf8(); written = f.writeBlock( cstr.data(), cstr.length() ); /* less written then we wanted */ if ( written != (int)cstr.length() ) { f.close(); QFile::remove( strNewFile ); return false; } out = QString::null; } |