From: Claudio Cambra Date: Mon, 14 Nov 2022 12:10:53 +0000 (+0100) Subject: Show tick icon when encryption is enabled for account X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~113^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ef97200ac071804e9c978bd8ba1ad2c34d0e3c17;p=nextcloud-desktop.git Show tick icon when encryption is enabled for account Signed-off-by: Claudio Cambra --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 93115ba8f..7c8250a81 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 e9d3206c9..5ffcf947f 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 7261a9d7a..609363db2 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -567,6 +567,7 @@ public: */ static QPixmap createColorAwarePixmap(const QString &name); + static QIcon createIconFromSvgResource(const QString &resourcePath); /** * @brief Whether to show the option to create folders using "virtual files".