|
|
@ -105,10 +105,11 @@ Profile::Profile(QString name, const QString& password, bool isNewProfile, |
|
|
|
, encrypted{this->passkey != nullptr} |
|
|
|
, encrypted{this->passkey != nullptr} |
|
|
|
{ |
|
|
|
{ |
|
|
|
Settings& s = Settings::getInstance(); |
|
|
|
Settings& s = Settings::getInstance(); |
|
|
|
|
|
|
|
// TODO(kriby): Move/refactor core initialization to remove settings dependency
|
|
|
|
|
|
|
|
// note to self: use slots/signals for this?
|
|
|
|
initCore(toxsave, s, isNewProfile); |
|
|
|
initCore(toxsave, s, isNewProfile); |
|
|
|
|
|
|
|
|
|
|
|
const ToxId& selfId = core->getSelfId(); |
|
|
|
loadDatabase(password); |
|
|
|
loadDatabase(selfId, password); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -470,14 +471,16 @@ QByteArray Profile::loadAvatarData(const ToxPk& owner) |
|
|
|
return pic; |
|
|
|
return pic; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Profile::loadDatabase(const ToxId& id, QString password) |
|
|
|
void Profile::loadDatabase(QString password) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
assert(core); |
|
|
|
|
|
|
|
|
|
|
|
if (isRemoved) { |
|
|
|
if (isRemoved) { |
|
|
|
qDebug() << "Can't load database of removed profile"; |
|
|
|
qDebug() << "Can't load database of removed profile"; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QByteArray salt = id.getPublicKey().getByteArray(); |
|
|
|
QByteArray salt = core->getSelfId().getPublicKey().getByteArray(); |
|
|
|
if (salt.size() != TOX_PASS_SALT_LENGTH) { |
|
|
|
if (salt.size() != TOX_PASS_SALT_LENGTH) { |
|
|
|
qWarning() << "Couldn't compute salt from public key" << name; |
|
|
|
qWarning() << "Couldn't compute salt from public key" << name; |
|
|
|
GUI::showError(QObject::tr("Error"), |
|
|
|
GUI::showError(QObject::tr("Error"), |
|
|
|