sc/qa/uitest/manual_tests/calc.py |    4 ++--
 sc/source/core/data/validat.cxx   |   13 +++++++------
 2 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 12a62ae750554ea8833c7633f52eea99c0612e10
Author:     Heiko Tietze <[email protected]>
AuthorDate: Tue Dec 16 16:01:34 2025 +0100
Commit:     Heiko Tietze <[email protected]>
CommitDate: Fri Dec 19 10:23:08 2025 +0100

    Related tdf#160096 - Consistent button response for Data Validation
    
    * Makes error messages consistent so RET_CANCEL is always rejecting
      the input
    * Changes the default buttons to Error=Cancel, Warn=OkCancel,
      Info=Ok for SC_VALERR_STOP/WARNING/INFO
    
    Change-Id: Iaf89768c32ec8f9d191d0ebe6829565f9ed6ca08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195726
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <[email protected]>

diff --git a/sc/qa/uitest/manual_tests/calc.py 
b/sc/qa/uitest/manual_tests/calc.py
index 574e3433377a..5bae571d662a 100644
--- a/sc/qa/uitest/manual_tests/calc.py
+++ b/sc/qa/uitest/manual_tests/calc.py
@@ -106,9 +106,9 @@ class ManualCalcTests(UITestCase):
             def enter_text(cell, text):
                 enter_text_to_cell(xGridWin, cell, text)
 
-            with self.ui_test.execute_blocking_action(enter_text, args=("A1", 
"abc")):
+            with self.ui_test.execute_blocking_action(enter_text, args=("A1", 
"abc"), close_button="cancel"):
                 pass
-            with self.ui_test.execute_blocking_action(enter_text, args=("B6", 
"2.18")):
+            with self.ui_test.execute_blocking_action(enter_text, args=("B6", 
"2.18"), close_button="cancel"):
                 pass
 
             enter_text_to_cell(xGridWin, "C2", "24")
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index ab1d451c58bc..8a7715741aaf 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -402,12 +402,16 @@ void ScValidationData::DoError(weld::Window* pParent, 
const OUString& rInput, co
     {
         case SC_VALERR_INFO:
             eType = VclMessageType::Info;
-            eStyle = VclButtonsType::OkCancel;
+            eStyle = VclButtonsType::Ok;
             break;
         case SC_VALERR_WARNING:
             eType = VclMessageType::Warning;
             eStyle = VclButtonsType::OkCancel;
             break;
+        case SC_VALERR_STOP:
+            eType = VclMessageType::Error;
+            eStyle = VclButtonsType::Cancel;
+            break;
         default:
             break;
     }
@@ -419,9 +423,6 @@ void ScValidationData::DoError(weld::Window* pParent, const 
OUString& rInput, co
 
     switch (eErrorStyle)
     {
-        case SC_VALERR_INFO:
-            xBox->set_default_response(RET_OK);
-            break;
         case SC_VALERR_WARNING:
             xBox->set_default_response(RET_CANCEL);
             break;
@@ -429,8 +430,8 @@ void ScValidationData::DoError(weld::Window* pParent, const 
OUString& rInput, co
             break;
     }
 
-    xBox->runAsync(xBox, [this, callback](sal_Int32 result)
-                   { callback(eErrorStyle == SC_VALERR_STOP || result == 
RET_CANCEL); });
+    xBox->runAsync(xBox, [callback](sal_Int32 result)
+                   { callback(result == RET_CANCEL); });
 }
 
 bool ScValidationData::IsDataValidCustom(

Reply via email to