From 18e47153532d016d878f47e0ce11cb1a9716218e Mon Sep 17 00:00:00 2001 From: eilers Date: Mon, 20 Dec 2004 14:14:07 +0000 Subject: Recovery of the following Changes: * Implement fast and full featured version of sorted() for addressbook * Implement generic queryByExample for all Addressboook backends. It allows incremental search. * Update of API Documentation --- (limited to 'libopie2/opiepim/backend/opimaccessbackend.h') diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index 0d112c9..7321758 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h @@ -66,13 +66,34 @@ public: virtual void clear() = 0; //@} + //@{ + // FIXME: Uncommented some of the abstract functions below. This should be removed as they are implemented in + // all typespecifc backenends (eilers) + /** + * Return all possible settings for queryByExample() + * @return All settings provided by the current backend + * (i.e.: query_WildCards & query_IgnoreCase) + * See implementation in the specific backends for contacts, todo and dates. + */ + virtual const uint querySettings() const { return 0; } /* FIXME: Make Abstrakt !! = 0; */ + + /** + * Check whether settings are correct for queryByExample() + * See implementation in the specific backends for OPimContactAccess, OPimTodoAccess and ODateBookAccess. + * @return true if the given settings are correct and possible. + */ + virtual bool hasQuerySettings (uint querySettings) const { return false; } /* FIXME: Make Abstrakt !! = 0; */ + //@} + //@{ virtual UIDArray allRecords()const = 0; virtual UIDArray matchRegexp(const QRegExp &r) const; - virtual UIDArray queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() )const = 0; - virtual UIDArray queryByExample( const OPimRecord* rec, int, const QDateTime& d = QDateTime() )const; - virtual UIDArray sorted( const UIDArray&, bool asc, int sortOrder, int sortFilter, const QArray& cats )const; + virtual UIDArray queryByExample( const UIDArray&, const T& t, + int settings, const QDateTime& d = QDateTime() )const { return UIDArray(); } /* FIXME: Make Abstrakt !! = 0; */ + virtual UIDArray queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() )const; + virtual UIDArray queryByExample( const OPimRecord* rec, int settings, const QDateTime& d = QDateTime() )const; + virtual UIDArray sorted( const UIDArray&, bool asc, int sortOrder, int sortFilter, const QArray& cats )const = 0; virtual UIDArray sorted( bool asc, int sortOrder, int sortFilter, const QArray& cats )const; virtual OPimBackendOccurrence::List occurrences( const QDate& start, const QDate& end)const; virtual OPimBackendOccurrence::List occurrences( const QDateTime& dt )const; @@ -150,6 +171,13 @@ UIDArray OPimAccessBackend::matchRegexp( const QRegExp& reg )const { } template +UIDArray OPimAccessBackend::queryByExample( const T& rec, int settings, + const QDateTime& datetime )const { + + return queryByExample( allRecords(), rec, settings, datetime ); +} + +template UIDArray OPimAccessBackend::queryByExample( const OPimRecord* rec, int settings, const QDateTime& datetime )const { T* tmp_rec = T::safeCast( rec ); @@ -161,12 +189,6 @@ UIDArray OPimAccessBackend::queryByExample( const OPimRecord* rec, int settin } template -UIDArray OPimAccessBackend::sorted( const UIDArray& ids, bool, - int, int, const QArray& ) const { - return ids; -} - -template UIDArray OPimAccessBackend::sorted( bool asc, int order, int filter, const QArray& cats )const { return sorted( allRecords(), asc, order, filter, cats ); -- cgit v0.9.0.2