[Libreoffice-commits] core.git: cui/source cui/uiconfig cui/UIConfig_cui.mk include/sfx2 sfx2/source

Akshay Deep akshaydeepiitr at gmail.com
Mon Apr 4 09:08:08 UTC 2016


 cui/UIConfig_cui.mk                              |    1 
 cui/source/inc/cuires.hrc                        |    1 
 cui/source/options/optjava.cxx                   |   85 ++----------------
 cui/source/options/optjava.hxx                   |   21 ----
 cui/source/options/optjava.src                   |    5 +
 cui/uiconfig/ui/javastartparameterseditdialog.ui |  107 -----------------------
 include/sfx2/inputdlg.hxx                        |   46 +++++++++
 sfx2/source/dialog/backingwindow.cxx             |    2 
 sfx2/source/dialog/inputdlg.cxx                  |   17 +++
 sfx2/source/doc/templatedlg.cxx                  |   12 +-
 sfx2/source/inc/inputdlg.hxx                     |   42 ---------
 11 files changed, 87 insertions(+), 252 deletions(-)

New commits:
commit e099c5bdaa458105148059228ec11c98b9d13029
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date:   Tue Mar 29 03:41:05 2016 +0530

    Make InputDialog class global to reuse it's code and tdf#97425
    
    tdf#97425 -> Use InputDialog to edit Java Class Parameter
    
    Change-Id: I41ac9ffbc660c4bbb9d4fd3335e95d64ccdd2842
    Reviewed-on: https://gerrit.libreoffice.org/23580
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 697c701..b0f72cb 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -90,7 +90,6 @@ $(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 \
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index de91c47..658401d 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -136,6 +136,7 @@
 #define RID_SVXSTR_OPT_PROXYPORTS           (RID_SVX_START + 224)
 #define RID_SVXSTR_JRE_NOT_RECOGNIZED       (RID_SVX_START + 256)
 #define RID_SVXSTR_JRE_FAILED_VERSION       (RID_SVX_START + 257)
+#define RID_SVXSTR_JAVA_START_PARAM         (RID_SVX_START + 258)
 #define RID_SVXSTR_PATH_NAME_START          (RID_SVX_START + 1003)
 #define RID_SVXBMP_LOCK                     (RID_SVX_START + 118)
 #define RID_SVXSTR_READONLY_CONFIG_TIP      (RID_SVX_START + 1026)
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 6ab367a..b954b30 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -38,6 +38,7 @@
 #include "svtools/restartdialog.hxx"
 #include "svtools/treelistentry.hxx"
 #include <sfx2/filedlghelper.hxx>
+#include <sfx2/inputdlg.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -888,45 +889,25 @@ 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();
-        }
-    }
+        ScopedVclPtrInstance< InputDialog > m_pParamEditDlg( CUI_RES( RID_SVXSTR_JAVA_START_PARAM ).toString(), this);
+        OUString editableClassPath = m_pAssignedList->GetSelectEntry();
+        m_pParamEditDlg->SetEntryText( editableClassPath );
+        m_pParamEditDlg->HideHelpBtn();
 
-    if ( m_pParamEditDlg->Execute() == RET_OK )
-    {
-        if (!( editedClassPath == m_pParamEditDlg->GetParameter() ) )
+        if(!m_pParamEditDlg->Execute())
+            return;
+        OUString editedClassPath = comphelper::string::strip( m_pParamEditDlg->GetEntryText(), ' ');
+
+        if ( !editedClassPath.isEmpty() && editableClassPath != editedClassPath )
         {
-            editedClassPath = m_pParamEditDlg->GetParameter();
-            if( !editedClassPath.isEmpty() ){
-                m_pAssignedList->RemoveEntry( nPos );
-                m_pAssignedList->InsertEntry( editedClassPath, nPos );
-                m_pAssignedList->SelectEntryPos( nPos );
-            }
+            m_pAssignedList->RemoveEntry( nPos );
+            m_pAssignedList->InsertEntry( editedClassPath, nPos );
+            m_pAssignedList->SelectEntryPos( nPos );
         }
     }
-    else
-    {
-        m_pParamEditDlg->SetParameter( editedClassPath );
-    }
 }
 
 short SvxJavaParameterDlg::Execute()
@@ -969,46 +950,6 @@ void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
     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 const & strParams )
-{
-        m_pParameterEditField->SetText( strParams );
-        m_pParameterEditField->SetCursorAtLast();
-}
 
 // class SvxJavaClassPathDlg ---------------------------------------------
 
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index ca5ac45..85905df 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -43,7 +43,6 @@ typedef void* JavaInfo;
 #endif
 
 class   SvxJavaParameterDlg;
-class   SvxJavaParameterEditDlg;
 class   SvxJavaClassPathDlg;
 class   SvxJavaListBox;
 
@@ -130,8 +129,6 @@ 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);
@@ -177,24 +174,6 @@ public:
     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 const & rParams );
-};
-
 // class SvxJavaClassPathDlg ---------------------------------------------
 
 class SvxJavaClassPathDlg : public ModalDialog
diff --git a/cui/source/options/optjava.src b/cui/source/options/optjava.src
index 807cedc..f4e931a 100644
--- a/cui/source/options/optjava.src
+++ b/cui/source/options/optjava.src
@@ -35,4 +35,9 @@ String RID_SVXSTR_OPTIONS_RESTART
     Text [ en-US ] = "Please restart %PRODUCTNAME now so the new or modified values can take effect." ;
 };
 
+String RID_SVXSTR_JAVA_START_PARAM
+{
+    Text [ en-US ] = "Edit Parameter" ;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/javastartparameterseditdialog.ui b/cui/uiconfig/ui/javastartparameterseditdialog.ui
deleted file mode 100644
index 73ebe23..0000000
--- a/cui/uiconfig/ui/javastartparameterseditdialog.ui
+++ /dev/null
@@ -1,107 +0,0 @@
-<?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>
\ No newline at end of file
diff --git a/sfx2/source/inc/inputdlg.hxx b/include/sfx2/inputdlg.hxx
similarity index 81%
rename from sfx2/source/inc/inputdlg.hxx
rename to include/sfx2/inputdlg.hxx
index fb199a8..a2a1423 100644
--- a/sfx2/source/inc/inputdlg.hxx
+++ b/include/sfx2/inputdlg.hxx
@@ -11,17 +11,20 @@
 #define INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
 
 #include <vcl/dialog.hxx>
+#include <sfx2/dllapi.h>
 
 class Edit;
 class FixedText;
 class PushButton;
 class Button;
 
-class InputDialog : public ModalDialog
+class SFX2_DLLPUBLIC InputDialog : public ModalDialog
 {
 public:
     InputDialog (const OUString &labelText, vcl::Window *pParent = nullptr);
-    OUString getEntryText () const;
+    OUString GetEntryText () const;
+    void SetEntryText( OUString const & sStr );
+    void HideHelpBtn();
     virtual ~InputDialog();
     virtual void dispose() override;
 
@@ -35,6 +38,7 @@ private:
     VclPtr<FixedText>  m_pLabel;
     VclPtr<PushButton> m_pOK;
     VclPtr<PushButton> m_pCancel;
+    VclPtr<PushButton> m_pHelp;
 };
 
 #endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index f2c448e..bb3ec77 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -18,7 +18,7 @@
  */
 
 #include "backingwindow.hxx"
-#include "inputdlg.hxx"
+#include <sfx2/inputdlg.hxx>
 
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
index 8aa717d..427f286 100644
--- a/sfx2/source/dialog/inputdlg.cxx
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "inputdlg.hxx"
+#include <sfx2/inputdlg.hxx>
 
 #include <sfx2/sfxresid.hxx>
 #include <vcl/button.hxx>
@@ -21,6 +21,7 @@ InputDialog::InputDialog(const OUString &rLabelText, vcl::Window *pParent)
     get(m_pLabel, "label");
     get(m_pOK, "ok");
     get(m_pCancel, "cancel");
+    get(m_pHelp, "help");
     m_pLabel->SetText(rLabelText);
     m_pOK->SetClickHdl(LINK(this,InputDialog,ClickHdl));
     m_pCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl));
@@ -37,14 +38,26 @@ void InputDialog::dispose()
     m_pLabel.clear();
     m_pOK.clear();
     m_pCancel.clear();
+    m_pHelp.clear();
     ModalDialog::dispose();
 }
 
-OUString InputDialog::getEntryText() const
+void InputDialog::HideHelpBtn()
+{
+    m_pHelp->Hide();
+}
+
+OUString InputDialog::GetEntryText() const
 {
     return m_pEntry->GetText();
 }
 
+void InputDialog::SetEntryText( OUString const & sStr)
+{
+    m_pEntry->SetText(sStr);
+    m_pEntry->SetCursorAtLast();
+}
+
 IMPL_LINK_TYPED(InputDialog,ClickHdl, Button*, pButton, void)
 {
     EndDialog(pButton == m_pOK ? RET_OK : RET_CANCEL);
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index e008e95..c959c02 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -9,7 +9,7 @@
 
 #include <sfx2/templatedlg.hxx>
 
-#include "inputdlg.hxx"
+#include <sfx2/inputdlg.hxx>
 #include "templatesearchview.hxx"
 #include "templatesearchviewitem.hxx"
 
@@ -1266,7 +1266,7 @@ void SfxTemplateManagerDlg::OnFolderNew()
 
     if (ret)
     {
-        OUString aName = dlg->getEntryText();
+        OUString aName = dlg->GetEntryText();
 
         mpCurView->createRegion(aName);
     }
@@ -1331,7 +1331,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
 
     if (aDlg->Execute())
     {
-        OUString aName = aDlg->getEntryText();
+        OUString aName = aDlg->GetEntryText();
 
         if (!aName.isEmpty())
         {
@@ -1471,7 +1471,7 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId)
 
         if (ret)
         {
-            OUString aName = dlg->getEntryText();
+            OUString aName = dlg->GetEntryText();
 
             if (!aName.isEmpty())
                 nItemId = mpLocalView->createRegion(aName);
@@ -1519,7 +1519,7 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId)
 
         if (ret)
         {
-            OUString aName = dlg->getEntryText();
+            OUString aName = dlg->GetEntryText();
 
             if (!aName.isEmpty())
                 nItemId = mpLocalView->createRegion(aName);
@@ -1573,7 +1573,7 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId)
 
         if (ret)
         {
-            OUString aName = dlg->getEntryText();
+            OUString aName = dlg->GetEntryText();
 
             if (!aName.isEmpty())
                 nItemId = mpLocalView->createRegion(aName);


More information about the Libreoffice-commits mailing list