~aleteoryx/muditaos

ref: 0823d82e5141f44812c54debf07245d0ca746124 muditaos/module-db/Databases/ContactsDB.cpp -rw-r--r-- 1.1 KiB
0823d82e — Radoslaw Wicik [EGD-3743] Update copyrights in fies - add empty line after license 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <module-vfs/vfs.hpp>
#include "ContactsDB.hpp"

const char *ContactsDB::dbName = USER_PATH("contacts.db");

uint32_t ContactsDB::favouritesId = 0;
uint32_t ContactsDB::iceId        = 0;
uint32_t ContactsDB::blockedId    = 0;
uint32_t ContactsDB::temporaryId  = 0;

ContactsDB::ContactsDB()
    : Database(dbName), contacts(this), name(this), number(this), ringtones(this), address(this), groups(this)
{

    if (contacts.create() == false) {
        return;
    }
    if (name.create() == false) {
        return;
    }
    if (number.create() == false) {
        return;
    }
    if (ringtones.create() == false) {
        return;
    }
    if (address.create() == false) {
        return;
    }
    if (groups.create() == false) {
        return;
    }

    if (favouritesId == 0) {
        favouritesId = groups.favouritesId();
    }
    if (iceId == 0) {
        iceId = groups.iceId();
    }
    if (blockedId == 0) {
        blockedId = groups.blockedId();
    }
    if (temporaryId == 0) {
        temporaryId = groups.temporaryId();
    }

    isInitialized_ = true;
}

ContactsDB::~ContactsDB()
{}