Show the "Display mnemonic" button only when we know e2e is supported
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 18 Aug 2020 14:35:47 +0000 (16:35 +0200)
committerCamila <hello@camila.codes>
Tue, 18 Aug 2020 15:41:38 +0000 (17:41 +0200)
Turns out that showing the button straight from the page ctor is a bit
too early. At that point the account might not be connected yet and thus
we wouldn't have proper information. Currently we were displaying that
button all the time, now we wait for the account to be connected to
decide to show it or not.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/accountsettings.cpp

index c70096730664b1cae9b285d5db65bbcf14ec75a9..517d452d2e64a090d9bf707f2711bab643854ebc 100644 (file)
@@ -205,7 +205,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
         auto *mnemonic = new QAction(tr("Display mnemonic"), this);
         connect(mnemonic, &QAction::triggered, this, &AccountSettings::requesetMnemonic);
         _ui->encryptionMessage->addAction(mnemonic);
-        _ui->encryptionMessage->show();
+        _ui->encryptionMessage->hide();
     }
 
     connect(UserModel::instance(), &UserModel::addAccount,
@@ -841,6 +841,10 @@ void AccountSettings::slotAccountStateChanged()
          */
         qCInfo(lcAccountSettings) << "Account" << accountsState()->account()->displayName()
             << "Client Side Encryption" << accountsState()->account()->capabilities().clientSideEncryptionAvailable();
+
+        if (_accountState->account()->capabilities().clientSideEncryptionAvailable()) {
+            _ui->encryptionMessage->show();
+        }
     }
 }