Kaydet (Commit) 308c2084 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld HangulHanjaNewDictDialog

Change-Id: I66db57e550e5035cc4830bfe51f671974eee6686
Reviewed-on: https://gerrit.libreoffice.org/53147Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 67919621
...@@ -1025,9 +1025,9 @@ namespace svx ...@@ -1025,9 +1025,9 @@ namespace svx
IMPL_LINK_NOARG(HangulHanjaOptionsDialog, NewDictHdl, Button*, void) IMPL_LINK_NOARG(HangulHanjaOptionsDialog, NewDictHdl, Button*, void)
{ {
OUString aName; OUString aName;
ScopedVclPtrInstance< HangulHanjaNewDictDialog > aNewDlg(this); HangulHanjaNewDictDialog aNewDlg(GetFrameWeld());
aNewDlg->Execute(); aNewDlg.run();
if( aNewDlg->GetName( aName ) ) if (aNewDlg.GetName(aName))
{ {
if( m_xConversionDictionaryList.is() ) if( m_xConversionDictionaryList.is() )
{ {
...@@ -1176,51 +1176,42 @@ namespace svx ...@@ -1176,51 +1176,42 @@ namespace svx
pEntry->SetUserData( new OUString( _rName ) ); pEntry->SetUserData( new OUString( _rName ) );
} }
IMPL_LINK_NOARG(HangulHanjaNewDictDialog, OKHdl, Button*, void) IMPL_LINK_NOARG(HangulHanjaNewDictDialog, OKHdl, weld::Button&, void)
{ {
OUString aName(comphelper::string::stripEnd(m_pDictNameED->GetText(), ' ')); OUString aName(comphelper::string::stripEnd(m_xDictNameED->get_text(), ' '));
m_bEntered = !aName.isEmpty(); m_bEntered = !aName.isEmpty();
if( m_bEntered ) if (m_bEntered)
m_pDictNameED->SetText( aName ); // do this in case of trailing chars have been deleted m_xDictNameED->set_text(aName); // do this in case of trailing chars have been deleted
EndDialog( RET_OK ); m_xDialog->response(RET_OK);
} }
IMPL_LINK_NOARG(HangulHanjaNewDictDialog, ModifyHdl, Edit&, void) IMPL_LINK_NOARG(HangulHanjaNewDictDialog, ModifyHdl, weld::Entry&, void)
{ {
OUString aName(comphelper::string::stripEnd(m_pDictNameED->GetText(), ' ')); OUString aName(comphelper::string::stripEnd(m_xDictNameED->get_text(), ' '));
m_pOkBtn->Enable( !aName.isEmpty() ); m_xOkBtn->set_sensitive(!aName.isEmpty());
} }
HangulHanjaNewDictDialog::HangulHanjaNewDictDialog(vcl::Window* pParent) HangulHanjaNewDictDialog::HangulHanjaNewDictDialog(weld::Window* pParent)
: ModalDialog(pParent, "HangulHanjaAddDialog", "cui/ui/hangulhanjaadddialog.ui") : GenericDialogController(pParent, "cui/ui/hangulhanjaadddialog.ui", "HangulHanjaAddDialog")
, m_bEntered(false) , m_bEntered(false)
, m_xOkBtn(m_xBuilder->weld_button("ok"))
, m_xDictNameED(m_xBuilder->weld_entry("entry"))
{ {
get(m_pOkBtn, "ok"); m_xOkBtn->connect_clicked( LINK( this, HangulHanjaNewDictDialog, OKHdl ) );
get(m_pDictNameED, "entry"); m_xDictNameED->connect_changed( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
m_pOkBtn->SetClickHdl( LINK( this, HangulHanjaNewDictDialog, OKHdl ) );
m_pDictNameED->SetModifyHdl( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
} }
HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog() HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog()
{ {
disposeOnce();
}
void HangulHanjaNewDictDialog::dispose()
{
m_pDictNameED.clear();
m_pOkBtn.clear();
ModalDialog::dispose();
} }
bool HangulHanjaNewDictDialog::GetName( OUString& _rRetName ) const bool HangulHanjaNewDictDialog::GetName( OUString& _rRetName ) const
{ {
if( m_bEntered ) if( m_bEntered )
_rRetName = comphelper::string::stripEnd(m_pDictNameED->GetText(), ' '); _rRetName = comphelper::string::stripEnd(m_xDictNameED->get_text(), ' ');
return m_bEntered; return m_bEntered;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <vcl/combobox.hxx> #include <vcl/combobox.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/scrbar.hxx> #include <vcl/scrbar.hxx>
#include <vcl/weld.hxx>
#include <svx/checklbx.hxx> #include <svx/checklbx.hxx>
#include <editeng/hangulhanja.hxx> #include <editeng/hangulhanja.hxx>
#include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Sequence.hxx>
...@@ -225,26 +226,23 @@ namespace svx ...@@ -225,26 +226,23 @@ namespace svx
void AddDict( const OUString& _rName, bool _bChecked ); void AddDict( const OUString& _rName, bool _bChecked );
}; };
class HangulHanjaNewDictDialog : public weld::GenericDialogController
class HangulHanjaNewDictDialog : public ModalDialog
{ {
private: private:
VclPtr<Edit> m_pDictNameED;
VclPtr<OKButton> m_pOkBtn;
bool m_bEntered; bool m_bEntered;
DECL_LINK( OKHdl, Button*, void ); std::unique_ptr<weld::Button> m_xOkBtn;
DECL_LINK( ModifyHdl, Edit&, void ); std::unique_ptr<weld::Entry> m_xDictNameED;
DECL_LINK(OKHdl, weld::Button&, void);
DECL_LINK(ModifyHdl, weld::Entry&, void);
public: public:
HangulHanjaNewDictDialog( vcl::Window* _pParent ); HangulHanjaNewDictDialog(weld::Window* pParent);
virtual ~HangulHanjaNewDictDialog() override; virtual ~HangulHanjaNewDictDialog() override;
virtual void dispose() override;
bool GetName( OUString& _rRetName ) const; bool GetName( OUString& _rRetName ) const;
}; };
class SuggestionList; class SuggestionList;
class SuggestionEdit : public Edit class SuggestionEdit : public Edit
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.4 -->
<interface domain="cui"> <interface domain="cui">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="HangulHanjaAddDialog"> <object class="GtkDialog" id="HangulHanjaAddDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="hangulhanjaadddialog|HangulHanjaAddDialog">New Dictionary</property> <property name="title" translatable="yes" context="hangulhanjaadddialog|HangulHanjaAddDialog">New Dictionary</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
...@@ -145,5 +148,8 @@ ...@@ -145,5 +148,8 @@
<action-widget response="-6">cancel</action-widget> <action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
<child>
<placeholder/>
</child>
</object> </object>
</interface> </interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment