summaryrefslogtreecommitdiff
path: root/libopie/pim/odatebookaccessbackend_xml.cpp
Side-by-side diff
Diffstat (limited to 'libopie/pim/odatebookaccessbackend_xml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/odatebookaccessbackend_xml.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/libopie/pim/odatebookaccessbackend_xml.cpp b/libopie/pim/odatebookaccessbackend_xml.cpp
index 39c43c5..929d004 100644
--- a/libopie/pim/odatebookaccessbackend_xml.cpp
+++ b/libopie/pim/odatebookaccessbackend_xml.cpp
@@ -72,22 +72,24 @@ namespace {
FRWeekdays,
FRPosition,
FRFreq,
FRHasEndDate,
FREndDate,
FRStart,
FREnd,
FNote,
- FCreated,
+ FCreated, // Should't this be called FRCreated ?
FTimeZone,
FRecParent,
FRecChildren,
FExceptions
};
+
+ // FIXME: Use OEvent::toMap() here !! (eilers)
inline void save( const OEvent& ev, QString& buf ) {
qWarning("Saving %d %s", ev.uid(), ev.description().latin1() );
buf += " description=\"" + Qtopia::escapeString(ev.description() ) + "\"";
if (!ev.location().isEmpty() )
buf += " location=\"" + Qtopia::escapeString(ev.location() ) + "\"";
buf += " categories=\""+ Qtopia::escapeString( Qtopia::Record::idsToString( ev.categories() ) ) + "\"";
buf += " uid=\"" + QString::number( ev.uid() ) + "\"";
@@ -270,17 +272,17 @@ bool ODateBookAccessBackend_XML::add( const OEvent& ev ) {
bool ODateBookAccessBackend_XML::remove( int uid ) {
m_changed = true;
m_rep.remove( uid );
m_rep.remove( uid );
return true;
}
bool ODateBookAccessBackend_XML::replace( const OEvent& ev ) {
- replace( ev.uid() );
+ replace( ev.uid() ); // ??? Shouldn't this be "remove( ev.uid() ) ??? (eilers)
return add( ev );
}
QArray<int> ODateBookAccessBackend_XML::rawEvents()const {
return allRecords();
}
QArray<int> ODateBookAccessBackend_XML::rawRepeats()const {
QArray<int> ints( m_rep.count() );
uint i = 0;
@@ -316,16 +318,18 @@ OEvent::ValueList ODateBookAccessBackend_XML::directNonRepeats() {
OEvent::ValueList ODateBookAccessBackend_XML::directRawRepeats() {
OEvent::ValueList list;
QMap<int, OEvent>::ConstIterator it;
for (it = m_rep.begin(); it != m_rep.end(); ++it )
list.append( it.data() );
return list;
}
+
+// FIXME: Use OEvent::fromMap() (eilers)
bool ODateBookAccessBackend_XML::loadFile() {
m_changed = false;
int fd = ::open( QFile::encodeName(m_name).data(), O_RDONLY );
if ( fd < 0 ) return false;
struct stat attribute;
if ( ::fstat(fd, &attribute ) == -1 ) {
@@ -354,17 +358,17 @@ bool ODateBookAccessBackend_XML::loadFile() {
dict.insert( "rweekdays", new int(FRWeekdays) );
dict.insert( "rposition", new int(FRPosition) );
dict.insert( "rfreq", new int(FRFreq) );
dict.insert( "rhasenddate", new int(FRHasEndDate) );
dict.insert( "enddt", new int(FREndDate) );
dict.insert( "start", new int(FRStart) );
dict.insert( "end", new int(FREnd) );
dict.insert( "note", new int(FNote) );
- dict.insert( "created", new int(FCreated) );
+ dict.insert( "created", new int(FCreated) ); // Shouldn't this be FRCreated ??
dict.insert( "recparent", new int(FRecParent) );
dict.insert( "recchildren", new int(FRecChildren) );
dict.insert( "exceptions", new int(FExceptions) );
dict.insert( "timezone", new int(FTimeZone) );
char* dt = (char*)map_addr;
int len = attribute.st_size;
int i = 0;
@@ -439,16 +443,18 @@ bool ODateBookAccessBackend_XML::loadFile() {
finalizeRecord( ev );
delete rec;
}
::munmap(map_addr, attribute.st_size );
m_changed = false; // changed during add
return true;
}
+
+// FIXME: Use OEvent::fromMap() which makes this obsolete.. (eilers)
void ODateBookAccessBackend_XML::finalizeRecord( OEvent& ev ) {
/* AllDay is alway in UTC */
if ( ev.isAllDay() ) {
OTimeZone utc = OTimeZone::utc();
ev.setStartDateTime( utc.fromUTCDateTime( start ) );
ev.setEndDateTime ( utc.fromUTCDateTime( end ) );
ev.setTimeZone( "UTC"); // make sure it is really utc
}else {