diff options
Diffstat (limited to 'common/domain/typeimplementations.cpp')
-rw-r--r-- | common/domain/typeimplementations.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp index d6b5b76..c74701d 100644 --- a/common/domain/typeimplementations.cpp +++ b/common/domain/typeimplementations.cpp | |||
@@ -77,7 +77,11 @@ typedef IndexConfig<Calendar, | |||
77 | ValueIndex<Calendar::Name> | 77 | ValueIndex<Calendar::Name> |
78 | > CalendarIndexConfig; | 78 | > CalendarIndexConfig; |
79 | 79 | ||
80 | 80 | template <typename EntityType, typename EntityIndexConfig> | |
81 | QMap<QByteArray, int> defaultTypeDatabases() | ||
82 | { | ||
83 | return merge(QMap<QByteArray, int>{{QByteArray{EntityType::name} + ".main", Storage::IntegerKeys}}, EntityIndexConfig::databases()); | ||
84 | } | ||
81 | 85 | ||
82 | void TypeImplementation<Mail>::configure(TypeIndex &index) | 86 | void TypeImplementation<Mail>::configure(TypeIndex &index) |
83 | { | 87 | { |
@@ -86,7 +90,7 @@ void TypeImplementation<Mail>::configure(TypeIndex &index) | |||
86 | 90 | ||
87 | QMap<QByteArray, int> TypeImplementation<Mail>::typeDatabases() | 91 | QMap<QByteArray, int> TypeImplementation<Mail>::typeDatabases() |
88 | { | 92 | { |
89 | return merge(QMap<QByteArray, int>{{QByteArray{Mail::name} + ".main", Storage::IntegerKeys}}, MailIndexConfig::databases()); | 93 | return defaultTypeDatabases<Mail, MailIndexConfig>(); |
90 | } | 94 | } |
91 | 95 | ||
92 | void TypeImplementation<Mail>::configure(IndexPropertyMapper &indexPropertyMapper) | 96 | void TypeImplementation<Mail>::configure(IndexPropertyMapper &indexPropertyMapper) |
@@ -129,7 +133,7 @@ void TypeImplementation<Folder>::configure(TypeIndex &index) | |||
129 | 133 | ||
130 | QMap<QByteArray, int> TypeImplementation<Folder>::typeDatabases() | 134 | QMap<QByteArray, int> TypeImplementation<Folder>::typeDatabases() |
131 | { | 135 | { |
132 | return merge(QMap<QByteArray, int>{{QByteArray{Folder::name} + ".main", Storage::IntegerKeys}}, FolderIndexConfig::databases()); | 136 | return defaultTypeDatabases<Folder, FolderIndexConfig>(); |
133 | } | 137 | } |
134 | 138 | ||
135 | void TypeImplementation<Folder>::configure(PropertyMapper &propertyMapper) | 139 | void TypeImplementation<Folder>::configure(PropertyMapper &propertyMapper) |
@@ -154,7 +158,7 @@ void TypeImplementation<Contact>::configure(TypeIndex &index) | |||
154 | 158 | ||
155 | QMap<QByteArray, int> TypeImplementation<Contact>::typeDatabases() | 159 | QMap<QByteArray, int> TypeImplementation<Contact>::typeDatabases() |
156 | { | 160 | { |
157 | return merge(QMap<QByteArray, int>{{QByteArray{Contact::name} + ".main", Storage::IntegerKeys}}, ContactIndexConfig::databases()); | 161 | return defaultTypeDatabases<Contact, ContactIndexConfig>(); |
158 | } | 162 | } |
159 | 163 | ||
160 | void TypeImplementation<Contact>::configure(PropertyMapper &propertyMapper) | 164 | void TypeImplementation<Contact>::configure(PropertyMapper &propertyMapper) |
@@ -182,7 +186,7 @@ void TypeImplementation<Addressbook>::configure(TypeIndex &index) | |||
182 | 186 | ||
183 | QMap<QByteArray, int> TypeImplementation<Addressbook>::typeDatabases() | 187 | QMap<QByteArray, int> TypeImplementation<Addressbook>::typeDatabases() |
184 | { | 188 | { |
185 | return merge(QMap<QByteArray, int>{{QByteArray{Addressbook::name} + ".main", Storage::IntegerKeys}}, AddressbookIndexConfig::databases()); | 189 | return defaultTypeDatabases<Addressbook, AddressbookIndexConfig>(); |
186 | } | 190 | } |
187 | 191 | ||
188 | void TypeImplementation<Addressbook>::configure(PropertyMapper &propertyMapper) | 192 | void TypeImplementation<Addressbook>::configure(PropertyMapper &propertyMapper) |
@@ -204,7 +208,7 @@ void TypeImplementation<Event>::configure(TypeIndex &index) | |||
204 | 208 | ||
205 | QMap<QByteArray, int> TypeImplementation<Event>::typeDatabases() | 209 | QMap<QByteArray, int> TypeImplementation<Event>::typeDatabases() |
206 | { | 210 | { |
207 | return merge(QMap<QByteArray, int>{{QByteArray{Event::name} + ".main", Storage::IntegerKeys}}, EventIndexConfig::databases()); | 211 | return defaultTypeDatabases<Event, EventIndexConfig>(); |
208 | } | 212 | } |
209 | 213 | ||
210 | void TypeImplementation<Event>::configure(PropertyMapper &propertyMapper) | 214 | void TypeImplementation<Event>::configure(PropertyMapper &propertyMapper) |
@@ -232,7 +236,7 @@ void TypeImplementation<Todo>::configure(TypeIndex &index) | |||
232 | 236 | ||
233 | QMap<QByteArray, int> TypeImplementation<Todo>::typeDatabases() | 237 | QMap<QByteArray, int> TypeImplementation<Todo>::typeDatabases() |
234 | { | 238 | { |
235 | return merge(QMap<QByteArray, int>{{QByteArray{Todo::name} + ".main", Storage::IntegerKeys}}, TodoIndexConfig::databases()); | 239 | return defaultTypeDatabases<Todo, TodoIndexConfig>(); |
236 | } | 240 | } |
237 | 241 | ||
238 | void TypeImplementation<Todo>::configure(PropertyMapper &propertyMapper) | 242 | void TypeImplementation<Todo>::configure(PropertyMapper &propertyMapper) |
@@ -263,7 +267,7 @@ void TypeImplementation<Calendar>::configure(TypeIndex &index) | |||
263 | 267 | ||
264 | QMap<QByteArray, int> TypeImplementation<Calendar>::typeDatabases() | 268 | QMap<QByteArray, int> TypeImplementation<Calendar>::typeDatabases() |
265 | { | 269 | { |
266 | return merge(QMap<QByteArray, int>{{QByteArray{Calendar::name} + ".main", Storage::IntegerKeys}}, CalendarIndexConfig::databases()); | 270 | return defaultTypeDatabases<Calendar, CalendarIndexConfig>(); |
267 | } | 271 | } |
268 | 272 | ||
269 | void TypeImplementation<Calendar>::configure(PropertyMapper &propertyMapper) | 273 | void TypeImplementation<Calendar>::configure(PropertyMapper &propertyMapper) |