Diffstat (limited to 'libopie2/opiepim/core/opimrecord.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 141 |
1 files changed, 101 insertions, 40 deletions
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index 72bb372..c603f44 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp @@ -28,4 +28,6 @@ */ -#include <qarray.h> +#include "opimrecord.h" + +/* OPIE */ #include <qpe/categories.h> @@ -33,5 +35,7 @@ -#include <opie2/opimrecord.h> +/* QT */ +#include <qarray.h> -namespace Opie { +namespace Opie +{ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); @@ -40,3 +44,4 @@ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); OPimRecord::OPimRecord( int uid ) - : Qtopia::Record() { + : Qtopia::Record() +{ @@ -45,12 +50,18 @@ OPimRecord::OPimRecord( int uid ) } -OPimRecord::~OPimRecord() { -} + + +OPimRecord::~OPimRecord() +{} + + OPimRecord::OPimRecord( const OPimRecord& rec ) - : Qtopia::Record( rec ) + : Qtopia::Record( rec ) { - (*this) = rec; + ( *this ) = rec; } -OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { - if ( this == &rec ) return *this; + +OPimRecord &OPimRecord::operator=( const OPimRecord& rec ) +{ + if ( this == &rec ) return * this; @@ -60,4 +71,6 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { - return *this; + return *this; } + + /* @@ -65,3 +78,4 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { */ -QStringList OPimRecord::categoryNames( const QString& appname ) const { +QStringList OPimRecord::categoryNames( const QString& appname ) const +{ QStringList list; @@ -71,4 +85,5 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const { - for (uint i = 0; i < cats.count(); i++ ) { - list << catDB.label( appname, cats[i] ); + for ( uint i = 0; i < cats.count(); i++ ) + { + list << catDB.label( appname, cats[ i ] ); } @@ -77,6 +92,11 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const { } -void OPimRecord::setCategoryNames( const QStringList& ) { + +void OPimRecord::setCategoryNames( const QStringList& ) +{ } -void OPimRecord::addCategoryName( const QString& ) { + + +void OPimRecord::addCategoryName( const QString& ) +{ Categories catDB; @@ -86,5 +106,10 @@ void OPimRecord::addCategoryName( const QString& ) { } -bool OPimRecord::isEmpty()const { + + +bool OPimRecord::isEmpty() const +{ return ( uid() == 0 ); } + + /*QString OPimRecord::crossToString()const { @@ -104,4 +129,5 @@ bool OPimRecord::isEmpty()const { /* if uid = 1 assign a new one */ -void OPimRecord::setUid( int uid ) { - if ( uid == 1) +void OPimRecord::setUid( int uid ) +{ + if ( uid == 1 ) uid = uidGen().generate(); @@ -110,9 +136,18 @@ void OPimRecord::setUid( int uid ) { }; -Qtopia::UidGen &OPimRecord::uidGen() { + + +Qtopia::UidGen &OPimRecord::uidGen() +{ return m_uidGen; } -OPimXRefManager &OPimRecord::xrefmanager() { + + +OPimXRefManager &OPimRecord::xrefmanager() +{ return m_xrefman; } -int OPimRecord::rtti(){ + + +int OPimRecord::rtti() +{ return 0; @@ -128,3 +163,4 @@ int OPimRecord::rtti(){ */ -bool OPimRecord::loadFromStream( QDataStream& stream ) { +bool OPimRecord::loadFromStream( QDataStream& stream ) +{ int Int; @@ -132,3 +168,3 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { stream >> Int; - setUid(Int); + setUid( Int ); @@ -136,5 +172,6 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { stream >> UInt; - QArray<int> array(UInt); - for (uint i = 0; i < UInt; i++ ) { - stream >> array[i]; + QArray<int> array( UInt ); + for ( uint i = 0; i < UInt; i++ ) + { + stream >> array[ i ]; } @@ -147,3 +184,4 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { stream >> UInt; - for ( uint i = 0; i < UInt; i++ ) { + for ( uint i = 0; i < UInt; i++ ) + { xref.setPartner( OPimXRef::One, partner( stream ) ); @@ -155,3 +193,6 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { } -bool OPimRecord::saveToStream( QDataStream& stream )const { + + +bool OPimRecord::saveToStream( QDataStream& stream ) const +{ /** UIDs */ @@ -162,4 +203,5 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { stream << categories().count(); - for ( uint i = 0; i < categories().count(); i++ ) { - stream << categories()[i]; + for ( uint i = 0; i < categories().count(); i++ ) + { + stream << categories() [ i ]; } @@ -172,5 +214,6 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin(); - it != m_xrefman.list().end(); ++it ) { - flush( (*it).partner( OPimXRef::One), stream ); - flush( (*it).partner( OPimXRef::Two), stream ); + it != m_xrefman.list().end(); ++it ) + { + flush( ( *it ).partner( OPimXRef::One ), stream ); + flush( ( *it ).partner( OPimXRef::Two ), stream ); } @@ -178,3 +221,6 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { } -void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{ + + +void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const +{ str << par.service(); @@ -183,3 +229,6 @@ void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{ } -OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { + + +OPimXRefPartner OPimRecord::partner( QDataStream& stream ) +{ OPimXRefPartner par; @@ -199,12 +248,24 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { } -void OPimRecord::setLastHitField( int lastHit )const { + + +void OPimRecord::setLastHitField( int lastHit ) const +{ m_lastHit = lastHit; } -int OPimRecord::lastHitField()const{ + + +int OPimRecord::lastHitField() const +{ return m_lastHit; } -QMap<QString, QString> OPimRecord::toExtraMap()const { + + +QMap<QString, QString> OPimRecord::toExtraMap() const +{ return customMap; } -void OPimRecord::setExtraMap( const QMap<QString, QString>& map) { + + +void OPimRecord::setExtraMap( const QMap<QString, QString>& map ) +{ customMap = map; |