[CSE] Move the e2e object to the Account

This is important as a lot of the code would start
to rely in direct access to the client side encryption
and there are different keys for different accounts.
This commit is contained in:
Tomaz Canabrava 2017-11-13 17:22:09 +01:00
parent 6351c01ee7
commit a0f0e5617a
4 changed files with 15 additions and 4 deletions

View file

@ -50,9 +50,18 @@ AccountPtr Account::create()
{
AccountPtr acc = AccountPtr(new Account);
acc->setSharedThis(acc);
//TODO: This probably needs to have a better
// coupling, but it should work for now.
acc->e2e().setAccount(acc);
return acc;
}
ClientSideEncryption& Account::e2e()
{
return _e2e;
}
Account::~Account()
{
}

View file

@ -226,6 +226,8 @@ public:
/// Called by network jobs on credential errors, emits invalidCredentials()
void handleInvalidCredentials();
ClientSideEncryption& e2e();
public slots:
/// Used when forgetting credentials
void clearQNAMCache();
@ -283,6 +285,8 @@ private:
static QString _configFileName;
QString _davPath; // defaults to value from theme, might be overwritten in brandings
ClientSideEncryption _e2e;
friend class AccountManager;
};
}

View file

@ -326,9 +326,8 @@ void ConnectionValidator::slotUserFetched(const QJsonDocument &json)
void ConnectionValidator::slotAvatarImage(const QImage &img)
{
_account->setAvatar(img);
cse.setAccount(_account);
connect(&cse, &ClientSideEncryption::initializationFinished, this, &ConnectionValidator::reportConnected);
cse.initialize();
connect(&_account->e2e(), &ClientSideEncryption::initializationFinished, this, &ConnectionValidator::reportConnected);
_account->e2e().initialize();
}
void ConnectionValidator::reportConnected() {

View file

@ -144,7 +144,6 @@ private:
QStringList _errors;
AccountPtr _account;
bool _isCheckingServerAndAuth;
ClientSideEncryption cse;
};
}