[Libreoffice-commits] core.git: vcl/inc vcl/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 8 23:19:48 UTC 2019


 vcl/inc/printdlg.hxx           |    2 ++
 vcl/source/window/printdlg.cxx |   10 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit d456ca6efb98d707427228e8131dfe8a5f27e2f6
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Nov 8 14:52:55 2019 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Nov 9 00:18:39 2019 +0100

    tdf#41205 Auto-focus range edit in print dialog
    
    Auto-select the page range edit when the "Pages"
    radio button is selected in the print dialog, to
    allow for easy insertion of the pages to print.
    
    S.a. commit 6087dc9cddde7052258996389d561f415ebee13c
    ("filter: PDF Export UI "page range" autofocus") which
    did basically the same for the PDF export dialog.
    
    Change-Id: Iff7a9292c4874952e67218d83aafc4bc76b1e5b7
    Reviewed-on: https://gerrit.libreoffice.org/82310
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 8328b6315d73..33f9a7be94f4 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -138,6 +138,8 @@ namespace vcl
         std::unique_ptr<weld::SpinButton>       mxCopyCountField;
         std::unique_ptr<weld::CheckButton>      mxCollateBox;
         std::unique_ptr<weld::Image>            mxCollateImage;
+        std::unique_ptr<weld::Entry>            mxPageRangeEdit;
+        std::unique_ptr<weld::RadioButton>      mxPageRangesRadioButton;
         std::unique_ptr<weld::ComboBox>         mxPaperSidesBox;
         std::unique_ptr<weld::CheckButton>      mxReverseOrderBox;
 
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 87d578c6f894..079ce29ebb6f 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -521,6 +521,8 @@ PrintDialog::PrintDialog(weld::Window* i_pWindow, const std::shared_ptr<PrinterC
     , mxCopyCountField(m_xBuilder->weld_spin_button("copycount"))
     , mxCollateBox(m_xBuilder->weld_check_button("collate"))
     , mxCollateImage(m_xBuilder->weld_image("collateimage"))
+    , mxPageRangeEdit(m_xBuilder->weld_entry("pagerange"))
+    , mxPageRangesRadioButton(m_xBuilder->weld_radio_button("rbRangePages"))
     , mxPaperSidesBox(m_xBuilder->weld_combo_box("sidesbox"))
     , mxReverseOrderBox(m_xBuilder->weld_check_button("reverseorder"))
     , mxOKButton(m_xBuilder->weld_button("ok"))
@@ -1647,10 +1649,8 @@ void PrintDialog::setupOptionalUI()
     // update enable states
     checkOptionalControlDependencies();
 
-    std::unique_ptr<weld::Widget> xPageRange = m_xBuilder->weld_widget("pagerange");
-
     // print range not shown (currently math only) -> hide spacer line and reverse order
-    if (!xPageRange || !xPageRange->get_visible())
+    if (!mxPageRangeEdit->get_visible())
     {
         mxReverseOrderBox->hide();
     }
@@ -2048,6 +2048,10 @@ IMPL_LINK( PrintDialog, UIOption_RadioHdl, weld::ToggleButton&, i_rBtn, void )
 
             checkOptionalControlDependencies();
 
+            // tdf#41205 give focus to the page range edit if the corresponding radio button was selected
+            if (pVal->Name == "PrintContent" && mxPageRangesRadioButton->get_active())
+                mxPageRangeEdit->grab_focus();
+
             // update preview and page settings
             preparePreview(false);
         }


More information about the Libreoffice-commits mailing list