summaryrefslogtreecommitdiff
authoreilers <eilers>2004-05-08 12:38:51 (UTC)
committer eilers <eilers>2004-05-08 12:38:51 (UTC)
commit81bc0cecdeb7c49f4f2950c1e5649bad05593d0c (patch) (side-by-side diff)
treeb687e3562c432414df407d5d4e776b7c785588a3
parent91eccd3d535a8fb0022865bd1e1c100628a65431 (diff)
downloadopie-81bc0cecdeb7c49f4f2950c1e5649bad05593d0c.zip
opie-81bc0cecdeb7c49f4f2950c1e5649bad05593d0c.tar.gz
opie-81bc0cecdeb7c49f4f2950c1e5649bad05593d0c.tar.bz2
Fixed a lot of worse bugs in the databook-backend for SQL.
It was found by doing equivalence checks between events, moved between xml and sql backend, using opimconverter.. More bugfixes will follow..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp2
-rw-r--r--libopie2/opiepim/core/opimevent.cpp36
-rw-r--r--libopie2/opiepim/core/opimevent.h2
3 files changed, 24 insertions, 16 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index 6c32b40..f4f3c94 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -137,9 +137,9 @@ void ODateBookAccessBackend_SQL::initFields()
m_fieldMap.insert( OPimEvent::FRecChildren, "Recchildren" );
// Create a map that maps the column name to the id
QMapConstIterator<int, QString> it;
- for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
+ for ( it = m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
m_reverseFieldMap.insert( it.data(), it.key() );
}
}
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp
index 8bf8b25..9d46651 100644
--- a/libopie2/opiepim/core/opimevent.cpp
+++ b/libopie2/opiepim/core/opimevent.cpp
@@ -554,11 +554,14 @@ QMap<int, QString> OPimEvent::toMap() const
retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) );
retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) );
retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) );
retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" );
- OPimAlarm alarm = notifiers().alarms() [ 0 ];
- retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
- retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
+ if ( notifiers().alarms().count() ){
+ // Currently we just support one alarm.. (eilers)
+ OPimAlarm alarm = notifiers().alarms() [ 0 ];
+ retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
+ retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
+ }
OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() );
retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) );
retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) );
@@ -618,19 +621,8 @@ void OPimEvent::fromMap( const QMap<int, QString>& map )
setAllDay( true );
else
setAllDay( false );
- int alarmTime = -1;
- if ( !map[ OPimEvent::FAlarm ].isEmpty() )
- alarmTime = map[ OPimEvent::FAlarm ].toInt();
-
- int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
- if ( ( alarmTime != -1 ) )
- {
- QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
- OPimAlarm al( sound , dt );
- notifiers().add( al );
- }
if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) )
{
setTimeZone( map[ OPimEvent::FTimeZone ] );
}
@@ -658,8 +650,24 @@ void OPimEvent::fromMap( const QMap<int, QString>& map )
date = zone.toDateTime( end );
setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) );
}
+ int alarmTime = -1;
+ if ( !map[ OPimEvent::FAlarm ].isEmpty() )
+ alarmTime = map[ OPimEvent::FAlarm ].toInt();
+
+ int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
+ if ( ( alarmTime != -1 ) )
+ {
+ QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
+ OPimAlarm al( sound , dt );
+ notifiers().add( al );
+ }
+
+
+ if ( !map[ OPimEvent::FNote ].isEmpty() )
+ setNote( map[ OPimEvent::FNote ] );
+
if ( !map[ OPimEvent::FRecParent ].isEmpty() )
setParent( map[ OPimEvent::FRecParent ].toInt() );
if ( !map[ OPimEvent::FRecChildren ].isEmpty() )
diff --git a/libopie2/opiepim/core/opimevent.h b/libopie2/opiepim/core/opimevent.h
index 56fe917..5553cac 100644
--- a/libopie2/opiepim/core/opimevent.h
+++ b/libopie2/opiepim/core/opimevent.h
@@ -78,9 +78,9 @@ class OPimEvent : public OPimRecord
*/
enum RecordFields {
FUid = Qtopia::UID_ID,
FCategories = Qtopia::CATEGORY_ID,
- FDescription = 0,
+ FDescription /* = 0 Why this ? (eilers) */,
FLocation,
FType,
FAlarm,
FSound,