summaryrefslogtreecommitdiffstats
path: root/common/domain/typeimplementations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/domain/typeimplementations.cpp')
-rw-r--r--common/domain/typeimplementations.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp
index f969072..6e14501 100644
--- a/common/domain/typeimplementations.cpp
+++ b/common/domain/typeimplementations.cpp
@@ -80,7 +80,11 @@ typedef IndexConfig<Calendar,
80 ValueIndex<Calendar::Name> 80 ValueIndex<Calendar::Name>
81 > CalendarIndexConfig; 81 > CalendarIndexConfig;
82 82
83 83template <typename EntityType, typename EntityIndexConfig>
84QMap<QByteArray, int> defaultTypeDatabases()
85{
86 return merge(QMap<QByteArray, int>{{QByteArray{EntityType::name} + ".main", Storage::IntegerKeys}}, EntityIndexConfig::databases());
87}
84 88
85void TypeImplementation<Mail>::configure(TypeIndex &index) 89void TypeImplementation<Mail>::configure(TypeIndex &index)
86{ 90{
@@ -89,7 +93,7 @@ void TypeImplementation<Mail>::configure(TypeIndex &index)
89 93
90QMap<QByteArray, int> TypeImplementation<Mail>::typeDatabases() 94QMap<QByteArray, int> TypeImplementation<Mail>::typeDatabases()
91{ 95{
92 return merge(QMap<QByteArray, int>{{QByteArray{Mail::name} + ".main", Storage::IntegerKeys}}, MailIndexConfig::databases()); 96 return defaultTypeDatabases<Mail, MailIndexConfig>();
93} 97}
94 98
95void TypeImplementation<Mail>::configure(IndexPropertyMapper &indexPropertyMapper) 99void TypeImplementation<Mail>::configure(IndexPropertyMapper &indexPropertyMapper)
@@ -132,7 +136,7 @@ void TypeImplementation<Folder>::configure(TypeIndex &index)
132 136
133QMap<QByteArray, int> TypeImplementation<Folder>::typeDatabases() 137QMap<QByteArray, int> TypeImplementation<Folder>::typeDatabases()
134{ 138{
135 return merge(QMap<QByteArray, int>{{QByteArray{Folder::name} + ".main", Storage::IntegerKeys}}, FolderIndexConfig::databases()); 139 return defaultTypeDatabases<Folder, FolderIndexConfig>();
136} 140}
137 141
138void TypeImplementation<Folder>::configure(PropertyMapper &propertyMapper) 142void TypeImplementation<Folder>::configure(PropertyMapper &propertyMapper)
@@ -157,7 +161,7 @@ void TypeImplementation<Contact>::configure(TypeIndex &index)
157 161
158QMap<QByteArray, int> TypeImplementation<Contact>::typeDatabases() 162QMap<QByteArray, int> TypeImplementation<Contact>::typeDatabases()
159{ 163{
160 return merge(QMap<QByteArray, int>{{QByteArray{Contact::name} + ".main", Storage::IntegerKeys}}, ContactIndexConfig::databases()); 164 return defaultTypeDatabases<Contact, ContactIndexConfig>();
161} 165}
162 166
163void TypeImplementation<Contact>::configure(PropertyMapper &propertyMapper) 167void TypeImplementation<Contact>::configure(PropertyMapper &propertyMapper)
@@ -185,7 +189,7 @@ void TypeImplementation<Addressbook>::configure(TypeIndex &index)
185 189
186QMap<QByteArray, int> TypeImplementation<Addressbook>::typeDatabases() 190QMap<QByteArray, int> TypeImplementation<Addressbook>::typeDatabases()
187{ 191{
188 return merge(QMap<QByteArray, int>{{QByteArray{Addressbook::name} + ".main", Storage::IntegerKeys}}, AddressbookIndexConfig::databases()); 192 return defaultTypeDatabases<Addressbook, AddressbookIndexConfig>();
189} 193}
190 194
191void TypeImplementation<Addressbook>::configure(PropertyMapper &propertyMapper) 195void TypeImplementation<Addressbook>::configure(PropertyMapper &propertyMapper)
@@ -207,7 +211,7 @@ void TypeImplementation<Event>::configure(TypeIndex &index)
207 211
208QMap<QByteArray, int> TypeImplementation<Event>::typeDatabases() 212QMap<QByteArray, int> TypeImplementation<Event>::typeDatabases()
209{ 213{
210 return merge(QMap<QByteArray, int>{{QByteArray{Event::name} + ".main", Storage::IntegerKeys}}, EventIndexConfig::databases()); 214 return defaultTypeDatabases<Event, EventIndexConfig>();
211} 215}
212 216
213void TypeImplementation<Event>::configure(PropertyMapper &propertyMapper) 217void TypeImplementation<Event>::configure(PropertyMapper &propertyMapper)
@@ -235,7 +239,7 @@ void TypeImplementation<Todo>::configure(TypeIndex &index)
235 239
236QMap<QByteArray, int> TypeImplementation<Todo>::typeDatabases() 240QMap<QByteArray, int> TypeImplementation<Todo>::typeDatabases()
237{ 241{
238 return merge(QMap<QByteArray, int>{{QByteArray{Todo::name} + ".main", Storage::IntegerKeys}}, TodoIndexConfig::databases()); 242 return defaultTypeDatabases<Todo, TodoIndexConfig>();
239} 243}
240 244
241void TypeImplementation<Todo>::configure(PropertyMapper &propertyMapper) 245void TypeImplementation<Todo>::configure(PropertyMapper &propertyMapper)
@@ -266,7 +270,7 @@ void TypeImplementation<Calendar>::configure(TypeIndex &index)
266 270
267QMap<QByteArray, int> TypeImplementation<Calendar>::typeDatabases() 271QMap<QByteArray, int> TypeImplementation<Calendar>::typeDatabases()
268{ 272{
269 return merge(QMap<QByteArray, int>{{QByteArray{Calendar::name} + ".main", Storage::IntegerKeys}}, CalendarIndexConfig::databases()); 273 return defaultTypeDatabases<Calendar, CalendarIndexConfig>();
270} 274}
271 275
272void TypeImplementation<Calendar>::configure(PropertyMapper &propertyMapper) 276void TypeImplementation<Calendar>::configure(PropertyMapper &propertyMapper)