diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-09 11:51:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-09 13:28:29 +0200 |
commit | f97077c5fe41195bf2054892ae08e3307983e6dc (patch) | |
tree | 885b746b298e9a66e0e5e8847d0e72d8760f32b7 /sc/source/ui/miscdlgs/retypepassdlg.cxx | |
parent | f4ca7ea13102dfbc0a62e925b6fe4dbe6fd0bf99 (diff) |
loplugin:flatten sc/miscdlgs
Change-Id: I41bb4eb1ea06aef2f4e58e0f00d275dcf8879154
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100397
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/miscdlgs/retypepassdlg.cxx')
-rw-r--r-- | sc/source/ui/miscdlgs/retypepassdlg.cxx | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx index f422915a26a2..a80afe1fbd68 100644 --- a/sc/source/ui/miscdlgs/retypepassdlg.cxx +++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx @@ -159,33 +159,33 @@ void ScRetypePassDlg::SetDocData() void ScRetypePassDlg::SetTableData(size_t nRowPos, SCTAB nTab) { - if (nRowPos < maSheets.size()) - { - weld::Label& rName = *maSheets[nRowPos]->m_xName; - weld::Label& rStatus = *maSheets[nRowPos]->m_xStatus; - weld::Button& rBtn = *maSheets[nRowPos]->m_xButton; + if (nRowPos >= maSheets.size()) + return; - bool bBtnEnabled = false; - rName.set_label(maTableItems[nTab].maName); - const ScTableProtection* pTabProtect = maTableItems[nTab].mpProtect.get(); - if (pTabProtect && pTabProtect->isProtected()) + weld::Label& rName = *maSheets[nRowPos]->m_xName; + weld::Label& rStatus = *maSheets[nRowPos]->m_xStatus; + weld::Button& rBtn = *maSheets[nRowPos]->m_xButton; + + bool bBtnEnabled = false; + rName.set_label(maTableItems[nTab].maName); + const ScTableProtection* pTabProtect = maTableItems[nTab].mpProtect.get(); + if (pTabProtect && pTabProtect->isProtected()) + { + if (pTabProtect->isPasswordEmpty()) + rStatus.set_label(maTextNotPassProtected); + else if (pTabProtect->hasPasswordHash(meDesiredHash)) + rStatus.set_label(maTextHashGood); + else { - if (pTabProtect->isPasswordEmpty()) - rStatus.set_label(maTextNotPassProtected); - else if (pTabProtect->hasPasswordHash(meDesiredHash)) - rStatus.set_label(maTextHashGood); - else - { - // incompatible hash - rStatus.set_label(maTextHashBad); - bBtnEnabled = true; - } + // incompatible hash + rStatus.set_label(maTextHashBad); + bBtnEnabled = true; } - else - rStatus.set_label(maTextNotProtected); - - rBtn.set_sensitive(bBtnEnabled); } + else + rStatus.set_label(maTextNotProtected); + + rBtn.set_sensitive(bBtnEnabled); } static bool lcl_IsInGoodStatus(const ScPassHashProtectable* pProtected, ScPasswordHash eDesiredHash) @@ -256,24 +256,24 @@ IMPL_LINK(ScRetypePassDlg, RetypeBtnHdl, weld::Button&, rBtn, void) return; ScRetypePassInputDlg aDlg(m_xDialog.get(), pProtected); - if (aDlg.run() == RET_OK) - { - // OK is pressed. Update the protected item. - if (aDlg.IsRemovePassword()) - { - // Remove password from this item. - pProtected->setPassword(OUString()); - } - else - { - // Set a new password. - OUString aNewPass = aDlg.GetNewPassword(); - pProtected->setPassword(aNewPass); - } + if (aDlg.run() != RET_OK) + return; - SetDocData(); - CheckHashStatus(); + // OK is pressed. Update the protected item. + if (aDlg.IsRemovePassword()) + { + // Remove password from this item. + pProtected->setPassword(OUString()); } + else + { + // Set a new password. + OUString aNewPass = aDlg.GetNewPassword(); + pProtected->setPassword(aNewPass); + } + + SetDocData(); + CheckHashStatus(); } ScRetypePassInputDlg::ScRetypePassInputDlg(weld::Window* pParent, ScPassHashProtectable* pProtected) |