summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ChangeLog3
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp1
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.cpp2
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.h2
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp9
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h15
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h43
7 files changed, 40 insertions, 35 deletions
diff --git a/libopie2/opiepim/ChangeLog b/libopie2/opiepim/ChangeLog
index 2007744..320b189 100644
--- a/libopie2/opiepim/ChangeLog
+++ b/libopie2/opiepim/ChangeLog
@@ -1,12 +1,15 @@
+2005-01-03 Stefan Eilers <stefan@eilers-online.net>
+ * Fixing bug in API documentation
+ * Moving hasQuerySettings() and querySettings() to OPimAccessTemplate to be available for all frontends
2004-12-28 Stefan Eilers <stefan@eilers-online.net>
* Make improved query by example accessable via frontend
* Some API documentation improvement
* Cleanup of backend api..
* Fixing bug #1501
2004-11-23 Stefan Eilers <stefan@eilers-online.net>
* 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
2004-11-18 Holger Freyther <freyther@handhelds.org>
* Every Access can give a set of Occurrences for a period or a datetime
* QueryByExample, Find, Sort can be generically accessed by OPimBase
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index 41b714e..629e4da 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -199,24 +199,25 @@ bool ODateBookAccessBackend_SQL::reload()
bool ODateBookAccessBackend_SQL::save()
{
return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers)
}
QArray<int> ODateBookAccessBackend_SQL::allRecords()const
{
return m_uids;
}
QArray<int> ODateBookAccessBackend_SQL::queryByExample(const OPimEvent&, int, const QDateTime& ) {
+ qDebug( "Accessing ODateBookAccessBackend_SQL::queryByExample() which is not implemented!" );
return QArray<int>();
}
void ODateBookAccessBackend_SQL::clear()
{
QString qu = "drop table datebook;";
qu += "drop table custom_data;";
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
reload();
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.cpp b/libopie2/opiepim/backend/otodoaccessbackend.cpp
index f979976..c7ce123 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.cpp
+++ b/libopie2/opiepim/backend/otodoaccessbackend.cpp
@@ -45,25 +45,25 @@ OPimTodoAccessBackend::~OPimTodoAccessBackend() {
const uint OPimTodoAccessBackend::querySettings() const
{
return 0;
}
bool OPimTodoAccessBackend::hasQuerySettings (uint querySettings) const
{
return false;
}
UIDArray OPimTodoAccessBackend::queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings,
- const QDateTime& endperiod )const
+ const QDateTime& startperiod )const
{
qDebug( "Accessing OPimTodoAccessBackend::queryByExample() which is not implemented!" );
return UIDArray();
// odebug << "Using Unaccelerated OPimContactAccessBackend implementation of queryByExample!" << oendl;
// UIDArray m_currentQuery( uid_array.count() );
// uint arraycounter = 0;
// for( uint it = 0; it < uid_array.count(); ++it ){
// /* Search all fields and compare them with query object. Store them into list
// * if all fields matches.
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h
index 870ee57..06cece3 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.h
+++ b/libopie2/opiepim/backend/otodoaccessbackend.h
@@ -55,25 +55,25 @@ public:
* Return all possible settings.
* @return All settings provided by the current backend
* (i.e.: query_WildCards & query_IgnoreCase)
*/
const uint querySettings() const;
/**
* Check whether settings are correct.
* @return <i>true</i> if the given settings are correct and possible.
*/
bool hasQuerySettings (uint querySettings) const;
- UIDArray queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings, const QDateTime& endperiod = QDateTime() )const;
+ UIDArray queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings, const QDateTime& startperiod = QDateTime() )const;
UIDArray sorted( const UIDArray&, bool asc, int, int, const QArray<int>& )const;
OPimBackendOccurrence::List occurrences( const QDate&, const QDate& )const;
//@}
private:
class Private;
Private *d;
};
}
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 9bbc820..9d18d47 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -109,33 +109,24 @@ bool OPimContactAccess::save ()
reload();
bool status = OPimAccessTemplate<OPimContact>::save();
if ( !status ) return false;
/* Now tell everyone that new data is available.
*/
QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
return true;
}
-const uint OPimContactAccess::querySettings()
-{
- return ( m_backEnd->querySettings() );
-}
-
-bool OPimContactAccess::hasQuerySettings ( int querySettings ) const
-{
- return ( m_backEnd->hasQuerySettings ( querySettings ) );
-}
#if 0
OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
{
QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
return ( OPimRecordList<OPimContact>(matchingContacts, this) );
}
#endif
bool OPimContactAccess::wasChangedExternally()const
{
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index 5051321..9a2ecaf 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -107,39 +107,24 @@ class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact>
* the default backend.
* @param handlesync If <b>true</b> the database stores the current state
* automatically if it receives the signals <i>flush()</i> and <i>reload()</i>
* which are used before and after synchronisation. If the application wants
* to react itself, it should be disabled by setting it to <b>false</b>
* @see OPimContactAccessBackend
*/
OPimContactAccess (const QString appname, const QString filename = 0l,
OPimContactAccessBackend* backend = 0l, bool handlesync = true);
~OPimContactAccess ();
- /**
- * Return all possible settings for queryByExample().
- * @return All settings provided by the current backend
- * (i.e.: WildCards & IgnoreCase)
- * @see QuerySettings in OPimBase for details of the parameter, queryByExample()
- */
- const uint querySettings();
-
- /**
- * Check whether settings are correct for queryByExample().
- * @return <i>true</i> if the given settings are correct and possible.
- * @see QuerySettings in OPimBase for details of the parameter
- */
- bool hasQuerySettings ( int querySettings ) const;
-
/**
* if the resource was changed externally.
* You should use the signal instead of polling possible changes !
*/
bool wasChangedExternally()const;
/** Save contacts database.
* Save is more a "commit". After calling this function, all changes are public available.
* @return true if successful
*/
bool save();
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 3875f09..823f03d 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -78,63 +78,78 @@ public:
virtual bool reload();
bool save();
void clear() ;
//@}
bool wasChangedExternally()const;
//@{
virtual List allRecords()const;
virtual List matchRegexp( const QRegExp &r ) const;
+ /**
+ * Return all possible settings for queryByExample().
+ * @return All settings provided by the current backend
+ * (i.e.: WildCards & IgnoreCase)
+ * @see QuerySettings in OPimBase for details of the parameter, queryByExample()
+ */
+ const uint querySettings();
+
+ /**
+ * Check whether settings are correct for queryByExample().
+ * @return <i>true</i> if the given settings are correct and possible.
+ * @see QuerySettings in OPimBase for details of the parameter
+ */
+ bool hasQuerySettings ( int querySettings ) const;
+
/**
* Query by example search interface.
* "Query by Example" provides a very powerful search engine. Use the query object
* (this may be a contact, a todo or databook event)
* as a search mask which is converted into a query regarding the querySettings. If a time period is needed
- * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the endperiod (the last parameter).
+ * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the startperiod (the last parameter).
* @see QuerySettings in class OPimBase
* @param query The object which contains the query set
* @param querySettings This parameter defines what should be searched and how the query should be interpreted
- * @param endperiod Defines the end of a period for some special queries.
+ * @param startperiod Defines the start of a period for some special queries.
*/
- virtual List queryByExample( const T& query, int querySettings, const QDateTime& endperiod = QDateTime() );
+ virtual List queryByExample( const T& query, int querySettings, const QDateTime& startperiod = QDateTime() );
/**
* Generic query by example search interface. This is a special version which handles generic OPimRecord types. They are converted
* automatically into the right datatype.
* "Query by Example" provides a very powerful search engine. Use the query object (this may be a contact, a todo or databook event)
* as a search mask which is converted into a query regarding the querySettings. If a time period is needed
- * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the endperiod (the last parameter).
+ * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the startperiod (the last parameter).
* @see QuerySettings in class OPimBase
* @param query The object which contains the query set
* @param querySettings This parameter defines what should be searched and how the query should be interpreted
- * @param endperiod Defines the end of a period for some special queries.
+ * @param startperiod Defines the start of a period for some special queries.
*/
- virtual List queryByExample( const OPimRecord* query, int querySettings, const QDateTime& endperiod = QDateTime() );
+ virtual List queryByExample( const OPimRecord* query, int querySettings, const QDateTime& startperiod = QDateTime() );
/**
* Incremental query by example search interface. Providing incremental search, this one provides the feature
* to search in a list of records which may be returned by an other search.
* "Query by Example" provides a very powerful search engine. Use the query object (this may be a contact, a todo or databook event)
* as a search mask which is converted into a query regarding the querySettings. If a time period is needed
- * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the endperiod (the last parameter).
+ * (as for OpimBase::DateDiff), you have to use the date/time in the query object and the startperiod (the last parameter).
* @see QuerySettings in class OPimBase
* @param uidlist List of uid's which should be incorporated into the next search
* @param query The object which contains the query set
* @param querySettings This parameter defines what should be searched and how the query should be interpreted
- * @param endperiod Defines the end of a period for some special queries.
+ * @param startperiod Defines the start of a period for some special queries.
*/
virtual List queryByExample( const OPimAccessTemplate::List& uidlist, const T& query, int querySettings,
- const QDateTime& endperiod = QDateTime() );
+ const QDateTime& startperiod = QDateTime() );
virtual T find( UID uid )const;
virtual T find( UID uid, const QArray<int>&,
uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const;
//@}
/**
* Get sorted lists..
* @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
* @param list of UID's received by allRecords() or others...
* @param sortOrder Setting the sort order defined by enum SortOrder
* @param ascending Sort in ascending order if true, otherwise descending
@@ -299,24 +314,34 @@ typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const Q
List lis(ints, this );
return lis;
}
/**
* find the OPimRecord uid
*/
template <class T>
QArray<int> OPimAccessTemplate<T>::records()const {
return m_backEnd->allRecords();
}
+template <class T>
+const uint OPimAccessTemplate<T>::querySettings(){
+ return m_backEnd->querySettings();
+}
+
+template <class T>
+bool OPimAccessTemplate<T>::hasQuerySettings ( int querySettings ) const {
+ return m_backEnd->hasQuerySettings( querySettings );
+}
+
template <class T>
typename OPimAccessTemplate<T>::List
OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) {
QArray<int> ints = m_backEnd->queryByExample( t, settings, d );
List list(ints, this );
return list;
}
template <class T>
typename OPimAccessTemplate<T>::List