Diffstat (limited to 'libopie2/opiepim/core/ocontactaccess.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.h | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h index 4429b6f..691ece2 100644 --- a/libopie2/opiepim/core/ocontactaccess.h +++ b/libopie2/opiepim/core/ocontactaccess.h | |||
@@ -51,67 +51,62 @@ namespace Opie { | |||
51 | * This is just a frontend for the real database handling which is | 51 | * This is just a frontend for the real database handling which is |
52 | * done by the backend. | 52 | * done by the backend. |
53 | * This class is used to access the Contacts on a system. This class as any OPIE PIM | 53 | * This class is used to access the Contacts on a system. This class as any OPIE PIM |
54 | * class is backend independent. | 54 | * class is backend independent. |
55 | * @author Stefan Eilers, Holger Freyther | 55 | * @author Stefan Eilers, Holger Freyther |
56 | * @see OPimAccessTemplate | 56 | * @see OPimAccessTemplate |
57 | */ | 57 | */ |
58 | class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact> | 58 | class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact> |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | 61 | ||
62 | public: | 62 | public: |
63 | enum SortFilter { | ||
64 | DoNotShowNoneChildren = FilterCustom<<1, | ||
65 | DoNotShowNoneAnniversary = FilterCustom<<2, | ||
66 | DoNotShowNoneBirthday = FilterCustom<<3, | ||
67 | DoNotShowNoHomeAddress = FilterCustom<<4, | ||
68 | DoNotShowNoBusinessAddress = FilterCustom<<5 | ||
69 | }; | ||
70 | |||
71 | enum SortOrder { | ||
72 | SortTitle = SortCustom, | ||
73 | SortFirstName, | ||
74 | SortMiddleName, | ||
75 | SortSuffix, | ||
76 | SortEmail, | ||
77 | SortNickname, | ||
78 | SortAnniversary, | ||
79 | SortBirthday, | ||
80 | SortGender | ||
81 | }; | ||
82 | |||
63 | /** | 83 | /** |
64 | * Create Database with contacts (addressbook). | 84 | * Create Database with contacts (addressbook). |
65 | * @param appname Name of application which wants access to the database | 85 | * @param appname Name of application which wants access to the database |
66 | * (i.e. "todolist") | 86 | * (i.e. "todolist") |
67 | * @param filename The name of the database file. If not set, the default one | 87 | * @param filename The name of the database file. If not set, the default one |
68 | * is used. | 88 | * is used. |
69 | * @param backend Pointer to an alternative Backend. If not set, we will use | 89 | * @param backend Pointer to an alternative Backend. If not set, we will use |
70 | * the default backend. | 90 | * the default backend. |
71 | * @param handlesync If <b>true</b> the database stores the current state | 91 | * @param handlesync If <b>true</b> the database stores the current state |
72 | * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> | 92 | * automatically if it receives the signals <i>flush()</i> and <i>reload()</i> |
73 | * which are used before and after synchronisation. If the application wants | 93 | * which are used before and after synchronisation. If the application wants |
74 | * to react itself, it should be disabled by setting it to <b>false</b> | 94 | * to react itself, it should be disabled by setting it to <b>false</b> |
75 | * @see OPimContactAccessBackend | 95 | * @see OPimContactAccessBackend |
76 | */ | 96 | */ |
77 | OPimContactAccess (const QString appname, const QString filename = 0l, | 97 | OPimContactAccess (const QString appname, const QString filename = 0l, |
78 | OPimContactAccessBackend* backend = 0l, bool handlesync = true); | 98 | OPimContactAccessBackend* backend = 0l, bool handlesync = true); |
79 | ~OPimContactAccess (); | 99 | ~OPimContactAccess (); |
80 | 100 | ||
81 | /** Constants for query. | ||
82 | * Use this constants to set the query parameters. | ||
83 | * Note: <i>query_IgnoreCase</i> just make sense with one of the other attributes ! | ||
84 | * @see queryByExample() | ||
85 | */ | ||
86 | enum QuerySettings { | ||
87 | WildCards = 0x0001, | ||
88 | IgnoreCase = 0x0002, | ||
89 | RegExp = 0x0004, | ||
90 | ExactMatch = 0x0008, | ||
91 | MatchOne = 0x0010, // Only one Entry must match | ||
92 | DateDiff = 0x0020, // Find all entries from today until given date | ||
93 | DateYear = 0x0040, // The year matches | ||
94 | DateMonth = 0x0080, // The month matches | ||
95 | DateDay = 0x0100, // The day matches | ||
96 | }; | ||
97 | |||
98 | |||
99 | /** Return all Contacts in a sorted manner. | ||
100 | * @param ascending true: Sorted in acending order. | ||
101 | * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess | ||
102 | * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess | ||
103 | * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess | ||
104 | */ | ||
105 | List sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const; | ||
106 | 101 | ||
107 | /** Return all possible settings. | 102 | /** Return all possible settings. |
108 | * @return All settings provided by the current backend | 103 | * @return All settings provided by the current backend |
109 | * (i.e.: query_WildCards & query_IgnoreCase) | 104 | * (i.e.: query_WildCards & query_IgnoreCase) |
110 | */ | 105 | */ |
111 | const uint querySettings(); | 106 | const uint querySettings(); |
112 | 107 | ||
113 | /** Check whether settings are correct. | 108 | /** Check whether settings are correct. |
114 | * @return <i>true</i> if the given settings are correct and possible. | 109 | * @return <i>true</i> if the given settings are correct and possible. |
115 | */ | 110 | */ |
116 | bool hasQuerySettings ( int querySettings ) const; | 111 | bool hasQuerySettings ( int querySettings ) const; |
117 | 112 | ||
@@ -135,26 +130,24 @@ class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact> | |||
135 | 130 | ||
136 | signals: | 131 | signals: |
137 | /* Signal is emitted if the database was changed. Therefore | 132 | /* Signal is emitted if the database was changed. Therefore |
138 | * we may need to reload to stay consistent. | 133 | * we may need to reload to stay consistent. |
139 | * @param which Pointer to the database who created this event. This pointer | 134 | * @param which Pointer to the database who created this event. This pointer |
140 | * is useful if an application has to handle multiple databases at the same time. | 135 | * is useful if an application has to handle multiple databases at the same time. |
141 | * @see reload() | 136 | * @see reload() |
142 | */ | 137 | */ |
143 | void signalChanged ( const OPimContactAccess *which ); | 138 | void signalChanged ( const OPimContactAccess *which ); |
144 | 139 | ||
145 | 140 | ||
146 | private: | 141 | private: |
147 | // class OPimContactAccessPrivate; | ||
148 | // OPimContactAccessPrivate* d; | ||
149 | OPimContactAccessBackend *m_backEnd; | 142 | OPimContactAccessBackend *m_backEnd; |
150 | bool m_loading:1; | 143 | bool m_loading:1; |
151 | 144 | ||
152 | private slots: | 145 | private slots: |
153 | void copMessage( const QCString &msg, const QByteArray &data ); | 146 | void copMessage( const QCString &msg, const QByteArray &data ); |
154 | 147 | ||
155 | private: | 148 | private: |
156 | class Private; | 149 | class Private; |
157 | Private *d; | 150 | Private *d; |
158 | 151 | ||
159 | }; | 152 | }; |
160 | 153 | ||