Browse Source

update// implemented reader for addressbook

pull/130/head
Strider 4 years ago
parent
commit
ea7f3bc72a
  1. 19
      src/FileSystem/FileSystem.cpp

19
src/FileSystem/FileSystem.cpp

@ -22,6 +22,23 @@ FileSystem* FileSystem::getInstance()
QList<ContactItem> FileSystem::readContacts(QString file)
{
return this->readContactsOldFormat(file); //will be called if addresses are in the old dat-format
QFile _file(file);
if (_file.exists())
{
std::ifstream f(file.toStdString().c_str(), std::ios::binary);
if(f.is_open())
{
std::vector<unsigned char> buffer(std::istreambuf_iterator<char>(f), {});
//todo covert to string to use is as json to feed the data store in addressbook
}
f.close();
}
else
{
qInfo() << file << "not exist";
}
}
void FileSystem::writeContacts(QString file, QString data)
@ -33,6 +50,8 @@ void FileSystem::writeContacts(QString file, QString data)
std::ofstream f(file.toStdString().c_str());
if(f.is_open())
{
//ENCRYPT HERE
f << data.toStdString();
}

Loading…
Cancel
Save