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
IMPL_LINK_NOARG(HangulHanjaOptionsDialog, NewDictHdl, Button*, void)
{
OUString aName;
ScopedVclPtrInstance< HangulHanjaNewDictDialog > aNewDlg(this);
aNewDlg->Execute();
if( aNewDlg->GetName( aName ) )
HangulHanjaNewDictDialog aNewDlg(GetFrameWeld());
aNewDlg.run();
if (aNewDlg.GetName(aName))
{
if( m_xConversionDictionaryList.is() )
{
......@@ -1176,51 +1176,42 @@ namespace svx
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();
if( m_bEntered )
m_pDictNameED->SetText( aName ); // do this in case of trailing chars have been deleted
if (m_bEntered)
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)
: ModalDialog(pParent, "HangulHanjaAddDialog", "cui/ui/hangulhanjaadddialog.ui")
HangulHanjaNewDictDialog::HangulHanjaNewDictDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/hangulhanjaadddialog.ui", "HangulHanjaAddDialog")
, m_bEntered(false)
, m_xOkBtn(m_xBuilder->weld_button("ok"))
, m_xDictNameED(m_xBuilder->weld_entry("entry"))
{
get(m_pOkBtn, "ok");
get(m_pDictNameED, "entry");
m_pOkBtn->SetClickHdl( LINK( this, HangulHanjaNewDictDialog, OKHdl ) );
m_pDictNameED->SetModifyHdl( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
m_xOkBtn->connect_clicked( LINK( this, HangulHanjaNewDictDialog, OKHdl ) );
m_xDictNameED->connect_changed( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
}
HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog()
{
disposeOnce();
}
void HangulHanjaNewDictDialog::dispose()
{
m_pDictNameED.clear();
m_pOkBtn.clear();
ModalDialog::dispose();
}
bool HangulHanjaNewDictDialog::GetName( OUString& _rRetName ) const
{
if( m_bEntered )
_rRetName = comphelper::string::stripEnd(m_pDictNameED->GetText(), ' ');
_rRetName = comphelper::string::stripEnd(m_xDictNameED->get_text(), ' ');
return m_bEntered;
}
......
......@@ -25,6 +25,7 @@
#include <vcl/combobox.hxx>
#include <vcl/fixed.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/weld.hxx>
#include <svx/checklbx.hxx>
#include <editeng/hangulhanja.hxx>
#include <com/sun/star/uno/Sequence.hxx>
......@@ -225,26 +226,23 @@ namespace svx
void AddDict( const OUString& _rName, bool _bChecked );
};
class HangulHanjaNewDictDialog : public ModalDialog
class HangulHanjaNewDictDialog : public weld::GenericDialogController
{
private:
VclPtr<Edit> m_pDictNameED;
VclPtr<OKButton> m_pOkBtn;
bool m_bEntered;
DECL_LINK( OKHdl, Button*, void );
DECL_LINK( ModifyHdl, Edit&, void );
std::unique_ptr<weld::Button> m_xOkBtn;
std::unique_ptr<weld::Entry> m_xDictNameED;
DECL_LINK(OKHdl, weld::Button&, void);
DECL_LINK(ModifyHdl, weld::Entry&, void);
public:
HangulHanjaNewDictDialog( vcl::Window* _pParent );
HangulHanjaNewDictDialog(weld::Window* pParent);
virtual ~HangulHanjaNewDictDialog() override;
virtual void dispose() override;
bool GetName( OUString& _rRetName ) const;
};
class SuggestionList;
class SuggestionEdit : public Edit
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.4 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="HangulHanjaAddDialog">
<property name="can_focus">False</property>
<property name="border_width">6</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>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
......@@ -145,5 +148,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</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