-rw-r--r-- | libopie/pim/opimrecord.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp index 62dc353..21cf131 100644 --- a/libopie/pim/opimrecord.cpp +++ b/libopie/pim/opimrecord.cpp | |||
@@ -77,58 +77,56 @@ void OPimRecord::addRelation( const QString& app, int id ) { | |||
77 | QArray<int> tmp; | 77 | QArray<int> tmp; |
78 | 78 | ||
79 | it = m_relations.find( app ); | 79 | it = m_relations.find( app ); |
80 | if ( it == m_relations.end() ) { | 80 | if ( it == m_relations.end() ) { |
81 | tmp.resize(1 ); | 81 | tmp.resize(1 ); |
82 | tmp[0] = id; | 82 | tmp[0] = id; |
83 | }else{ | 83 | }else{ |
84 | tmp = it.data(); | 84 | tmp = it.data(); |
85 | tmp.resize( tmp.size() + 1 ); | 85 | tmp.resize( tmp.size() + 1 ); |
86 | tmp[tmp.size() - 1] = id; | 86 | tmp[tmp.size() - 1] = id; |
87 | } | 87 | } |
88 | m_relations.replace( app, tmp ); | 88 | m_relations.replace( app, tmp ); |
89 | } | 89 | } |
90 | void OPimRecord::setRelations( const QString& app, QArray<int> ids ) { | 90 | void OPimRecord::setRelations( const QString& app, QArray<int> ids ) { |
91 | 91 | ||
92 | QMap<QString, QArray<int> >::Iterator it; | 92 | QMap<QString, QArray<int> >::Iterator it; |
93 | QArray<int> tmp; | 93 | QArray<int> tmp; |
94 | 94 | ||
95 | it = m_relations.find( app); | 95 | it = m_relations.find( app); |
96 | if ( it == m_relations.end() ) { | 96 | if ( it == m_relations.end() ) { |
97 | tmp = ids; | 97 | tmp = ids; |
98 | }else{ | 98 | }else{ |
99 | tmp = it.data(); | 99 | tmp = it.data(); |
100 | int offset = tmp.size()-1; | 100 | int offset = tmp.size()-1; |
101 | tmp.resize( tmp.size() + ids.size() ); | 101 | tmp.resize( tmp.size() + ids.size() ); |
102 | for (uint i = 0; i < ids.size(); i++ ) { | 102 | for (uint i = 0; i < ids.size(); i++ ) { |
103 | tmp[offset+i] = ids[i]; | 103 | tmp[offset+i] = ids[i]; |
104 | } | 104 | } |
105 | 105 | ||
106 | } | 106 | } |
107 | m_relations.replace( app, tmp ); | 107 | m_relations.replace( app, tmp ); |
108 | } | 108 | } |
109 | QString OPimRecord::crossToString()const { | 109 | QString OPimRecord::crossToString()const { |
110 | QString str; | 110 | QString str; |
111 | QMap<QString, QArray<int> >::ConstIterator it; | 111 | QMap<QString, QArray<int> >::ConstIterator it; |
112 | for (it = m_relations.begin(); it != m_relations.end(); ++it ) { | 112 | for (it = m_relations.begin(); it != m_relations.end(); ++it ) { |
113 | QArray<int> id = it.data(); | 113 | QArray<int> id = it.data(); |
114 | for ( uint i = 0; i < id.size(); ++i ) { | 114 | for ( uint i = 0; i < id.size(); ++i ) { |
115 | str += it.key() + "," + QString::number( i ) + ";"; | 115 | str += it.key() + "," + QString::number( i ) + ";"; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | str = str.remove( str.length()-1, 1); // strip the ; | 118 | str = str.remove( str.length()-1, 1); // strip the ; |
119 | //qWarning("IDS " + str ); | 119 | //qWarning("IDS " + str ); |
120 | 120 | ||
121 | return str; | 121 | return str; |
122 | } | 122 | } |
123 | /* if uid = 1 assign a new one */ | 123 | /* if uid = 1 assign a new one */ |
124 | void OPimRecord::setUid( int uid ) { | 124 | void OPimRecord::setUid( int uid ) { |
125 | // qWarning("setting uid" ); | ||
126 | if ( uid == 1) | 125 | if ( uid == 1) |
127 | uid = uidGen().generate(); | 126 | uid = uidGen().generate(); |
128 | 127 | ||
129 | // qWarning(" uid %d", uid); | ||
130 | Qtopia::Record::setUid( uid ); | 128 | Qtopia::Record::setUid( uid ); |
131 | }; | 129 | }; |
132 | Qtopia::UidGen &OPimRecord::uidGen() { | 130 | Qtopia::UidGen &OPimRecord::uidGen() { |
133 | return m_uidGen; | 131 | return m_uidGen; |
134 | } | 132 | } |