summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp13
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h6
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h12
-rw-r--r--libopie2/opiepim/core/opimrecord.h6
4 files changed, 28 insertions, 9 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 9c9338e..2e3ec1f 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -18,12 +18,16 @@
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.8 2003/05/08 13:55:09 tille
+ * search stuff
+ * and match, toRichText & toShortText in oevent
+ *
* Revision 1.7 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.6 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
@@ -70,23 +74,23 @@
OContactAccess::OContactAccess ( const QString appname, const QString ,
OContactAccessBackend* end, bool autosync ):
OPimAccessTemplate<OContact>( end )
{
- /* take care of the backend. If there is no one defined, we
+ /* take care of the backend. If there is no one defined, we
* will use the XML-Backend as default (until we have a cute SQL-Backend..).
*/
if( end == 0 ) {
qWarning ("Using BackendFactory !");
end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
}
// Set backend locally and in template
m_backEnd = end;
OPimAccessTemplate<OContact>::setBackEnd (end);
-
+
/* Connect signal of external db change to function */
QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(copMessage( const QCString &, const QByteArray &)) );
if ( autosync ){
@@ -123,17 +127,12 @@ bool OContactAccess::save ()
*/
QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
return true;
}
-ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{
- QArray<int> matchingContacts = m_backEnd -> matchRegexp( r );
- return ( ORecordList<OContact>(matchingContacts, this) );
-}
-
const uint OContactAccess::querySettings()
{
return ( m_backEnd->querySettings() );
}
bool OContactAccess::hasQuerySettings ( int querySettings ) const
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index d7ceaf2..e90db32 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -14,12 +14,16 @@
* ToDo: Define enum for query settings
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.8 2003/05/08 13:55:09 tille
+ * search stuff
+ * and match, toRichText & toShortText in oevent
+ *
* Revision 1.7 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.6 2003/01/02 14:27:12 eilers
@@ -107,14 +111,12 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
DateYear = 0x0040, // The year matches
DateMonth = 0x0080, // The month matches
DateDay = 0x0100, // The day matches
};
- ORecordList<OContact> matchRegexp( const QRegExp &r )const;
-
/** Return all Contacts in a sorted manner.
* @param ascending true: Sorted in acending order.
* @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess
* @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess
* @param cat Currently not implemented. Just defined to stay compatible to otodoaccess
*/
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 6a3a0db..8ff205c 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -66,12 +66,18 @@ public:
/**
* return a List of records
* you can iterate over them
*/
virtual List allRecords()const;
+
+ /**
+ * return a List of records
+ * that match the regex
+ */
+ virtual List matchRegexp( const QRegExp &r ) const;
/**
* queryByExample.
* @see otodoaccess, ocontactaccess
*/
virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() );
@@ -178,12 +184,18 @@ template <class T>
typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
QArray<int> ints = m_backEnd->allRecords();
List lis(ints, this );
return lis;
}
template <class T>
+typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const {
+ QArray<int> ints = m_backEnd->matchRegexp( r );
+ List lis(ints, this );
+ return lis;
+}
+template <class T>
QArray<int> OPimAccessTemplate<T>::records()const {
return m_backEnd->allRecords();
}
template <class T>
typename OPimAccessTemplate<T>::List
OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) {
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index c7f9460..de2d9f4 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -70,12 +70,18 @@ public:
/**
* the name of the Record
*/
virtual QString type()const = 0;
/**
+ * matches the Records the regular expression?
+ */
+ virtual bool match( const QString &regexp ) const {return match(QRegExp(regexp));};
+ virtual bool match( const QRegExp &regexp ) const = 0;
+
+ /**
* converts the internal structure to a map
*/
virtual QMap<int, QString> toMap()const = 0;
/**
* key value representation of extra items