summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent BP <laurent.balland-poirier@laposte.net>2022-04-25 09:30:38 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2022-04-29 19:04:10 +0200
commit170cdf5e335f8803b6d851a9d16020d277e73288 (patch)
tree896ab15f65c56fff5e037c07a7807d908e416b9c
parentc16128bba6da5f2c51e970631c6cccf3b561ff7c (diff)
tdf#139464 Change label of OK button
In Move/copy sheet UI, change label according to selected action update: with UI test Change-Id: I8244b1635f56574c7641191be7e15ee4a098dce9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133364 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
-rw-r--r--sc/qa/uitest/calc_tests6/moveCopySheet.py17
-rw-r--r--sc/source/ui/inc/mvtabdlg.hxx1
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx11
3 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py
index 9436364dd053..41019b371a83 100644
--- a/sc/qa/uitest/calc_tests6/moveCopySheet.py
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -65,5 +65,22 @@ class moveCopySheet(UITestCase):
self.assertEqual(document.Sheets[1].Name, "Sheet1")
self.assertEqual(document.Sheets[2].Name, "moveName")
+ #tdf#139464 Set OK button label to selected action: Move or Copy
+ def test_tdf139464_move_sheet(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xOkButton = xDialog.getChild("ok")
+ xCopyButton = xDialog.getChild("copy")
+ self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xOkButton = xDialog.getChild("ok")
+ xCopyButton = xDialog.getChild("copy")
+ xMoveButton = xDialog.getChild("move")
+ self.assertEqual(get_state_as_dict(xMoveButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+ xCopyButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+ xMoveButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xMoveButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 2f11fd3868b4..9d121a928fa6 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -37,6 +37,7 @@ public:
void GetTabNameString( OUString& rString ) const;
void SetForceCopyTable ();
void EnableRenameTable (bool bFlag);
+ void SetOkBtnLabel ();
private:
void ResetRenameInput();
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 6ec7712f87ea..80eeaeadecfa 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -74,6 +74,7 @@ void ScMoveTableDlg::SetForceCopyTable()
m_xBtnCopy->set_active(true);
m_xBtnMove->set_sensitive(false);
m_xBtnCopy->set_sensitive(false);
+ SetOkBtnLabel();
}
void ScMoveTableDlg::EnableRenameTable(bool bFlag)
@@ -185,6 +186,7 @@ void ScMoveTableDlg::Init()
m_xBtnOk->connect_clicked(LINK(this, ScMoveTableDlg, OkHdl));
m_xLbDoc->connect_changed(LINK(this, ScMoveTableDlg, SelHdl));
m_xBtnCopy->connect_toggled(LINK(this, ScMoveTableDlg, CheckBtnHdl));
+ m_xBtnMove->connect_toggled(LINK(this, ScMoveTableDlg, CheckBtnHdl));
m_xEdTabName->connect_changed(LINK(this, ScMoveTableDlg, CheckNameHdl));
m_xBtnMove->set_active(true);
m_xBtnCopy->set_active(false);
@@ -197,6 +199,7 @@ void ScMoveTableDlg::Init()
m_xFtDoc->hide();
m_xLbDoc->hide();
}
+ SetOkBtnLabel();
}
void ScMoveTableDlg::InitDocListBox()
@@ -236,12 +239,20 @@ void ScMoveTableDlg::InitDocListBox()
m_xLbDoc->set_active(nSelPos);
}
+void ScMoveTableDlg::SetOkBtnLabel()
+{
+ // tdf#139464 Write "Copy" or "Move" on OK button
+ m_xBtnOk->set_label(m_xBtnCopy->get_active() ? m_xBtnCopy->get_label()
+ : m_xBtnMove->get_label());
+}
+
// Handler:
IMPL_LINK(ScMoveTableDlg, CheckBtnHdl, weld::Toggleable&, rBtn, void)
{
if (&rBtn == m_xBtnCopy.get())
ResetRenameInput();
+ SetOkBtnLabel();
}
IMPL_LINK_NOARG(ScMoveTableDlg, OkHdl, weld::Button&, void)