From cc794c5ba028bbf07fa280ed49bd0b8cfb745bd7 Mon Sep 17 00:00:00 2001 From: zecke Date: Wed, 14 May 2003 14:41:47 +0000 Subject: move lastHitField stuff into OPIMRecord --- (limited to 'libopie2/opiepim/core') 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 @@ -11,6 +11,7 @@ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); OPimRecord::OPimRecord( int uid ) : Qtopia::Record() { + m_lastHit = -1; setUid( uid ); } OPimRecord::~OPimRecord() { @@ -24,6 +25,7 @@ OPimRecord::OPimRecord( const OPimRecord& rec ) OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { Qtopia::Record::operator=( rec ); m_xrefman = rec.m_xrefman; + m_lastHit = rec.m_lastHit; return *this; } @@ -164,3 +166,9 @@ 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 @@ -75,8 +75,16 @@ public: /** * matches the Records the regular expression? */ - 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; /** * converts the internal structure to a map @@ -121,6 +129,9 @@ public: virtual bool saveToStream( QDataStream& stream )const; 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; -- cgit v0.9.0.2