tdf#97425 - JVM start parameters should be editable.
Added new dialog to edit Java start Parameter. Modified UI of JavaStartParameterDialog using Glade. Renamed Assign Button to Add. Added a function to edit.cxx vcl file to move cursor to last letter of GTKEntry. Change-Id: Ia43e2c0fbced5674a84187de02a9bc9460141f2d Reviewed-on: https://gerrit.libreoffice.org/22220 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
@@ -90,6 +90,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
|
||||
cui/uiconfig/ui/insertrowcolumn \
|
||||
cui/uiconfig/ui/javaclasspathdialog \
|
||||
cui/uiconfig/ui/javastartparametersdialog \
|
||||
cui/uiconfig/ui/javastartparameterseditdialog \
|
||||
cui/uiconfig/ui/linedialog \
|
||||
cui/uiconfig/ui/linetabpage \
|
||||
cui/uiconfig/ui/lineendstabpage \
|
||||
|
||||
+104
-15
@@ -311,7 +311,10 @@ IMPL_LINK_NOARG_TYPED(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aParameterList = m_pParamDlg->GetParameters();
|
||||
m_pParamDlg->DisableButtons(); //disable add, edit and remove button when dialog is reopened
|
||||
}
|
||||
|
||||
if ( m_pParamDlg->Execute() == RET_OK )
|
||||
{
|
||||
@@ -844,17 +847,7 @@ IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, AssignHdl_Impl, Button*, void)
|
||||
|
||||
IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, EditHdl_Impl, Button*, void)
|
||||
{
|
||||
sal_Int32 nPos = m_pAssignedList->GetSelectEntryPos();
|
||||
|
||||
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
|
||||
{
|
||||
OUString eVal = m_pAssignedList->GetSelectEntry();
|
||||
m_pAssignedList->RemoveEntry( nPos );
|
||||
m_pParameterEdit->SetText( eVal );
|
||||
}
|
||||
DisableRemoveButton();
|
||||
DisableEditButton();
|
||||
EnableAssignButton();
|
||||
EditParameter();
|
||||
}
|
||||
|
||||
|
||||
@@ -867,9 +860,7 @@ IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, SelectHdl_Impl, ListBox&, void)
|
||||
|
||||
IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, DblClickHdl_Impl, ListBox&, void)
|
||||
{
|
||||
sal_Int32 nPos = m_pAssignedList->GetSelectEntryPos();
|
||||
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
|
||||
m_pParameterEdit->SetText( m_pAssignedList->GetEntry( nPos ) );
|
||||
EditParameter();
|
||||
}
|
||||
|
||||
|
||||
@@ -886,10 +877,58 @@ IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, RemoveHdl_Impl, Button*, void)
|
||||
nPos = ( nCount - 1 );
|
||||
m_pAssignedList->SelectEntryPos( nPos );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableEditButton();
|
||||
}
|
||||
}
|
||||
EnableRemoveButton();
|
||||
}
|
||||
|
||||
void SvxJavaParameterDlg::EditParameter()
|
||||
{
|
||||
sal_Int32 nPos = m_pAssignedList->GetSelectEntryPos();
|
||||
m_pParameterEdit->SetText( OUString() );
|
||||
OUString editedClassPath;
|
||||
|
||||
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
|
||||
{
|
||||
if ( !m_pParamEditDlg )
|
||||
{
|
||||
m_pParamEditDlg = VclPtr<SvxJavaParameterEditDlg>::Create( this );
|
||||
editedClassPath = m_pAssignedList->GetSelectEntry();
|
||||
m_pParamEditDlg->SetParameter( editedClassPath );
|
||||
}
|
||||
else{
|
||||
editedClassPath = m_pAssignedList->GetSelectEntry();
|
||||
m_pParamEditDlg->SetParameter( editedClassPath );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_pParamEditDlg)
|
||||
{
|
||||
editedClassPath = m_pParamEditDlg->GetParameter();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_pParamEditDlg->Execute() == RET_OK )
|
||||
{
|
||||
if (!( editedClassPath == m_pParamEditDlg->GetParameter() ) )
|
||||
{
|
||||
editedClassPath = m_pParamEditDlg->GetParameter();
|
||||
if( !editedClassPath.isEmpty() ){
|
||||
m_pAssignedList->RemoveEntry( nPos );
|
||||
m_pAssignedList->InsertEntry( editedClassPath, nPos );
|
||||
m_pAssignedList->SelectEntryPos( nPos );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pParamEditDlg->SetParameter( editedClassPath );
|
||||
}
|
||||
}
|
||||
|
||||
short SvxJavaParameterDlg::Execute()
|
||||
{
|
||||
@@ -905,11 +944,18 @@ Sequence< OUString > SvxJavaParameterDlg::GetParameters() const
|
||||
Sequence< OUString > aParamList( nCount );
|
||||
OUString* pArray = aParamList.getArray();
|
||||
for ( sal_Int32 i = 0; i < nCount; ++i )
|
||||
pArray[i] = m_pAssignedList->GetEntry(i);
|
||||
pArray[i] = OUString( m_pAssignedList->GetEntry(i) );
|
||||
return aParamList;
|
||||
}
|
||||
|
||||
|
||||
void SvxJavaParameterDlg::DisableButtons()
|
||||
{
|
||||
DisableAssignButton();
|
||||
DisableEditButton();
|
||||
DisableRemoveButton();
|
||||
}
|
||||
|
||||
void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
|
||||
{
|
||||
m_pAssignedList->Clear();
|
||||
@@ -920,6 +966,49 @@ void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
|
||||
OUString sParam = OUString( *pArray++ );
|
||||
m_pAssignedList->InsertEntry( sParam );
|
||||
}
|
||||
DisableEditButton();
|
||||
DisableRemoveButton();
|
||||
}
|
||||
|
||||
// class SvxJavaParameterEditDlg ---------------------------------------------
|
||||
|
||||
SvxJavaParameterEditDlg::SvxJavaParameterEditDlg( vcl::Window* pParent ) :
|
||||
|
||||
ModalDialog( pParent, "JavaStartParametersEdit",
|
||||
"cui/ui/javastartparameterseditdialog.ui" )
|
||||
{
|
||||
get( m_pParameterEditField, "parametereditfield");
|
||||
}
|
||||
|
||||
SvxJavaParameterEditDlg::~SvxJavaParameterEditDlg()
|
||||
{
|
||||
disposeOnce();
|
||||
}
|
||||
|
||||
void SvxJavaParameterEditDlg::dispose()
|
||||
{
|
||||
m_pParameterEditField.clear();
|
||||
ModalDialog::dispose();
|
||||
}
|
||||
|
||||
|
||||
short SvxJavaParameterEditDlg::Execute()
|
||||
{
|
||||
m_pParameterEditField->GrabFocus();
|
||||
return ModalDialog::Execute();
|
||||
}
|
||||
|
||||
OUString SvxJavaParameterEditDlg::GetParameter() const
|
||||
{
|
||||
OUString sParamEdit = comphelper::string::strip(m_pParameterEditField->GetText(), ' ');
|
||||
return sParamEdit;
|
||||
}
|
||||
|
||||
|
||||
void SvxJavaParameterEditDlg::SetParameter( OUString strParams )
|
||||
{
|
||||
m_pParameterEditField->SetText( strParams );
|
||||
m_pParameterEditField->SetCursorAtLast();
|
||||
}
|
||||
|
||||
// class SvxJavaClassPathDlg ---------------------------------------------
|
||||
|
||||
@@ -43,6 +43,7 @@ typedef void* JavaInfo;
|
||||
#endif
|
||||
|
||||
class SvxJavaParameterDlg;
|
||||
class SvxJavaParameterEditDlg;
|
||||
class SvxJavaClassPathDlg;
|
||||
class SvxJavaListBox;
|
||||
|
||||
@@ -129,6 +130,8 @@ private:
|
||||
|
||||
VclPtr<PushButton> m_pEditBtn;
|
||||
|
||||
VclPtr<SvxJavaParameterEditDlg> m_pParamEditDlg;
|
||||
|
||||
DECL_LINK_TYPED(ModifyHdl_Impl, Edit&, void);
|
||||
DECL_LINK_TYPED(AssignHdl_Impl, Button*, void);
|
||||
DECL_LINK_TYPED(SelectHdl_Impl, ListBox&, void);
|
||||
@@ -151,6 +154,9 @@ private:
|
||||
inline void EnableAssignButton()
|
||||
{ m_pAssignBtn->Enable(); }
|
||||
|
||||
inline void DisableAssignButton()
|
||||
{ m_pAssignBtn->Disable(); }
|
||||
|
||||
inline void DisableRemoveButton()
|
||||
{ m_pRemoveBtn->Disable(); }
|
||||
|
||||
@@ -167,6 +173,26 @@ public:
|
||||
|
||||
css::uno::Sequence< OUString > GetParameters() const;
|
||||
void SetParameters( css::uno::Sequence< OUString >& rParams );
|
||||
void DisableButtons();
|
||||
void EditParameter();
|
||||
};
|
||||
|
||||
// class SvxJavaParameterEditDlg ---------------------------------------------
|
||||
|
||||
class SvxJavaParameterEditDlg : public ModalDialog
|
||||
{
|
||||
private:
|
||||
VclPtr<Edit> m_pParameterEditField;
|
||||
|
||||
public:
|
||||
explicit SvxJavaParameterEditDlg( vcl::Window* pParent );
|
||||
virtual ~SvxJavaParameterEditDlg();
|
||||
virtual void dispose() override;
|
||||
|
||||
virtual short Execute() override;
|
||||
|
||||
OUString GetParameter() const;
|
||||
void SetParameter( OUString rParams );
|
||||
};
|
||||
|
||||
// class SvxJavaClassPathDlg ---------------------------------------------
|
||||
|
||||
@@ -165,11 +165,13 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="assignbtn">
|
||||
<property name="label" translatable="yes">_Assign</property>
|
||||
<property name="label" translatable="yes">_Add</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0.49000000953674316</property>
|
||||
<property name="yalign">0.49000000953674316</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@@ -177,33 +179,46 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="removebtn">
|
||||
<property name="label" translatable="yes">_Remove</property>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="editbtn">
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="removebtn">
|
||||
<property name="label" translatable="yes">_Remove</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="editbtn">
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.0"/>
|
||||
<object class="GtkDialog" id="JavaStartParametersEdit">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Edit Parameter</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="ok">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="parametereditfield">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">ok</action-widget>
|
||||
<action-widget response="0">cancel</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -237,6 +237,8 @@ public:
|
||||
virtual void SetText( const OUString& rStr, const Selection& rNewSelection );
|
||||
virtual OUString GetText() const override;
|
||||
|
||||
void SetCursorAtLast();
|
||||
|
||||
void SetPlaceholderText( const OUString& rStr );
|
||||
OUString GetPlaceholderText() const;
|
||||
|
||||
|
||||
@@ -2699,6 +2699,12 @@ OUString Edit::GetText() const
|
||||
return maText.toString();
|
||||
}
|
||||
|
||||
void Edit::SetCursorAtLast(){
|
||||
OUString str = GetText();
|
||||
sal_Int32 len = str.getLength();
|
||||
ImplSetCursorPos( len, false );
|
||||
}
|
||||
|
||||
void Edit::SetPlaceholderText( const OUString& rStr )
|
||||
{
|
||||
if ( mpSubEdit )
|
||||
|
||||
Reference in New Issue
Block a user