summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-11-08 09:20:34 +0300
committerSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-11-15 19:48:49 +0100
commit861ebce9ca52cbe87121879f159d8ec0cb572755 (patch)
tree476510bf43168c0dd4456198e7ad7e6abacfca75
parente8fc5d7fcab6b283ec0655b1d7cab5bf28fde240 (diff)
tdf#157518: add password strength bar to protectsheetdlg.ui
Change-Id: Iedd6793446c2c339cc17d32a28c6b195dfb250e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159372 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
-rw-r--r--sc/source/ui/inc/protectiondlg.hxx1
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.cxx9
-rw-r--r--sc/uiconfig/scalc/ui/protectsheetdlg.ui25
3 files changed, 28 insertions, 7 deletions
diff --git a/sc/source/ui/inc/protectiondlg.hxx b/sc/source/ui/inc/protectiondlg.hxx
index d36c8a820fad..e59fb3accf77 100644
--- a/sc/source/ui/inc/protectiondlg.hxx
+++ b/sc/source/ui/inc/protectiondlg.hxx
@@ -51,6 +51,7 @@ private:
std::unique_ptr<weld::Container> m_xOptions;
std::unique_ptr<weld::Entry> m_xPassword1Edit;
std::unique_ptr<weld::Entry> m_xPassword2Edit;
+ std::unique_ptr<weld::LevelBar> m_xPasswordStrengthBar;
std::unique_ptr<weld::TreeView> m_xOptionsListBox;
std::unique_ptr<weld::Button> m_xBtnOk;
std::unique_ptr<weld::Label> m_xProtected;
diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx
index 920e7bfc4888..1353f5f154cc 100644
--- a/sc/source/ui/miscdlgs/protectiondlg.cxx
+++ b/sc/source/ui/miscdlgs/protectiondlg.cxx
@@ -19,6 +19,7 @@
#include <protectiondlg.hxx>
#include <tabprotection.hxx>
+#include <svl/PasswordHelper.hxx>
#include <vector>
@@ -43,6 +44,7 @@ ScTableProtectionDlg::ScTableProtectionDlg(weld::Window* pParent)
, m_xOptions(m_xBuilder->weld_container("options"))
, m_xPassword1Edit(m_xBuilder->weld_entry("password1"))
, m_xPassword2Edit(m_xBuilder->weld_entry("password2"))
+ , m_xPasswordStrengthBar(m_xBuilder->weld_level_bar("passwordbar"))
, m_xOptionsListBox(m_xBuilder->weld_tree_view("checklist"))
, m_xBtnOk(m_xBuilder->weld_button("ok"))
, m_xProtected(m_xBuilder->weld_label("protected"))
@@ -144,9 +146,14 @@ IMPL_LINK_NOARG(ScTableProtectionDlg, OKHdl, weld::Button&, void)
m_xDialog->response(RET_OK);
}
-IMPL_LINK_NOARG(ScTableProtectionDlg, PasswordModifyHdl, weld::Entry&, void)
+IMPL_LINK(ScTableProtectionDlg, PasswordModifyHdl, weld::Entry&, rEntry, void)
{
OUString aPass1 = m_xPassword1Edit->get_text();
+ if (&rEntry == m_xPassword1Edit.get())
+ {
+ m_xPasswordStrengthBar->set_percentage(
+ SvPasswordHelper::GetPasswordStrengthPercentage(aPass1));
+ }
OUString aPass2 = m_xPassword2Edit->get_text();
m_xBtnOk->set_sensitive(aPass1 == aPass2);
}
diff --git a/sc/uiconfig/scalc/ui/protectsheetdlg.ui b/sc/uiconfig/scalc/ui/protectsheetdlg.ui
index 547af8e8d34e..83f1a1af012a 100644
--- a/sc/uiconfig/scalc/ui/protectsheetdlg.ui
+++ b/sc/uiconfig/scalc/ui/protectsheetdlg.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.38.2 -->
<interface domain="sc">
<requires lib="gtk+" version="3.20"/>
<object class="GtkTreeStore" id="liststore1">
@@ -117,7 +117,7 @@
</packing>
</child>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=2 n-rows=3 -->
<object class="GtkGrid" id="passwords">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -150,8 +150,8 @@
<property name="xalign">1</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
@@ -182,10 +182,23 @@
<property name="input_purpose">password</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLevelBar" id="passwordbar">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>