From 89a66a98d86f4ece5c50f08d96144d5d1fb070ce Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 10 Nov 2022 17:13:12 +0100 Subject: [PATCH 1/7] Clearly tell user that E2EE has been enabled for an account Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index b229c5ef8d918..93115ba8f6b25 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -246,9 +246,9 @@ void AccountSettings::slotE2eEncryptionMnemonicReady() connect(actionDisplayMnemonic, &QAction::triggered, this, [this]() { displayMnemonic(_accountState->account()->e2e()->_mnemonic); }); - _ui->encryptionMessage->setText(tr("This account supports End-to-End encryption")); + _ui->encryptionMessage->setText(tr("End-to-End encryption has been enabled for this account")); _ui->encryptionMessage->show(); - + } void AccountSettings::slotE2eEncryptionGenerateKeys() From ef97200ac071804e9c978bd8ba1ad2c34d0e3c17 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 14 Nov 2022 13:10:53 +0100 Subject: [PATCH 2/7] Show tick icon when encryption is enabled for account Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 2 ++ src/libsync/theme.cpp | 15 +++++++++++++++ src/libsync/theme.h | 1 + 3 files changed, 18 insertions(+) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 93115ba8f6b25..7c8250a810570 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -246,7 +246,9 @@ void AccountSettings::slotE2eEncryptionMnemonicReady() connect(actionDisplayMnemonic, &QAction::triggered, this, [this]() { displayMnemonic(_accountState->account()->e2e()->_mnemonic); }); + _ui->encryptionMessage->setText(tr("End-to-End encryption has been enabled for this account")); + _ui->encryptionMessage->setIcon(Theme::createIconFromSvgResource(QStringLiteral(":/client/theme/colored/state-ok.svg"))); _ui->encryptionMessage->show(); } diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index e9d3206c999dc..5ffcf947f32d2 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -870,6 +870,21 @@ QPixmap Theme::createColorAwarePixmap(const QString &name) return createColorAwarePixmap(name, QGuiApplication::palette()); } +QIcon Theme::createIconFromSvgResource(const QString &resourcePath) +{ + QSvgRenderer renderer(resourcePath); + + QImage img(64, 64, QImage::Format_ARGB32); + img.fill(Qt::GlobalColor::transparent); + + QPainter imgPainter(&img); + renderer.render(&imgPainter); + + QIcon icon(QPixmap::fromImage(img)); + + return icon; +} + bool Theme::showVirtualFilesOption() const { const auto vfsMode = bestAvailableVfsMode(); diff --git a/src/libsync/theme.h b/src/libsync/theme.h index 7261a9d7a504e..609363db2137a 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -567,6 +567,7 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject */ static QPixmap createColorAwarePixmap(const QString &name); + static QIcon createIconFromSvgResource(const QString &resourcePath); /** * @brief Whether to show the option to create folders using "virtual files". From c1d6482c695a9d8c5eb1ff47dd9427a7c01793ee Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 14 Nov 2022 13:22:15 +0100 Subject: [PATCH 3/7] Add info icon when encryption not yet enabled Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 7c8250a810570..ac351c86868ce 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -1458,6 +1458,7 @@ void AccountSettings::initializeE2eEncryption() slotE2eEncryptionMnemonicReady(); } else { _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("Enable encryption"), e2EeUiActionEnableEncryptionId); From f6687c491d7de38031b9d1ca97d7ec1b17d65df3 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 14 Nov 2022 13:25:39 +0100 Subject: [PATCH 4/7] Change the colour of the encryption message box when encryption enabled Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index ac351c86868ce..6faf73d0edab2 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -247,6 +247,7 @@ void AccountSettings::slotE2eEncryptionMnemonicReady() displayMnemonic(_accountState->account()->e2e()->_mnemonic); }); + _ui->encryptionMessage->setMessageType(KMessageWidget::Positive); _ui->encryptionMessage->setText(tr("End-to-End encryption has been enabled for this account")); _ui->encryptionMessage->setIcon(Theme::createIconFromSvgResource(QStringLiteral(":/client/theme/colored/state-ok.svg"))); _ui->encryptionMessage->show(); @@ -1457,6 +1458,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(); From 719a8f38bf605e01e784f3b941ddd46ce5b17e72 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 15 Nov 2022 12:27:35 +0100 Subject: [PATCH 5/7] Use material icons for lock and state-info Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 3 +- src/libsync/theme.cpp | 15 --------- src/libsync/theme.h | 2 -- theme.qrc.in | 1 + theme/black/state-info.svg | 2 +- theme/lock-broken.svg | 52 ++++++++++++++++++++++++++++++- theme/lock-http.svg | 62 ++++++++++++++++++++++++++++++++++++- theme/lock-https.svg | 44 +++++++++++++++++++++++++- theme/lock.svg | 1 + theme/white/state-info.svg | 2 +- 10 files changed, 160 insertions(+), 24 deletions(-) create mode 100644 theme/lock.svg diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 6faf73d0edab2..f9a2dea21a743 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -249,9 +249,8 @@ void AccountSettings::slotE2eEncryptionMnemonicReady() _ui->encryptionMessage->setMessageType(KMessageWidget::Positive); _ui->encryptionMessage->setText(tr("End-to-End encryption has been enabled for this account")); - _ui->encryptionMessage->setIcon(Theme::createIconFromSvgResource(QStringLiteral(":/client/theme/colored/state-ok.svg"))); + _ui->encryptionMessage->setIcon(Theme::createColorAwareIcon(QStringLiteral(":/client/theme/lock.svg"))); _ui->encryptionMessage->show(); - } void AccountSettings::slotE2eEncryptionGenerateKeys() diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 5ffcf947f32d2..e9d3206c999dc 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -870,21 +870,6 @@ QPixmap Theme::createColorAwarePixmap(const QString &name) return createColorAwarePixmap(name, QGuiApplication::palette()); } -QIcon Theme::createIconFromSvgResource(const QString &resourcePath) -{ - QSvgRenderer renderer(resourcePath); - - QImage img(64, 64, QImage::Format_ARGB32); - img.fill(Qt::GlobalColor::transparent); - - QPainter imgPainter(&img); - renderer.render(&imgPainter); - - QIcon icon(QPixmap::fromImage(img)); - - return icon; -} - bool Theme::showVirtualFilesOption() const { const auto vfsMode = bestAvailableVfsMode(); diff --git a/src/libsync/theme.h b/src/libsync/theme.h index 609363db2137a..3162df4c93ec3 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -567,8 +567,6 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject */ static QPixmap createColorAwarePixmap(const QString &name); - static QIcon createIconFromSvgResource(const QString &resourcePath); - /** * @brief Whether to show the option to create folders using "virtual files". * diff --git a/theme.qrc.in b/theme.qrc.in index c341ac5a0aee3..cdc669023517f 100644 --- a/theme.qrc.in +++ b/theme.qrc.in @@ -209,6 +209,7 @@ theme/more.svg theme/change.svg theme/colored/change-bordered.svg + theme/lock.svg theme/lock-http.svg theme/lock-https.svg theme/lock-broken.svg diff --git a/theme/black/state-info.svg b/theme/black/state-info.svg index 762de0370ff50..fb9f815050146 100644 --- a/theme/black/state-info.svg +++ b/theme/black/state-info.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/theme/lock-broken.svg b/theme/lock-broken.svg index c6cfce60601b9..48d070f5cd4ef 100644 --- a/theme/lock-broken.svg +++ b/theme/lock-broken.svg @@ -1 +1,51 @@ - + + + + + + + + + + + diff --git a/theme/lock-http.svg b/theme/lock-http.svg index a77e45536d3e9..3dbf27870032b 100644 --- a/theme/lock-http.svg +++ b/theme/lock-http.svg @@ -1 +1,61 @@ - + + + + + + + + + + + + + + + diff --git a/theme/lock-https.svg b/theme/lock-https.svg index cf013708d63e7..3d493c9252ec4 100644 --- a/theme/lock-https.svg +++ b/theme/lock-https.svg @@ -1 +1,43 @@ - + + + + + + + diff --git a/theme/lock.svg b/theme/lock.svg new file mode 100644 index 0000000000000..88c2274f5ef31 --- /dev/null +++ b/theme/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/theme/white/state-info.svg b/theme/white/state-info.svg index d644e9bada1e6..715fe8bb152aa 100644 --- a/theme/white/state-info.svg +++ b/theme/white/state-info.svg @@ -1 +1 @@ - + \ No newline at end of file From 5a0d253187620226b39cb11f8b1d2f214ef1b6c6 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 15 Nov 2022 16:51:22 +0100 Subject: [PATCH 6/7] Fix capitalisation of End-to-end Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index f9a2dea21a743..880f1a58b03f9 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -89,11 +89,11 @@ void showEnableE2eeWithVirtualFilesWarningDialog(std::function onAcc { const auto messageBox = new QMessageBox; messageBox->setAttribute(Qt::WA_DeleteOnClose); - messageBox->setText(AccountSettings::tr("End-to-End Encryption with Virtual Files")); + messageBox->setText(AccountSettings::tr("End-to-end Encryption with Virtual Files")); messageBox->setInformativeText(AccountSettings::tr("You seem to have the Virtual Files feature enabled on this folder. " "At the moment, it is not possible to implicitly download virtual files that are " - "End-to-End encrypted. To get the best experience with Virtual Files and " - "End-to-End Encryption, make sure the encrypted folder is marked with " + "End-to-end encrypted. To get the best experience with Virtual Files and " + "End-to-end Encryption, make sure the encrypted folder is marked with " "\"Make always available locally\".")); messageBox->setIcon(QMessageBox::Warning); const auto dontEncryptButton = messageBox->addButton(QMessageBox::StandardButton::Cancel); @@ -248,7 +248,7 @@ void AccountSettings::slotE2eEncryptionMnemonicReady() }); _ui->encryptionMessage->setMessageType(KMessageWidget::Positive); - _ui->encryptionMessage->setText(tr("End-to-End encryption has been enabled for this account")); + _ui->encryptionMessage->setText(tr("End-to-end encryption has been enabled for this account")); _ui->encryptionMessage->setIcon(Theme::createColorAwareIcon(QStringLiteral(":/client/theme/lock.svg"))); _ui->encryptionMessage->show(); } @@ -976,7 +976,7 @@ void AccountSettings::displayMnemonic(const QString &mnemonic) QDialog widget; Ui_Dialog ui; ui.setupUi(&widget); - widget.setWindowTitle(tr("End-to-End encryption mnemonic")); + widget.setWindowTitle(tr("End-to-end encryption mnemonic")); ui.label->setText( tr("To protect your Cryptographic Identity, we encrypt it with a mnemonic of 12 dictionary words. " "Please note these down and keep them safe. " @@ -1458,7 +1458,7 @@ void AccountSettings::initializeE2eEncryption() slotE2eEncryptionMnemonicReady(); } else { _ui->encryptionMessage->setMessageType(KMessageWidget::Information); - _ui->encryptionMessage->setText(tr("This account supports End-to-End encryption")); + _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(); From 2459a3a9f39f0bba9c15d2fbb97317a0009c1069 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 17 Nov 2022 16:07:31 +0100 Subject: [PATCH 7/7] Rename 'Enable encryption' button to 'Setup encryption' Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 880f1a58b03f9..a882983573b16 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -1462,7 +1462,7 @@ void AccountSettings::initializeE2eEncryption() _ui->encryptionMessage->setIcon(Theme::createColorAwareIcon(QStringLiteral(":/client/theme/black/state-info.svg"))); _ui->encryptionMessage->hide(); - auto *const actionEnableE2e = addActionToEncryptionMessage(tr("Enable encryption"), e2EeUiActionEnableEncryptionId); + auto *const actionEnableE2e = addActionToEncryptionMessage(tr("Setup encryption"), e2EeUiActionEnableEncryptionId); connect(actionEnableE2e, &QAction::triggered, this, &AccountSettings::slotE2eEncryptionGenerateKeys); } }