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.1 2004/11/16 21:46:07 mickeyl Exp $ 00017 * ===================================================================== 00018 * History: 00019 * $Log: ocontactaccess.h,v $ 00020 * Revision 1.1 2004/11/16 21:46:07 mickeyl 00021 * libopie1 goes into unsupported 00022 * 00023 * Revision 1.10 2003/12/22 10:19:26 eilers 00024 * Finishing implementation of sql-backend for datebook. But I have to 00025 * port the PIM datebook application to use it, before I could debug the 00026 * whole stuff. 00027 * Thus, PIM-Database backend is finished, but highly experimental. And some 00028 * parts are still generic. For instance, the "queryByExample()" methods are 00029 * not (or not fully) implemented. Todo: custom-entries not stored. 00030 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular 00031 * expression search in the database, which is not supported by sqlite ! 00032 * Therefore we need either an extended sqlite or a workaround which would 00033 * be very slow and memory consuming.. 00034 * 00035 * Revision 1.9 2003/08/01 12:30:16 eilers 00036 * Merging changes from BRANCH_1_0 to HEAD 00037 * 00038 * Revision 1.8.2.1 2003/06/30 14:34:19 eilers 00039 * Patches from Zecke: 00040 * Fixing and cleaning up extraMap handling 00041 * Adding d_ptr for binary compatibility in the future 00042 * 00043 * Revision 1.8 2003/05/08 13:55:09 tille 00044 * search stuff 00045 * and match, toRichText & toShortText in oevent 00046 * 00047 * Revision 1.7 2003/04/13 18:07:10 zecke 00048 * More API doc 00049 * QString -> const QString& 00050 * QString = 0l -> QString::null 00051 * 00052 * Revision 1.6 2003/01/02 14:27:12 eilers 00053 * Improved query by example: Search by date is possible.. First step 00054 * for a today plugin for birthdays.. 00055 * 00056 * Revision 1.5 2002/11/13 14:14:51 eilers 00057 * Added sorted for Contacts.. 00058 * 00059 * Revision 1.4 2002/11/01 15:10:42 eilers 00060 * Added regExp-search in database for all fields in a contact. 00061 * 00062 * Revision 1.3 2002/10/16 10:52:40 eilers 00063 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 00064 * 00065 * Revision 1.2 2002/10/14 16:21:54 eilers 00066 * Some minor interface updates 00067 * 00068 * Revision 1.1 2002/09/27 17:11:44 eilers 00069 * Added API for accessing the Contact-Database ! It is compiling, but 00070 * please do not expect that anything is working ! 00071 * I will debug that stuff in the next time .. 00072 * Please read README_COMPILE for compiling ! 00073 * 00074 * ===================================================================== 00075 */ 00076 #ifndef _OCONTACTACCESS_H 00077 #define _OCONTACTACCESS_H 00078 00079 #include <qobject.h> 00080 00081 #include <qpe/qcopenvelope_qws.h> 00082 00083 #include <qvaluelist.h> 00084 #include <qfileinfo.h> 00085 00086 #include "ocontact.h" 00087 #include "ocontactaccessbackend.h" 00088 #include "opimaccesstemplate.h" 00089 00099 class OContactAccess: public QObject, public OPimAccessTemplate<OContact> 00100 { 00101 Q_OBJECT 00102 00103 public: 00118 OContactAccess (const QString appname, const QString filename = 0l, 00119 OContactAccessBackend* backend = 0l, bool handlesync = true); 00120 ~OContactAccess (); 00121 00127 enum QuerySettings { 00128 WildCards = 0x0001, 00129 IgnoreCase = 0x0002, 00130 RegExp = 0x0004, 00131 ExactMatch = 0x0008, 00132 MatchOne = 0x0010, // Only one Entry must match 00133 DateDiff = 0x0020, // Find all entries from today until given date 00134 DateYear = 0x0040, // The year matches 00135 DateMonth = 0x0080, // The month matches 00136 DateDay = 0x0100, // The day matches 00137 }; 00138 00139 00146 List sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const; 00147 00152 const uint querySettings(); 00153 00157 bool hasQuerySettings ( int querySettings ) const; 00158 00163 bool wasChangedExternally()const; 00164 00165 00170 bool save(); 00171 00172 signals: 00173 /* Signal is emitted if the database was changed. Therefore 00174 * we may need to reload to stay consistent. 00175 * @param which Pointer to the database who created this event. This pointer 00176 * is useful if an application has to handle multiple databases at the same time. 00177 * @see reload() 00178 */ 00179 void signalChanged ( const OContactAccess *which ); 00180 00181 00182 private: 00183 // class OContactAccessPrivate; 00184 // OContactAccessPrivate* d; 00185 OContactAccessBackend *m_backEnd; 00186 bool m_loading:1; 00187 00188 private slots: 00189 void copMessage( const QCString &msg, const QByteArray &data ); 00190 00191 private: 00192 class Private; 00193 Private *d; 00194 00195 }; 00196 #endif
1.4.2