Skip to content

Commit

Permalink
ensure e2ee can be disabled from client
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Jun 28, 2023
1 parent de2b49f commit 5658c31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1561,13 +1561,7 @@ void AccountSettings::initializeE2eEncryption()
if (!_accountState->account()->e2e()->_mnemonic.isEmpty()) {
slotE2eEncryptionMnemonicReady();
} else {
_ui->encryptionMessage->setMessageType(KMessageWidget::Information);
_ui->encryptionMessage->setText(tr("This account supports end-to-end encryption"));
_ui->encryptionMessage->setIcon(Theme::createColorAwareIcon(QStringLiteral(":/client/theme/black/state-info.svg")));
_ui->encryptionMessage->hide();

auto *const actionEnableE2e = addActionToEncryptionMessage(tr("Set up encryption"), e2EeUiActionEnableEncryptionId);
connect(actionEnableE2e, &QAction::triggered, this, &AccountSettings::slotE2eEncryptionGenerateKeys);
initializeE2eEncryptionSettingsMessage();

connect(_accountState->account()->e2e(), &ClientSideEncryption::initializationFinished, this, [this] {
if (!_accountState->account()->e2e()->_publicKey.isNull()) {
Expand All @@ -1590,7 +1584,7 @@ void AccountSettings::resetE2eEncryption()
}
_ui->encryptionMessage->setText({});
_ui->encryptionMessage->setIcon({});
initializeE2eEncryption();
initializeE2eEncryptionSettingsMessage();
checkClientSideEncryptionState();

const auto account = _accountState->account();
Expand Down Expand Up @@ -1627,6 +1621,17 @@ QAction *AccountSettings::addActionToEncryptionMessage(const QString &actionTitl
return action;
}

void AccountSettings::initializeE2eEncryptionSettingsMessage()
{
_ui->encryptionMessage->setMessageType(KMessageWidget::Information);
_ui->encryptionMessage->setText(tr("This account supports end-to-end encryption"));
_ui->encryptionMessage->setIcon(Theme::createColorAwareIcon(QStringLiteral(":/client/theme/black/state-info.svg")));
_ui->encryptionMessage->hide();

auto *const actionEnableE2e = addActionToEncryptionMessage(tr("Set up encryption"), e2EeUiActionEnableEncryptionId);
connect(actionEnableE2e, &QAction::triggered, this, &AccountSettings::slotE2eEncryptionGenerateKeys);
}

} // namespace OCC

#include "accountsettings.moc"
2 changes: 2 additions & 0 deletions src/gui/accountsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ private slots:
bool event(QEvent *) override;
QAction *addActionToEncryptionMessage(const QString &actionTitle, const QString &actionId);

void initializeE2eEncryptionSettingsMessage();

/// Returns the alias of the selected folder, empty string if none
[[nodiscard]] QString selectedFolderAlias() const;

Expand Down

0 comments on commit 5658c31

Please sign in to comment.