ocontactaccess.h
Go to the documentation of this file.00001 /* 00002 * Class to manage the Contacts. 00003 * 00004 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 00005 * Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org) 00006 * 00007 * ===================================================================== 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; 00011 * either version 2 of the License, or (at your option) any later 00012 * version. 00013 * ===================================================================== 00014 * ToDo: Define enum for query settings 00015 * ===================================================================== 00016 * Version: $Id: ocontactaccess.h,v 1.10 2003/12/22 10:19:26 eilers Exp $ 00017 * ===================================================================== 00018 * History: 00019 * $Log: ocontactaccess.h,v $ 00020 * Revision 1.10 2003/12/22 10:19:26 eilers 00021 * Finishing implementation of sql-backend for datebook. But I have to 00022 * port the PIM datebook application to use it, before I could debug the 00023 * whole stuff. 00024 * Thus, PIM-Database backend is finished, but highly experimental. And some 00025 * parts are still generic. For instance, the "queryByExample()" methods are 00026 * not (or not fully) implemented. Todo: custom-entries not stored. 00027 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular 00028 * expression search in the database, which is not supported by sqlite ! 00029 * Therefore we need either an extended sqlite or a workaround which would 00030 * be very slow and memory consuming.. 00031 * 00032 * Revision 1.9 2003/08/01 12:30:16 eilers 00033 * Merging changes from BRANCH_1_0 to HEAD 00034 * 00035 * Revision 1.8.2.1 2003/06/30 14:34:19 eilers 00036 * Patches from Zecke: 00037 * Fixing and cleaning up extraMap handling 00038 * Adding d_ptr for binary compatibility in the future 00039 * 00040 * Revision 1.8 2003/05/08 13:55:09 tille 00041 * search stuff 00042 * and match, toRichText & toShortText in oevent 00043 * 00044 * Revision 1.7 2003/04/13 18:07:10 zecke 00045 * More API doc 00046 * QString -> const QString& 00047 * QString = 0l -> QString::null 00048 * 00049 * Revision 1.6 2003/01/02 14:27:12 eilers 00050 * Improved query by example: Search by date is possible.. First step 00051 * for a today plugin for birthdays.. 00052 * 00053 * Revision 1.5 2002/11/13 14:14:51 eilers 00054 * Added sorted for Contacts.. 00055 * 00056 * Revision 1.4 2002/11/01 15:10:42 eilers 00057 * Added regExp-search in database for all fields in a contact. 00058 * 00059 * Revision 1.3 2002/10/16 10:52:40 eilers 00060 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 00061 * 00062 * Revision 1.2 2002/10/14 16:21:54 eilers 00063 * Some minor interface updates 00064 * 00065 * Revision 1.1 2002/09/27 17:11:44 eilers 00066 * Added API for accessing the Contact-Database ! It is compiling, but 00067 * please do not expect that anything is working ! 00068 * I will debug that stuff in the next time .. 00069 * Please read README_COMPILE for compiling ! 00070 * 00071 * ===================================================================== 00072 */ 00073 #ifndef _OCONTACTACCESS_H 00074 #define _OCONTACTACCESS_H 00075 00076 #include <qobject.h> 00077 00078 #include <qpe/qcopenvelope_qws.h> 00079 00080 #include <qvaluelist.h> 00081 #include <qfileinfo.h> 00082 00083 #include "ocontact.h" 00084 #include "ocontactaccessbackend.h" 00085 #include "opimaccesstemplate.h" 00086 00096 class OContactAccess: public QObject, public OPimAccessTemplate<OContact> 00097 { 00098 Q_OBJECT 00099 00100 public: 00115 OContactAccess (const QString appname, const QString filename = 0l, 00116 OContactAccessBackend* backend = 0l, bool handlesync = true); 00117 ~OContactAccess (); 00118 00124 enum QuerySettings { 00125 WildCards = 0x0001, 00126 IgnoreCase = 0x0002, 00127 RegExp = 0x0004, 00128 ExactMatch = 0x0008, 00129 MatchOne = 0x0010, // Only one Entry must match 00130 DateDiff = 0x0020, // Find all entries from today until given date 00131 DateYear = 0x0040, // The year matches 00132 DateMonth = 0x0080, // The month matches 00133 DateDay = 0x0100, // The day matches 00134 }; 00135 00136 00143 List sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const; 00144 00149 const uint querySettings(); 00150 00154 bool hasQuerySettings ( int querySettings ) const; 00155 00160 bool wasChangedExternally()const; 00161 00162 00167 bool save(); 00168 00169 signals: 00170 /* Signal is emitted if the database was changed. Therefore 00171 * we may need to reload to stay consistent. 00172 * @param which Pointer to the database who created this event. This pointer 00173 * is useful if an application has to handle multiple databases at the same time. 00174 * @see reload() 00175 */ 00176 void signalChanged ( const OContactAccess *which ); 00177 00178 00179 private: 00180 // class OContactAccessPrivate; 00181 // OContactAccessPrivate* d; 00182 OContactAccessBackend *m_backEnd; 00183 bool m_loading:1; 00184 00185 private slots: 00186 void copMessage( const QCString &msg, const QByteArray &data ); 00187 00188 private: 00189 class Private; 00190 Private *d; 00191 00192 }; 00193 #endif
