Skip to content

Commit 1a8adf2

Browse files
committed
accountsettings.cpp: improve configuration-related e2ee verbiage
This refactors the code and updates the messages to use a consistent set of words that refer to the configuration of the e2ee. Signed-off-by: Dawid Wróbel <[email protected]>
1 parent 9d93050 commit 1a8adf2

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

src/gui/accountsettings.cpp

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ namespace {
7171
constexpr auto propertyFolder = "folder";
7272
constexpr auto propertyPath = "path";
7373
constexpr auto e2eUiActionIdKey = "id";
74-
constexpr auto e2EeUiActionEnableEncryptionId = "enable_encryption";
75-
constexpr auto e2EeUiActionDisableEncryptionId = "disable_encryption";
74+
constexpr auto e2EeUiActionSetupEncryptionId = "setup_encryption";
75+
constexpr auto e2EeUiActionForgetEncryptionId = "forget_encryption";
7676
constexpr auto e2EeUiActionDisplayMnemonicId = "display_mnemonic";
7777
constexpr auto e2EeUiActionMigrateCertificateId = "migrate_certificate";
7878
}
@@ -282,7 +282,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
282282
_ui->quotaProgressBar->setStyleSheet(QString::fromLatin1(progressBarStyleC).arg(color.name()));*/
283283

284284
// Connect E2E stuff
285-
initializeE2eEncryption();
285+
setupE2eEncryption();
286286
_ui->encryptionMessage->setCloseButtonVisible(false);
287287

288288
_ui->connectLabel->setText(tr("No account configured."));
@@ -303,9 +303,9 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
303303

304304
void AccountSettings::slotE2eEncryptionMnemonicReady()
305305
{
306-
const auto actionDisableEncryption = addActionToEncryptionMessage(tr("Disable encryption"), e2EeUiActionDisableEncryptionId);
306+
const auto actionDisableEncryption = addActionToEncryptionMessage(tr("Forget encryption on this device"), e2EeUiActionForgetEncryptionId);
307307
connect(actionDisableEncryption, &QAction::triggered, this, [this] {
308-
disableEncryptionForAccount(_accountState->account());
308+
forgetEncryptionOnDeviceForAccount(_accountState->account());
309309
});
310310

311311
if (_accountState->account()->e2e()->userCertificateNeedsMigration()) {
@@ -320,7 +320,7 @@ void AccountSettings::slotE2eEncryptionMnemonicReady()
320320
}
321321

322322
_ui->encryptionMessage->setMessageType(KMessageWidget::Positive);
323-
_ui->encryptionMessage->setText(tr("End-to-end encryption has been enabled for this account"));
323+
_ui->encryptionMessage->setText(tr("Remember to <b>Encrypt</b> a folder to end-to-end encrypt any new files added to it."));
324324
_ui->encryptionMessage->setIcon(Theme::createColorAwareIcon(QStringLiteral(":/client/theme/lock.svg")));
325325
_ui->encryptionMessage->show();
326326
}
@@ -337,7 +337,7 @@ void AccountSettings::slotE2eEncryptionInitializationFinished(bool isNewMnemonic
337337
{
338338
disconnect(_accountState->account()->e2e(), &ClientSideEncryption::initializationFinished, this, &AccountSettings::slotE2eEncryptionInitializationFinished);
339339
if (_accountState->account()->e2e()->isInitialized()) {
340-
removeActionFromEncryptionMessage(e2EeUiActionEnableEncryptionId);
340+
removeActionFromEncryptionMessage(e2EeUiActionSetupEncryptionId);
341341
slotE2eEncryptionMnemonicReady();
342342
if (isNewMnemonicGenerated) {
343343
displayMnemonic(_accountState->account()->e2e()->getMnemonic());
@@ -414,9 +414,8 @@ bool AccountSettings::canEncryptOrDecrypt(const FolderStatusModel::SubFolderInfo
414414

415415
if (!_accountState->account()->e2e() || !_accountState->account()->e2e()->isInitialized()) {
416416
QMessageBox msgBox;
417-
msgBox.setText(tr("End-to-end encryption is not configured on this device. "
418-
"Once it is configured, you will be able to encrypt this folder.\n"
419-
"Would you like to set up end-to-end encryption?"));
417+
msgBox.setText(tr("You cannot encrypt this folder because the end-to-end encryption is not set-up yet on this device.\n"
418+
"Would you like to do this now?"));
420419
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
421420
msgBox.setDefaultButton(QMessageBox::Ok);
422421
const auto ret = msgBox.exec();
@@ -1100,8 +1099,8 @@ void AccountSettings::displayMnemonic(const QString &mnemonic)
11001099
widget.setWindowTitle(tr("End-to-end encryption mnemonic"));
11011100
ui.label->setText(
11021101
tr("To protect your Cryptographic Identity, we encrypt it with a mnemonic of 12 dictionary words. "
1103-
"Please note these down and keep them safe. "
1104-
"They will be needed to add other devices to your account (like your mobile phone or laptop)."));
1102+
"Please note it down and keep it safe. "
1103+
"You will need it to set-up the synchronization of encrypted folders on your other devices."));
11051104
QFont monoFont(QStringLiteral("Monospace"));
11061105
monoFont.setStyleHint(QFont::TypeWriter);
11071106
ui.lineEdit->setFont(monoFont);
@@ -1121,14 +1120,14 @@ void AccountSettings::displayMnemonic(const QString &mnemonic)
11211120
widget.exec();
11221121
}
11231122

1124-
void AccountSettings::disableEncryptionForAccount(const AccountPtr &account) const
1123+
void AccountSettings::forgetEncryptionOnDeviceForAccount(const AccountPtr &account) const
11251124
{
11261125
QMessageBox dialog;
1127-
dialog.setWindowTitle(tr("Disable end-to-end encryption"));
1128-
dialog.setText(tr("Disable end-to-end encryption for %1?").arg(account->davUser()));
1129-
dialog.setInformativeText(tr("Removing end-to-end encryption will remove locally-synced files that are encrypted."
1126+
dialog.setWindowTitle(tr("Forget the end-to-end encryption on this device"));
1127+
dialog.setText(tr("Do you want to forget the end-to-end encryption settings for %1 on this device?").arg(account->davUser()));
1128+
dialog.setInformativeText(tr("Forgetting end-to-end encryption will remove the sensitive data and all the encrypted files from this device."
11301129
"<br>"
1131-
"Encrypted files will remain on the server."));
1130+
"However, the encrypted files will remain on the server and all your other devices, if configured."));
11321131
dialog.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
11331132
dialog.setDefaultButton(QMessageBox::Ok);
11341133
dialog.adjustSize();
@@ -1137,7 +1136,7 @@ void AccountSettings::disableEncryptionForAccount(const AccountPtr &account) con
11371136
switch(ret) {
11381137
case QMessageBox::Ok:
11391138
connect(account->e2e(), &ClientSideEncryption::sensitiveDataForgotten,
1140-
this, &AccountSettings::resetE2eEncryption);
1139+
this, &AccountSettings::e2EeUiActionForgetEncryptionId);
11411140
account->e2e()->forgetSensitiveData(account);
11421141
break;
11431142
case QMessageBox::Cancel:
@@ -1685,37 +1684,35 @@ void AccountSettings::customizeStyle()
16851684
_ui->quotaProgressBar->setStyleSheet(QString::fromLatin1(progressBarStyleC).arg(color.name()));
16861685
}
16871686

1688-
void AccountSettings::initializeE2eEncryption()
1687+
void AccountSettings::setupE2eEncryption()
16891688
{
16901689
connect(_accountState->account()->e2e(), &ClientSideEncryption::initializationFinished, this, &AccountSettings::slotPossiblyUnblacklistE2EeFoldersAndRestartSync);
16911690

16921691
if (_accountState->account()->e2e()->isInitialized()) {
16931692
slotE2eEncryptionMnemonicReady();
16941693
} else {
1695-
initializeE2eEncryptionSettingsMessage();
1694+
setupE2eEncryptionMessage();
16961695

16971696
connect(_accountState->account()->e2e(), &ClientSideEncryption::initializationFinished, this, [this] {
16981697
if (!_accountState->account()->e2e()->getPublicKey().isNull()) {
1699-
_ui->encryptionMessage->setText(tr("End-to-end encryption has been enabled on this account with another device."
1698+
_ui->encryptionMessage->setText(tr("End-to-end encryption has been initialized up on this account with another device."
17001699
"<br>"
1701-
"It can be enabled on this device by entering your mnemonic."
1702-
"<br>"
1703-
"This will enable synchronisation of existing encrypted folders."));
1700+
"Enter the unique mnemonic to have the encrypted folders synchronize on this device as well."));
17041701
}
17051702
});
17061703
_accountState->account()->setE2eEncryptionKeysGenerationAllowed(false);
17071704
_accountState->account()->e2e()->initialize(this, _accountState->account());
17081705
}
17091706
}
17101707

1711-
void AccountSettings::resetE2eEncryption()
1708+
void AccountSettings::e2EeUiActionForgetEncryptionId()
17121709
{
17131710
for (const auto action : _ui->encryptionMessage->actions()) {
17141711
_ui->encryptionMessage->removeAction(action);
17151712
}
17161713
_ui->encryptionMessage->setText({});
17171714
_ui->encryptionMessage->setIcon({});
1718-
initializeE2eEncryptionSettingsMessage();
1715+
setupE2eEncryptionMessage();
17191716
checkClientSideEncryptionState();
17201717

17211718
const auto account = _accountState->account();
@@ -1752,15 +1749,15 @@ QAction *AccountSettings::addActionToEncryptionMessage(const QString &actionTitl
17521749
return action;
17531750
}
17541751

1755-
void AccountSettings::initializeE2eEncryptionSettingsMessage()
1752+
void AccountSettings::setupE2eEncryptionMessage()
17561753
{
17571754
_ui->encryptionMessage->setMessageType(KMessageWidget::Information);
1758-
_ui->encryptionMessage->setText(tr("This account supports end-to-end encryption"));
1755+
_ui->encryptionMessage->setText(tr("This account supports end-to-end encryption, but it needs to be set up first."));
17591756
_ui->encryptionMessage->setIcon(Theme::createColorAwareIcon(QStringLiteral(":/client/theme/black/state-info.svg")));
17601757
_ui->encryptionMessage->hide();
17611758

1762-
auto *const actionEnableE2e = addActionToEncryptionMessage(tr("Set up encryption"), e2EeUiActionEnableEncryptionId);
1763-
connect(actionEnableE2e, &QAction::triggered, this, &AccountSettings::slotE2eEncryptionGenerateKeys);
1759+
auto *const actionSetupE2e = addActionToEncryptionMessage(tr("Set up encryption"), e2EeUiActionSetupEncryptionId);
1760+
connect(actionSetupE2e, &QAction::triggered, this, &AccountSettings::slotE2eEncryptionGenerateKeys);
17641761
}
17651762

17661763
} // namespace OCC

src/gui/accountsettings.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,22 @@ private slots:
124124

125125
private slots:
126126
void displayMnemonic(const QString &mnemonic);
127-
void disableEncryptionForAccount(const OCC::AccountPtr &account) const;
127+
void forgetEncryptionOnDeviceForAccount(const OCC::AccountPtr &account) const;
128128
void migrateCertificateForAccount(const OCC::AccountPtr &account);
129129
void showConnectionLabel(const QString &message, QStringList errors = QStringList());
130130
void openIgnoredFilesDialog(const QString & absFolderPath);
131131
void customizeStyle();
132132

133-
void initializeE2eEncryption();
134-
void resetE2eEncryption();
133+
void setupE2eEncryption();
134+
void e2EeUiActionForgetEncryptionId();
135135
void checkClientSideEncryptionState();
136136
void removeActionFromEncryptionMessage(const QString &actionId);
137137

138138
private:
139139
bool event(QEvent *) override;
140140
QAction *addActionToEncryptionMessage(const QString &actionTitle, const QString &actionId);
141141

142-
void initializeE2eEncryptionSettingsMessage();
142+
void setupE2eEncryptionMessage();
143143

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

0 commit comments

Comments
 (0)