[Libreoffice-commits] core.git: basctl/source basctl/uiconfig

Caolán McNamara caolanm at redhat.com
Mon May 14 20:11:13 UTC 2018


 basctl/source/basicide/moduldl2.cxx         |   40 ++++++++++------------------
 basctl/source/basicide/moduldlg.hxx         |   16 ++++-------
 basctl/uiconfig/basicide/ui/exportdialog.ui |    9 ++++--
 3 files changed, 29 insertions(+), 36 deletions(-)

New commits:
commit 2eedf1dc713d8e90473dad5f9e83d284a3bf784b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 14 17:13:05 2018 +0100

    weld ExportDialog
    
    Change-Id: Ie799f429d3121426b90bdd62cf0758da38b0beb4
    Reviewed-on: https://gerrit.libreoffice.org/54335
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 644b1593352c..020e2f4488cf 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -419,34 +419,24 @@ IMPL_LINK_NOARG(GotoLineDialog, OkButtonHandler, weld::Button&, void)
 }
 
 // ExportDialog
-IMPL_LINK_NOARG(ExportDialog, OkButtonHandler, Button*, void)
+IMPL_LINK_NOARG(ExportDialog, OkButtonHandler, weld::Button&, void)
 {
-    mbExportAsPackage = m_pExportAsPackageButton->IsChecked();
-    EndDialog(1);
+    m_bExportAsPackage = m_xExportAsPackageButton->get_active();
+    m_xDialog->response(RET_OK);
 }
 
-ExportDialog::ExportDialog(vcl::Window * pParent)
-    : ModalDialog(pParent, "ExportDialog",
-        "modules/BasicIDE/ui/exportdialog.ui")
-    , mbExportAsPackage(false)
+ExportDialog::ExportDialog(weld::Window * pParent)
+    : GenericDialogController(pParent, "modules/BasicIDE/ui/exportdialog.ui", "ExportDialog")
+    , m_bExportAsPackage(false)
+    , m_xExportAsPackageButton(m_xBuilder->weld_radio_button("extension"))
+    , m_xOKButton(m_xBuilder->weld_button("ok"))
 {
-    get(m_pExportAsPackageButton, "extension");
-    get(m_pOKButton, "ok");
-
-    m_pExportAsPackageButton->Check();
-    m_pOKButton->SetClickHdl(LINK(this, ExportDialog, OkButtonHandler));
+    m_xExportAsPackageButton->set_active(true);
+    m_xOKButton->connect_clicked(LINK(this, ExportDialog, OkButtonHandler));
 }
 
 ExportDialog::~ExportDialog()
 {
-    disposeOnce();
-}
-
-void ExportDialog::dispose()
-{
-    m_pExportAsPackageButton.clear();
-    m_pOKButton.clear();
-    ModalDialog::dispose();
 }
 
 // LibPage
@@ -1103,15 +1093,15 @@ void LibPage::Export()
             return;
     }
 
-    ScopedVclPtrInstance<ExportDialog> aNewDlg(this);
-    if (aNewDlg->Execute() == RET_OK)
+    std::unique_ptr<ExportDialog> xNewDlg(new ExportDialog(GetFrameWeld()));
+    if (xNewDlg->run() == RET_OK)
     {
         try
         {
-            bool bExportAsPackage = aNewDlg->isExportAsPackage();
-            //tdf#112063 ensure closing aNewDlg is not selected as
+            bool bExportAsPackage = xNewDlg->isExportAsPackage();
+            //tdf#112063 ensure closing xNewDlg is not selected as
             //parent of file dialog from ExportAs...
-            aNewDlg.disposeAndClear();
+            xNewDlg.reset();
             if (bExportAsPackage)
                 ExportAsPackage( aLibName );
             else
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
index 44f647a45b0c..adb1e661cd0a 100644
--- a/basctl/source/basicide/moduldlg.hxx
+++ b/basctl/source/basicide/moduldlg.hxx
@@ -71,25 +71,23 @@ public:
     sal_Int32 GetLineNumber() const;
 };
 
-class ExportDialog : public ModalDialog
+class ExportDialog : public weld::GenericDialogController
 {
 private:
-    VclPtr<RadioButton>    m_pExportAsPackageButton;
-    VclPtr<OKButton>       m_pOKButton;
+    bool m_bExportAsPackage;
 
-    bool            mbExportAsPackage;
+    std::unique_ptr<weld::RadioButton> m_xExportAsPackageButton;
+    std::unique_ptr<weld::Button> m_xOKButton;
 
-    DECL_LINK(OkButtonHandler, Button*, void);
+    DECL_LINK(OkButtonHandler, weld::Button&, void);
 
 public:
-    explicit ExportDialog( vcl::Window * pParent );
+    explicit ExportDialog(weld::Window * pParent);
     virtual ~ExportDialog() override;
-    virtual void dispose() override;
 
-    bool isExportAsPackage () const { return mbExportAsPackage; }
+    bool isExportAsPackage () const { return m_bExportAsPackage; }
 };
 
-
 class ExtTreeListBox final : public TreeListBox
 {
     virtual bool    EditingEntry( SvTreeListEntry* pEntry, Selection& rSel  ) override;
diff --git a/basctl/uiconfig/basicide/ui/exportdialog.ui b/basctl/uiconfig/basicide/ui/exportdialog.ui
index 2a664b6b4d49..a345c436a5aa 100644
--- a/basctl/uiconfig/basicide/ui/exportdialog.ui
+++ b/basctl/uiconfig/basicide/ui/exportdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="basctl">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="ExportDialog">
@@ -7,7 +7,13 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="exportdialog|ExportDialog">Export Basic library</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>
@@ -88,7 +94,6 @@
                 <property name="xalign">0</property>
                 <property name="active">True</property>
                 <property name="draw_indicator">True</property>
-                <property name="group">basic</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>


More information about the Libreoffice-commits mailing list