summaryrefslogtreecommitdiff
path: root/libopie
authortille <tille>2003-05-14 14:19:22 (UTC)
committer tille <tille>2003-05-14 14:19:22 (UTC)
commit3c4a67b8b8d3fb554c5259f9f5ca35c5c826b13c (patch) (unidiff)
tree2d2ab90c571dfa51bb65116d4df0134b65750084 /libopie
parent79fdef27944117811eb1ef51c45a0a630b85a9ad (diff)
downloadopie-3c4a67b8b8d3fb554c5259f9f5ca35c5c826b13c.zip
opie-3c4a67b8b8d3fb554c5259f9f5ca35c5c826b13c.tar.gz
opie-3c4a67b8b8d3fb554c5259f9f5ca35c5c826b13c.tar.bz2
get the field where the hit was
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp1
-rw-r--r--libopie/pim/ocontact.h5
2 files changed, 5 insertions, 1 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index a38b62b..aeb69ee 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -937,48 +937,49 @@ void OContact::setEmails( const QString &str )
937 if ( str.isEmpty() ) 937 if ( str.isEmpty() )
938 setDefaultEmail( QString::null ); 938 setDefaultEmail( QString::null );
939} 939}
940 940
941/*! 941/*!
942 Sets the list of children for the contact to those contained in \a str. 942 Sets the list of children for the contact to those contained in \a str.
943*/ 943*/
944void OContact::setChildren( const QString &str ) 944void OContact::setChildren( const QString &str )
945{ 945{
946 replace( Qtopia::Children, str ); 946 replace( Qtopia::Children, str );
947} 947}
948 948
949/*! 949/*!
950 \overload 950 \overload
951 Returns TRUE if the contact matches the regular expression \a regexp. 951 Returns TRUE if the contact matches the regular expression \a regexp.
952 Otherwise returns FALSE. 952 Otherwise returns FALSE.
953*/ 953*/
954bool OContact::match( const QRegExp &r ) const 954bool OContact::match( const QRegExp &r ) const
955{ 955{
956 bool match; 956 bool match;
957 match = false; 957 match = false;
958 QMap<int, QString>::ConstIterator it; 958 QMap<int, QString>::ConstIterator it;
959 for ( it = mMap.begin(); it != mMap.end(); ++it ) { 959 for ( it = mMap.begin(); it != mMap.end(); ++it ) {
960 if ( (*it).find( r ) > -1 ) { 960 if ( (*it).find( r ) > -1 ) {
961 setLastHitField( it.key() );
961 match = true; 962 match = true;
962 break; 963 break;
963 } 964 }
964 } 965 }
965 return match; 966 return match;
966} 967}
967 968
968 969
969QString OContact::toShortText() const 970QString OContact::toShortText() const
970{ 971{
971 return ( fullName() ); 972 return ( fullName() );
972} 973}
973QString OContact::type() const 974QString OContact::type() const
974{ 975{
975 return QString::fromLatin1( "OContact" ); 976 return QString::fromLatin1( "OContact" );
976} 977}
977 978
978// Definition is missing ! (se) 979// Definition is missing ! (se)
979QMap<QString,QString> OContact::toExtraMap() const 980QMap<QString,QString> OContact::toExtraMap() const
980{ 981{
981 qWarning ("Function not implemented: OContact::toExtraMap()"); 982 qWarning ("Function not implemented: OContact::toExtraMap()");
982 QMap <QString,QString> useless; 983 QMap <QString,QString> useless;
983 return useless; 984 return useless;
984} 985}
diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h
index 0e6cbd2..f79f0f3 100644
--- a/libopie/pim/ocontact.h
+++ b/libopie/pim/ocontact.h
@@ -193,49 +193,52 @@ public:
193 193
194// // custom 194// // custom
195// const QString &customField( const QString &key ) 195// const QString &customField( const QString &key )
196// { return find( Custom- + key ); } 196// { return find( Custom- + key ); }
197 197
198 198
199 QString toRichText() const; 199 QString toRichText() const;
200 QMap<int, QString> toMap() const; 200 QMap<int, QString> toMap() const;
201 QString field( int key ) const { return find( key ); } 201 QString field( int key ) const { return find( key ); }
202 202
203 203
204 void setUid( int i ); 204 void setUid( int i );
205 205
206 QString toShortText()const; 206 QString toShortText()const;
207 QString OContact::type()const; 207 QString OContact::type()const;
208 QMap<QString,QString> OContact::toExtraMap() const; 208 QMap<QString,QString> OContact::toExtraMap() const;
209 class QString OContact::recordField(int) const; 209 class QString OContact::recordField(int) const;
210 210
211 // Why private ? (eilers,se) 211 // Why private ? (eilers,se)
212 QString emailSeparator() const { return " "; } 212 QString emailSeparator() const { return " "; }
213 // the emails should be seperated by a comma 213 // the emails should be seperated by a comma
214 void setEmails( const QString &v ); 214 void setEmails( const QString &v );
215 QString emails() const { return find( Qtopia::Emails ); } 215 QString emails() const { return find( Qtopia::Emails ); }
216 static int rtti(); 216 static int rtti();
217 217 int lastHitField() const {return m_lastHitField;};
218protected:
219 mutable int m_lastHitField;
220 void setLastHitField(int i) const { m_lastHitField = i; };
218 221
219private: 222private:
220 // The XML-Backend needs some access to the private functions 223 // The XML-Backend needs some access to the private functions
221 friend class OContactAccessBackend_XML; 224 friend class OContactAccessBackend_XML;
222 225
223 void insert( int key, const QString &value ); 226 void insert( int key, const QString &value );
224 void replace( int key, const QString &value ); 227 void replace( int key, const QString &value );
225 QString find( int key ) const; 228 QString find( int key ) const;
226 static QStringList fields(); 229 static QStringList fields();
227 230
228 void save( QString &buf ) const; 231 void save( QString &buf ) const;
229 232
230 QString displayAddress( const QString &street, 233 QString displayAddress( const QString &street,
231 const QString &city, 234 const QString &city,
232 const QString &state, 235 const QString &state,
233 const QString &zip, 236 const QString &zip,
234 const QString &country ) const; 237 const QString &country ) const;
235 238
236 QMap<int, QString> mMap; 239 QMap<int, QString> mMap;
237 ContactPrivate *d; 240 ContactPrivate *d;
238}; 241};
239 242
240 243
241#endif 244#endif