-rw-r--r-- | libopie/pim/ocontact.cpp | 1 | ||||
-rw-r--r-- | libopie/pim/ocontact.h | 4 | ||||
-rw-r--r-- | libopie/pim/opimrecord.cpp | 8 | ||||
-rw-r--r-- | libopie/pim/opimrecord.h | 15 |
4 files changed, 22 insertions, 6 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index aeb69ee..a7ca975 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp @@ -955,2 +955,3 @@ bool OContact::match( const QRegExp &r ) const { + setLastHitField( -1 ); bool match; diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h index f79f0f3..dd2de17 100644 --- a/libopie/pim/ocontact.h +++ b/libopie/pim/ocontact.h @@ -216,6 +216,2 @@ public: static int rtti(); - int lastHitField() const {return m_lastHitField;}; -protected: - mutable int m_lastHitField; - void setLastHitField(int i) const { m_lastHitField = i; }; diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp index d45417a..9510357 100644 --- a/libopie/pim/opimrecord.cpp +++ b/libopie/pim/opimrecord.cpp @@ -13,2 +13,3 @@ OPimRecord::OPimRecord( int uid ) + m_lastHit = -1; setUid( uid ); @@ -26,2 +27,3 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { m_xrefman = rec.m_xrefman; + m_lastHit = rec.m_lastHit; @@ -166 +168,7 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { } +void OPimRecord::setLastHitField( int lastHit )const { + m_lastHit = lastHit; +} +int OPimRecord::lastHitField()const{ + return m_lastHit; +} diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h index 6e7c0da..494c78e 100644 --- a/libopie/pim/opimrecord.h +++ b/libopie/pim/opimrecord.h @@ -77,4 +77,12 @@ public: */ - virtual bool match( const QString ®exp ) const - {return Qtopia::Record::match(QRegExp(regexp));}; + virtual bool match( const QString ®exp ) const + {setLastHitField( -1 ); + return Qtopia::Record::match(QRegExp(regexp));}; + + /** + * if implemented this function returns which item has been + * last hit by the match() function. + * or -1 if not implemented or no hit has occured + */ + int lastHitField()const; @@ -123,2 +131,5 @@ public: protected: + // need to be const cause it is called from const methods + mutable int m_lastHit; + void setLastHitField( int lastHit )const; Qtopia::UidGen &uidGen(); |