-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.h | 13 |
2 files changed, 20 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index d45417a..9510357 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp @@ -12,4 +12,5 @@ OPimRecord::OPimRecord( int uid ) : Qtopia::Record() { + m_lastHit = -1; setUid( uid ); } @@ -25,4 +26,5 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { Qtopia::Record::operator=( rec ); m_xrefman = rec.m_xrefman; + m_lastHit = rec.m_lastHit; return *this; @@ -165,2 +167,8 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { return par; } +void OPimRecord::setLastHitField( int lastHit )const { + m_lastHit = lastHit; +} +int OPimRecord::lastHitField()const{ + return m_lastHit; +} diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h index 6e7c0da..494c78e 100644 --- a/libopie2/opiepim/core/opimrecord.h +++ b/libopie2/opiepim/core/opimrecord.h @@ -77,5 +77,13 @@ public: */ virtual bool match( const QString ®exp ) const - {return Qtopia::Record::match(QRegExp(regexp));}; + {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; /** @@ -122,4 +130,7 @@ 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(); // QString crossToString()const; |