summaryrefslogtreecommitdiff
authorzecke <zecke>2003-05-14 14:41:47 (UTC)
committer zecke <zecke>2003-05-14 14:41:47 (UTC)
commitcc794c5ba028bbf07fa280ed49bd0b8cfb745bd7 (patch) (side-by-side diff)
treea5496cd003388591cc4a5e323bb5c99646919b92
parent3c4a67b8b8d3fb554c5259f9f5ca35c5c826b13c (diff)
downloadopie-cc794c5ba028bbf07fa280ed49bd0b8cfb745bd7.zip
opie-cc794c5ba028bbf07fa280ed49bd0b8cfb745bd7.tar.gz
opie-cc794c5ba028bbf07fa280ed49bd0b8cfb745bd7.tar.bz2
move lastHitField stuff into OPIMRecord
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp1
-rw-r--r--libopie/pim/ocontact.h4
-rw-r--r--libopie/pim/opimrecord.cpp8
-rw-r--r--libopie/pim/opimrecord.h15
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp8
-rw-r--r--libopie2/opiepim/core/opimrecord.h15
-rw-r--r--libopie2/opiepim/ocontact.cpp1
-rw-r--r--libopie2/opiepim/ocontact.h4
8 files changed, 44 insertions, 12 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
@@ -952,8 +952,9 @@ void OContact::setChildren( const QString &str )
Otherwise returns FALSE.
*/
bool OContact::match( const QRegExp &r ) const
{
+ setLastHitField( -1 );
bool match;
match = false;
QMap<int, QString>::ConstIterator it;
for ( it = mMap.begin(); it != mMap.end(); ++it ) {
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
@@ -213,12 +213,8 @@ public:
// the emails should be seperated by a comma
void setEmails( const QString &v );
QString emails() const { return find( Qtopia::Emails ); }
static int rtti();
- int lastHitField() const {return m_lastHitField;};
-protected:
- mutable int m_lastHitField;
- void setLastHitField(int i) const { m_lastHitField = i; };
private:
// The XML-Backend needs some access to the private functions
friend class OContactAccessBackend_XML;
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
@@ -10,8 +10,9 @@ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
OPimRecord::OPimRecord( int uid )
: Qtopia::Record() {
+ m_lastHit = -1;
setUid( uid );
}
OPimRecord::~OPimRecord() {
}
@@ -23,8 +24,9 @@ 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;
}
/*
@@ -163,4 +165,10 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
par.setField( i );
return par;
}
+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
@@ -74,10 +74,18 @@ public:
/**
* matches the Records the regular expression?
*/
- virtual bool match( const QString &regexp ) const
- {return Qtopia::Record::match(QRegExp(regexp));};
+ virtual bool match( const QString &regexp ) 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
*/
@@ -120,8 +128,11 @@ public:
virtual bool loadFromStream(QDataStream& );
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;
private:
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
@@ -10,8 +10,9 @@ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
OPimRecord::OPimRecord( int uid )
: Qtopia::Record() {
+ m_lastHit = -1;
setUid( uid );
}
OPimRecord::~OPimRecord() {
}
@@ -23,8 +24,9 @@ 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;
}
/*
@@ -163,4 +165,10 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
par.setField( i );
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
@@ -74,10 +74,18 @@ public:
/**
* matches the Records the regular expression?
*/
- virtual bool match( const QString &regexp ) const
- {return Qtopia::Record::match(QRegExp(regexp));};
+ virtual bool match( const QString &regexp ) 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
*/
@@ -120,8 +128,11 @@ public:
virtual bool loadFromStream(QDataStream& );
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;
private:
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index aeb69ee..a7ca975 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -952,8 +952,9 @@ void OContact::setChildren( const QString &str )
Otherwise returns FALSE.
*/
bool OContact::match( const QRegExp &r ) const
{
+ setLastHitField( -1 );
bool match;
match = false;
QMap<int, QString>::ConstIterator it;
for ( it = mMap.begin(); it != mMap.end(); ++it ) {
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index f79f0f3..dd2de17 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -213,12 +213,8 @@ public:
// the emails should be seperated by a comma
void setEmails( const QString &v );
QString emails() const { return find( Qtopia::Emails ); }
static int rtti();
- int lastHitField() const {return m_lastHitField;};
-protected:
- mutable int m_lastHitField;
- void setLastHitField(int i) const { m_lastHitField = i; };
private:
// The XML-Backend needs some access to the private functions
friend class OContactAccessBackend_XML;