Show tick icon when encryption is enabled for account
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 14 Nov 2022 12:10:53 +0000 (13:10 +0100)
committerClaudio Cambra <claudio.cambra@gmail.com>
Fri, 25 Nov 2022 10:53:41 +0000 (11:53 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/accountsettings.cpp
src/libsync/theme.cpp
src/libsync/theme.h

index 93115ba8f6b25b46feedcaae4a0eb25e9b30b0d2..7c8250a810570346997e4c77b80718ebe096d126 100644 (file)
@@ -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();
 
 }
index e9d3206c999dcfceb36a6e8d6cd275847e176742..5ffcf947f32d294fdc8017ef698f6ea2ab5afa8c 100644 (file)
@@ -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();
index 7261a9d7a504e23f0e9eec4b6863412b4fcfc0a4..609363db2137a2aef644ac3317d94a65720eae6f 100644 (file)
@@ -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".