Diffstat (limited to 'libopie2/opiepim/core/opimrecord.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 117 |
1 files changed, 89 insertions, 28 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 @@ | |||
28 | */ | 28 | */ |
29 | #include <qarray.h> | ||
30 | 29 | ||
30 | #include "opimrecord.h" | ||
31 | |||
32 | /* OPIE */ | ||
31 | #include <qpe/categories.h> | 33 | #include <qpe/categories.h> |
@@ -33,5 +35,7 @@ | |||
33 | 35 | ||
34 | #include <opie2/opimrecord.h> | 36 | /* QT */ |
37 | #include <qarray.h> | ||
35 | 38 | ||
36 | namespace Opie { | 39 | namespace Opie |
40 | { | ||
37 | Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); | 41 | Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); |
@@ -40,3 +44,4 @@ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); | |||
40 | OPimRecord::OPimRecord( int uid ) | 44 | OPimRecord::OPimRecord( int uid ) |
41 | : Qtopia::Record() { | 45 | : Qtopia::Record() |
46 | { | ||
42 | 47 | ||
@@ -45,4 +50,8 @@ OPimRecord::OPimRecord( int uid ) | |||
45 | } | 50 | } |
46 | OPimRecord::~OPimRecord() { | 51 | |
47 | } | 52 | |
53 | OPimRecord::~OPimRecord() | ||
54 | {} | ||
55 | |||
56 | |||
48 | OPimRecord::OPimRecord( const OPimRecord& rec ) | 57 | OPimRecord::OPimRecord( const OPimRecord& rec ) |
@@ -53,3 +62,5 @@ OPimRecord::OPimRecord( const OPimRecord& rec ) | |||
53 | 62 | ||
54 | OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { | 63 | |
64 | OPimRecord &OPimRecord::operator=( const OPimRecord& rec ) | ||
65 | { | ||
55 | if ( this == &rec ) return *this; | 66 | if ( this == &rec ) return *this; |
@@ -62,2 +73,4 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { | |||
62 | } | 73 | } |
74 | |||
75 | |||
63 | /* | 76 | /* |
@@ -65,3 +78,4 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { | |||
65 | */ | 78 | */ |
66 | QStringList OPimRecord::categoryNames( const QString& appname ) const { | 79 | QStringList OPimRecord::categoryNames( const QString& appname ) const |
80 | { | ||
67 | QStringList list; | 81 | QStringList list; |
@@ -71,3 +85,4 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const { | |||
71 | 85 | ||
72 | for (uint i = 0; i < cats.count(); i++ ) { | 86 | for ( uint i = 0; i < cats.count(); i++ ) |
87 | { | ||
73 | list << catDB.label( appname, cats[i] ); | 88 | list << catDB.label( appname, cats[i] ); |
@@ -77,6 +92,11 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const { | |||
77 | } | 92 | } |
78 | void OPimRecord::setCategoryNames( const QStringList& ) { | ||
79 | 93 | ||
94 | |||
95 | void OPimRecord::setCategoryNames( const QStringList& ) | ||
96 | { | ||
80 | } | 97 | } |
81 | void OPimRecord::addCategoryName( const QString& ) { | 98 | |
99 | |||
100 | void OPimRecord::addCategoryName( const QString& ) | ||
101 | { | ||
82 | Categories catDB; | 102 | Categories catDB; |
@@ -86,5 +106,10 @@ void OPimRecord::addCategoryName( const QString& ) { | |||
86 | } | 106 | } |
87 | bool OPimRecord::isEmpty()const { | 107 | |
108 | |||
109 | bool OPimRecord::isEmpty() const | ||
110 | { | ||
88 | return ( uid() == 0 ); | 111 | return ( uid() == 0 ); |
89 | } | 112 | } |
113 | |||
114 | |||
90 | /*QString OPimRecord::crossToString()const { | 115 | /*QString OPimRecord::crossToString()const { |
@@ -104,3 +129,4 @@ bool OPimRecord::isEmpty()const { | |||
104 | /* if uid = 1 assign a new one */ | 129 | /* if uid = 1 assign a new one */ |
105 | void OPimRecord::setUid( int uid ) { | 130 | void OPimRecord::setUid( int uid ) |
131 | { | ||
106 | if ( uid == 1) | 132 | if ( uid == 1) |
@@ -110,9 +136,18 @@ void OPimRecord::setUid( int uid ) { | |||
110 | }; | 136 | }; |
111 | Qtopia::UidGen &OPimRecord::uidGen() { | 137 | |
138 | |||
139 | Qtopia::UidGen &OPimRecord::uidGen() | ||
140 | { | ||
112 | return m_uidGen; | 141 | return m_uidGen; |
113 | } | 142 | } |
114 | OPimXRefManager &OPimRecord::xrefmanager() { | 143 | |
144 | |||
145 | OPimXRefManager &OPimRecord::xrefmanager() | ||
146 | { | ||
115 | return m_xrefman; | 147 | return m_xrefman; |
116 | } | 148 | } |
117 | int OPimRecord::rtti(){ | 149 | |
150 | |||
151 | int OPimRecord::rtti() | ||
152 | { | ||
118 | return 0; | 153 | return 0; |
@@ -128,3 +163,4 @@ int OPimRecord::rtti(){ | |||
128 | */ | 163 | */ |
129 | bool OPimRecord::loadFromStream( QDataStream& stream ) { | 164 | bool OPimRecord::loadFromStream( QDataStream& stream ) |
165 | { | ||
130 | int Int; | 166 | int Int; |
@@ -137,3 +173,4 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { | |||
137 | QArray<int> array(UInt); | 173 | QArray<int> array(UInt); |
138 | for (uint i = 0; i < UInt; i++ ) { | 174 | for ( uint i = 0; i < UInt; i++ ) |
175 | { | ||
139 | stream >> array[i]; | 176 | stream >> array[i]; |
@@ -147,3 +184,4 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { | |||
147 | stream >> UInt; | 184 | stream >> UInt; |
148 | for ( uint i = 0; i < UInt; i++ ) { | 185 | for ( uint i = 0; i < UInt; i++ ) |
186 | { | ||
149 | xref.setPartner( OPimXRef::One, partner( stream ) ); | 187 | xref.setPartner( OPimXRef::One, partner( stream ) ); |
@@ -155,3 +193,6 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { | |||
155 | } | 193 | } |
156 | bool OPimRecord::saveToStream( QDataStream& stream )const { | 194 | |
195 | |||
196 | bool OPimRecord::saveToStream( QDataStream& stream ) const | ||
197 | { | ||
157 | /** UIDs */ | 198 | /** UIDs */ |
@@ -162,3 +203,4 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { | |||
162 | stream << categories().count(); | 203 | stream << categories().count(); |
163 | for ( uint i = 0; i < categories().count(); i++ ) { | 204 | for ( uint i = 0; i < categories().count(); i++ ) |
205 | { | ||
164 | stream << categories()[i]; | 206 | stream << categories()[i]; |
@@ -172,3 +214,4 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { | |||
172 | for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin(); | 214 | for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin(); |
173 | it != m_xrefman.list().end(); ++it ) { | 215 | it != m_xrefman.list().end(); ++it ) |
216 | { | ||
174 | flush( (*it).partner( OPimXRef::One), stream ); | 217 | flush( (*it).partner( OPimXRef::One), stream ); |
@@ -178,3 +221,6 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { | |||
178 | } | 221 | } |
179 | void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{ | 222 | |
223 | |||
224 | void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const | ||
225 | { | ||
180 | str << par.service(); | 226 | str << par.service(); |
@@ -183,3 +229,6 @@ void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{ | |||
183 | } | 229 | } |
184 | OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { | 230 | |
231 | |||
232 | OPimXRefPartner OPimRecord::partner( QDataStream& stream ) | ||
233 | { | ||
185 | OPimXRefPartner par; | 234 | OPimXRefPartner par; |
@@ -199,12 +248,24 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { | |||
199 | } | 248 | } |
200 | void OPimRecord::setLastHitField( int lastHit )const { | 249 | |
250 | |||
251 | void OPimRecord::setLastHitField( int lastHit ) const | ||
252 | { | ||
201 | m_lastHit = lastHit; | 253 | m_lastHit = lastHit; |
202 | } | 254 | } |
203 | int OPimRecord::lastHitField()const{ | 255 | |
256 | |||
257 | int OPimRecord::lastHitField() const | ||
258 | { | ||
204 | return m_lastHit; | 259 | return m_lastHit; |
205 | } | 260 | } |
206 | QMap<QString, QString> OPimRecord::toExtraMap()const { | 261 | |
262 | |||
263 | QMap<QString, QString> OPimRecord::toExtraMap() const | ||
264 | { | ||
207 | return customMap; | 265 | return customMap; |
208 | } | 266 | } |
209 | void OPimRecord::setExtraMap( const QMap<QString, QString>& map) { | 267 | |
268 | |||
269 | void OPimRecord::setExtraMap( const QMap<QString, QString>& map ) | ||
270 | { | ||
210 | customMap = map; | 271 | customMap = map; |