[Libreoffice-commits] core.git: cui/source cui/uiconfig extras/source solenv/bin solenv/sanitizers

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Mar 1 15:44:03 UTC 2019


 cui/source/options/optaboutconfig.cxx          |   46 +++++++++----------------
 cui/source/options/optaboutconfig.hxx          |   25 +++----------
 cui/uiconfig/ui/aboutconfigvaluedialog.ui      |   18 ++++++---
 extras/source/glade/libreoffice-catalog.xml.in |    3 -
 solenv/bin/native-code.py                      |    1 
 solenv/sanitizers/ui/cui.suppr                 |    2 -
 6 files changed, 36 insertions(+), 59 deletions(-)

New commits:
commit c2b20809b5d446d8f9d1d35723d67d24f64144dd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 1 11:53:13 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 1 16:43:38 2019 +0100

    weld CuiAboutConfigValueDialog
    
    Change-Id: I91f5fb2bcd7eb365214278d9683d71c78ad45617
    Reviewed-on: https://gerrit.libreoffice.org/68547
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 2cde3cdc3f6b..5947c50b7047 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -77,13 +77,11 @@ struct UserData
     {}
 };
 
-VCL_BUILDER_FACTORY_ARGS(CuiCustomMultilineEdit,WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK)
-
-void CuiCustomMultilineEdit::KeyInput( const KeyEvent& rKeyEvent )
+IMPL_LINK(CuiAboutConfigValueDialog, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
 {
     bool bValid = false;
     bool bNonSpace = rKeyEvent.GetKeyCode().GetCode() != KEY_SPACE;
-    if( bNumericOnly && bNonSpace )
+    if (m_bNumericOnly && bNonSpace )
     {
         const vcl::KeyCode& rKeyCode = rKeyEvent.GetKeyCode();
         sal_uInt16 nGroup = rKeyCode.GetGroup();
@@ -132,13 +130,9 @@ void CuiCustomMultilineEdit::KeyInput( const KeyEvent& rKeyEvent )
     }
     else
         bValid = true;
-    if( bValid )
-        Edit::KeyInput( rKeyEvent );
-}
 
-Size CuiCustomMultilineEdit::GetOptimalSize() const
-{
-    return LogicToPixel(Size(150, GetTextHeight()), MapMode(MapUnit::MapAppFont));
+    //if value return true to claim that it has been handled
+    return !bValid;
 }
 
 CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxItemSet& rItemSet*/ ) :
@@ -540,27 +534,21 @@ std::vector< OUString > CuiAboutConfigTabPage::commaStringToSequence( const OUSt
     return tempVector;
 }
 
-CuiAboutConfigValueDialog::CuiAboutConfigValueDialog( vcl::Window* pWindow,
-                                                      const OUString& rValue,
-                                                      int limit ) :
-    ModalDialog( pWindow, "AboutConfigValueDialog", "cui/ui/aboutconfigvaluedialog.ui" ),
-    m_pEDValue( get<CuiCustomMultilineEdit>("valuebox") )
+CuiAboutConfigValueDialog::CuiAboutConfigValueDialog(weld::Window* pWindow,
+                                                     const OUString& rValue,
+                                                     int limit)
+    : GenericDialogController(pWindow, "cui/ui/aboutconfigvaluedialog.ui", "AboutConfigValueDialog")
+    , m_bNumericOnly(limit != 0)
+    , m_xEDValue(m_xBuilder->weld_entry("valuebox"))
 {
-    m_pEDValue->bNumericOnly = ( limit !=0 );
-    m_pEDValue->SetMaxTextLen( limit == 0 ? EDIT_NOLIMIT : limit);
-    m_pEDValue->SetText( rValue );
-
+    if (limit)
+        m_xEDValue->set_max_length(limit);
+    m_xEDValue->set_text(rValue);
+    m_xEDValue->connect_key_press(LINK(this, CuiAboutConfigValueDialog, KeyInputHdl));
 }
 
 CuiAboutConfigValueDialog::~CuiAboutConfigValueDialog()
 {
-    disposeOnce();
-}
-
-void CuiAboutConfigValueDialog::dispose()
-{
-    m_pEDValue.clear();
-    ModalDialog::dispose();
 }
 
 IMPL_LINK_NOARG( CuiAboutConfigTabPage, ResetBtnHdl_Impl, Button*, void )
@@ -636,11 +624,11 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void )
                 else if( sPropertyType == "hyper" )
                     limit = HYPER_LEN_LIMIT;
 
-                VclPtrInstance<CuiAboutConfigValueDialog> pValueDialog(nullptr, sDialogValue, limit);
+                CuiAboutConfigValueDialog aValueDialog(GetFrameWeld(), sDialogValue, limit);
 
-                if( pValueDialog->Execute() == RET_OK )
+                if (aValueDialog.run() == RET_OK )
                 {
-                    sNewValue = pValueDialog->getValue();
+                    sNewValue = aValueDialog.getValue();
                     bSaveChanges = true;
                     if ( sPropertyType == "short")
                     {
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index 7d10212ee11b..eed7400de050 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -26,19 +26,6 @@ class CuiAboutConfigValueDialog;
 struct Prop_Impl;
 struct UserData;
 
-class CuiCustomMultilineEdit : public Edit
-{
-public:
-    bool bNumericOnly;
-    CuiCustomMultilineEdit( vcl::Window* pParent, WinBits nStyle )
-        : Edit( pParent, nStyle )
-        , bNumericOnly(false)
-    {}
-
-    virtual void KeyInput( const KeyEvent& rKeyEvent ) override;
-    virtual Size GetOptimalSize() const override;
-};
-
 class CuiAboutConfigTabPage : public ModalDialog
 {
 private:
@@ -80,19 +67,21 @@ public:
    void FillItemSet();
 };
 
-class CuiAboutConfigValueDialog : public ModalDialog
+class CuiAboutConfigValueDialog : public weld::GenericDialogController
 {
 private:
-    VclPtr<CuiCustomMultilineEdit> m_pEDValue;
+    bool m_bNumericOnly;
+    std::unique_ptr<weld::Entry> m_xEDValue;
+
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
 
 public:
-    CuiAboutConfigValueDialog( vcl::Window* pWindow, const OUString& rValue , int limit);
+    CuiAboutConfigValueDialog(weld::Window* pWindow, const OUString& rValue , int limit);
     virtual ~CuiAboutConfigValueDialog() override;
-    virtual void dispose() override;
 
     OUString getValue()
     {
-        return m_pEDValue->GetText();
+        return m_xEDValue->get_text();
     }
 };
 
diff --git a/cui/uiconfig/ui/aboutconfigvaluedialog.ui b/cui/uiconfig/ui/aboutconfigvaluedialog.ui
index 6fb99a2f2b7e..cb96b0effa1d 100644
--- a/cui/uiconfig/ui/aboutconfigvaluedialog.ui
+++ b/cui/uiconfig/ui/aboutconfigvaluedialog.ui
@@ -1,14 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkDialog" id="AboutConfigValueDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="aboutconfigvaluedialog|AboutConfigValueDialog">Name</property>
-    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -83,8 +87,10 @@
               <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="aboutconfigvaluedialog|label1">Value:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">valuebox</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -93,11 +99,11 @@
               </packing>
             </child>
             <child>
-              <object class="cuilo-CuiCustomMultilineEdit" id="valuebox">
+              <object class="GtkEntry" id="valuebox">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
-                <property name="wrap_mode">char</property>
+                <property name="width_chars">50</property>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index b92d8e16f8b2..c2e95ce903fa 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -166,9 +166,6 @@
     <glade-widget-class title="Address MultiLine Edit" name="swuilo-AddressMultiLineEdit"
                         generic-name="AddressMultiLineEdit" parent="GtkTextView"
                         icon-name="widget-gtk-textview"/>
-    <glade-widget-class title="Cui Custom MultiLine Edit" name="cuilo-CuiCustomMultilineEdit"
-                        generic-name="CuiCustomMultiLineEdit" parent="GtkTextView"
-                        icon-name="widget-gtk-textview"/>
     <glade-widget-class title="SvtValueSet" name="svtlo-ValueSet"
                         generic-name="Set of Value Options" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index de3671ff73f4..53d47c44fc92 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -434,7 +434,6 @@ custom_widgets = [
     'ConditionEdit',
     'ContentListBox',
     'ContextVBox',
-    'CuiCustomMultilineEdit',
     'CustomAnimationList',
     'CustomPropertiesControl',
     'DataTreeListBox',
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index b0ca8cdc1021..925d8f0e6d7c 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -16,8 +16,6 @@ cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='property'] orphan-label
 cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='type'] orphan-label
 cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='value'] orphan-label
 cui/uiconfig/ui/aboutconfigdialog.ui://svtlo-SvSimpleTableContainer[@id='preferences'] no-labelled-by
-cui/uiconfig/ui/aboutconfigvaluedialog.ui://GtkLabel[@id='label1'] orphan-label
-cui/uiconfig/ui/aboutconfigvaluedialog.ui://cuilo-CuiCustomMultilineEdit[@id='valuebox'] no-labelled-by
 cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='abbrev'] no-labelled-by
 cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='double'] no-labelled-by
 cui/uiconfig/ui/applyautofmtpage.ui://GtkLabel[@id='label1'] orphan-label


More information about the Libreoffice-commits mailing list