summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
Unidiff
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h37
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h53
-rw-r--r--libopie2/opiepim/core/opimtemplatebase.h57
3 files changed, 109 insertions, 38 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index 691ece2..bd85b4e 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -60,21 +60,38 @@ class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact>
60 Q_OBJECT 60 Q_OBJECT
61 61
62 public: 62 public:
63 /**
64 * Filter for sorted()
65 * @see SortFilterBase in OPimBase
66 */
63 enum SortFilter { 67 enum SortFilter {
64 DoNotShowNoneChildren = FilterCustom<<1, 68 /** Don't return entries who don't have children */
65 DoNotShowNoneAnniversary = FilterCustom<<2, 69 DoNotShowWithoutChildren = FilterCustom<<1,
66 DoNotShowNoneBirthday = FilterCustom<<3, 70 /** Don't return entries who don't have an anniversary */
67 DoNotShowNoHomeAddress = FilterCustom<<4, 71 DoNotShowWithoutAnniversary = FilterCustom<<2,
68 DoNotShowNoBusinessAddress = FilterCustom<<5 72 /** Don't return entries who don't have a birthday */
73 DoNotShowWithoutBirthday = FilterCustom<<3,
74 /** Don't return entries who don't have a home address */
75 DoNotShowWithoutHomeAddress = FilterCustom<<4,
76 /** Don't return entries who don't have a business address */
77 DoNotShowWithoutBusinessAddress = FilterCustom<<5,
78 /** Don't return entries which hava any category */
79 DoNotShowWithCategory = FilterCustom << 6
69 }; 80 };
70 81
82 /**
83 * Sort order for sorted()
84 * @see SortOrderBase in OPimBase
85 */
71 enum SortOrder { 86 enum SortOrder {
72 SortTitle = SortCustom, 87 SortTitle = SortCustom,
73 SortFirstName, 88 SortFirstName,
74 SortMiddleName, 89 SortMiddleName,
90 SortLastName,
75 SortSuffix, 91 SortSuffix,
76 SortEmail, 92 SortEmail,
77 SortNickname, 93 SortNickname,
94 SortFileAsName,
78 SortAnniversary, 95 SortAnniversary,
79 SortBirthday, 96 SortBirthday,
80 SortGender 97 SortGender
@@ -99,14 +116,18 @@ class OPimContactAccess: public QObject, public OPimAccessTemplate<OPimContact>
99 ~OPimContactAccess (); 116 ~OPimContactAccess ();
100 117
101 118
102 /** Return all possible settings. 119 /**
120 * Return all possible settings for queryByExample().
103 * @return All settings provided by the current backend 121 * @return All settings provided by the current backend
104 * (i.e.: query_WildCards & query_IgnoreCase) 122 * (i.e.: WildCards & IgnoreCase)
123 * @see QuerySettings in OPimBase for details of the parameter
105 */ 124 */
106 const uint querySettings(); 125 const uint querySettings();
107 126
108 /** Check whether settings are correct. 127 /**
128 * Check whether settings are correct for queryByExample().
109 * @return <i>true</i> if the given settings are correct and possible. 129 * @return <i>true</i> if the given settings are correct and possible.
130 * @see QuerySettings in OPimBase for details of the parameter
110 */ 131 */
111 bool hasQuerySettings ( int querySettings ) const; 132 bool hasQuerySettings ( int querySettings ) const;
112 133
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 2deb92a..073d5f9 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -90,15 +90,52 @@ public:
90 virtual T find( UID uid )const; 90 virtual T find( UID uid )const;
91 virtual T find( UID uid, const QArray<int>&, 91 virtual T find( UID uid, const QArray<int>&,
92 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; 92 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const;
93 virtual List sorted( const List&, bool ascending, int sortOrder, 93 //@}
94
95 /**
96 * Get sorted lists..
97 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
98 * @param list of UID's received by allRecords() or others...
99 * @param sortOrder Setting the sort order defined by enum SortOrder
100 * @param ascending Sort in ascending order if true, otherwise descending
101 * @param sortFilter Setting the sort filter defined by enum SortFilter
102 * @param cat number of category.
103 */
104 virtual List sorted( const List& list, bool ascending, int sortOrder,
94 int sortFilter, int cat )const; 105 int sortFilter, int cat )const;
95 virtual List sorted( const List&, bool ascending, int sortOrder, 106
107 /**
108 * Get sorted lists..
109 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
110 * @param list of UID's received by allRecords() or others...
111 * @param sortOrder Setting the sort order defined by enum SortOrder
112 * @param ascending Sort in ascending order if true, otherwise descending
113 * @param sortFilter Setting the sort filter defined by enum SortFilter
114 * @param cats List of categories.
115 */
116 virtual List sorted( const List& list, bool ascending, int sortOrder,
96 int sortFilter, const QArray<UID>& cats )const; 117 int sortFilter, const QArray<UID>& cats )const;
118
119 /**
120 * Get sorted lists..
121 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
122 * @param ascending Sort in ascending order if true, otherwise descending
123 * @param sortOrder Setting the sort order defined by enum SortOrder
124 * @param sortFilter Setting the sort filter defined by enum SortFilter
125 * @param cat number of category.
126 */
97 virtual List sorted( bool ascending, int sortOrder, int sortFilter, int cat )const; 127 virtual List sorted( bool ascending, int sortOrder, int sortFilter, int cat )const;
98 virtual List sorted( bool ascending, int sortOrder, int sortOrder,
99 const QArray<UID>& cats )const;
100 //@}
101 128
129 /**
130 * Get sorted lists..
131 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
132 * @param ascending Sort in ascending order if true, otherwise descending
133 * @param sortOrder Setting the sort order defined by enum SortOrder
134 * @param sortFilter Setting the sort filter defined by enum SortFilter
135 * @param cats List of categories.
136 */
137 virtual List sorted( bool ascending, int sortOrder, int sortFilter,
138 const QArray<UID>& cats )const;
102 /** 139 /**
103 * (Re)Implementation 140 * (Re)Implementation
104 */ 141 */
@@ -129,7 +166,6 @@ public:
129 //@} 166 //@}
130 167
131 void setReadAhead( uint count ); 168 void setReadAhead( uint count );
132 virtual T cacheFind( int uid )const;
133 void cache( const T& )const; 169 void cache( const T& )const;
134 void setSaneCacheSize( int ); 170 void setSaneCacheSize( int );
135 171
@@ -258,11 +294,6 @@ T OPimAccessTemplate<T>::find( UID uid ) const{
258 return t; 294 return t;
259} 295}
260 296
261template <class T>
262T OPimAccessTemplate<T>::cacheFind( int uid ) const
263{
264 return m_cache.find( uid );
265}
266 297
267/** 298/**
268 * read ahead cache find method ;) 299 * read ahead cache find method ;)
diff --git a/libopie2/opiepim/core/opimtemplatebase.h b/libopie2/opiepim/core/opimtemplatebase.h
index b238a68..c8abab4 100644
--- a/libopie2/opiepim/core/opimtemplatebase.h
+++ b/libopie2/opiepim/core/opimtemplatebase.h
@@ -80,6 +80,7 @@ struct OPimBase {
80 80
81 //@{ 81 //@{
82 virtual QArray<UID> records()const = 0; 82 virtual QArray<UID> records()const = 0;
83 //@}
83 84
84 /** Constants for query. 85 /** Constants for query.
85 * Use this constants to set the query parameters. 86 * Use this constants to set the query parameters.
@@ -87,40 +88,58 @@ struct OPimBase {
87 * @see queryByExample() 88 * @see queryByExample()
88 */ 89 */
89 enum QuerySettings { 90 enum QuerySettings {
90 WildCards = 0x0001, /** Use Wildcards */ 91 /** Use Wildcards */
91 IgnoreCase = 0x0002, /** Ignore the Case */ 92 WildCards = 0x0001,
92 RegExp = 0x0004, /** Do a Regular Expression match */ 93 /** Ignore the Case */
93 ExactMatch = 0x0008, /** It needs to exactly match */ 94 IgnoreCase = 0x0002,
94 MatchOne = 0x0010, /** Only one Entry must match */ 95 /** Do a Regular Expression match */
95 DateDiff = 0x0020, /** Find all entries from today until given date */ 96 RegExp = 0x0004,
96 DateYear = 0x0040, /** The year matches */ 97 /** It needs to exactly match */
97 DateMonth = 0x0080, /** The month matches */ 98 ExactMatch = 0x0008,
98 DateDay = 0x0100, /** The day matches */ 99 /** Only one Entry must match */
99 LastItem = 0xffff /** the last possible name */ 100 MatchOne = 0x0010,
101 /** Find all entries from today until given date */
102 DateDiff = 0x0020,
103 /** The year matches */
104 DateYear = 0x0040,
105 /** The month matches */
106 DateMonth = 0x0080,
107 /** The day matches */
108 DateDay = 0x0100,
109 /** The last possible name matches */
110 LastItem = 0xffff
100 }; 111 };
101 112
102 /** 113 /**
103 * Common Attributes for the Sort Order 114 * Common Attributes for the Sort Order
104 */ 115 */
105 enum SortOrderBase { 116 enum SortOrderBase {
106 SortSummary = 0, /** Sort by a Summary of the records */ 117 /** Sort by a Summary of the records */
107 SortByCategory = 1, /** Sort by Category */ 118 SortSummary = 0,
108 SortByDate = 2, /** Sort by Date */ 119 /** Sort by Category */
109 SortCustom = 10, /** The First available sort number for the OPimAccessTemplates */ 120 SortByCategory = 1,
110 LastSortOrderBase = 0xffff /** make this enum 16bit large */ 121 /** Sort by Date */
122 SortByDate = 2,
123 /** The First available sort number for the OPimAccessTemplates */
124 SortCustom = 10,
125 /** make this enum 16bit large */
126 LastSortOrderBase = 0xffff
111 }; 127 };
112 128
113 /** 129 /**
114 * Sort with the help of the \sa sorted function 130 * Sort a list of Items with the help of the sorted() function.
115 * a list of Items.
116 * The Item you provide in SortOrder will be used 131 * The Item you provide in SortOrder will be used
117 * for sorting. 132 * for sorting.
118 * 133 *
119 * @see sorted 134 * @see OPimAccessTemplate<>::sorted()
120 */ 135 */
121 enum SortFilterBase { 136 enum SortFilterBase {
137 /** Do not filter anything. */
138 FilterOff = 0,
139 /** Use given Categories for filter */
122 FilterCategory = 1, 140 FilterCategory = 1,
123 FilterCustom = 1024, 141 /** The first available custom filter defined in the specialized frontends */
142 FilterCustom = 1024,
124 LastSortFilterBase = 0xffffffff 143 LastSortFilterBase = 0xffffffff
125 }; 144 };
126 145