[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - 3 commits - include/svtools svtools/source svtools/uiconfig

Szymon Kłos eszkadev at gmail.com
Thu Jun 4 09:59:59 PDT 2015


 include/svtools/RemoteFilesDialog.hxx        |   33 +++-
 svtools/source/dialogs/RemoteFilesDialog.cxx |  217 ++++++++++++++++++++++++++-
 svtools/uiconfig/ui/remotefilesdialog.ui     |   73 ++++++++-
 3 files changed, 310 insertions(+), 13 deletions(-)

New commits:
commit e7359daa22f58bac005cb3d455fd4acd5353bd01
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jun 4 18:58:11 2015 +0200

    empty TreeListBox & splitter
    
    Change-Id: I948b62bade41b7b7998d0e22c10c1169d78ec506

diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index 0ae497f..aac99ba 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -19,6 +19,8 @@
 #include <vcl/lstbox.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/vclptr.hxx>
+#include <vcl/split.hxx>
+#include <vcl/svapp.hxx>
 
 #include <svtools/fileview.hxx>
 #include <svtools/treelistentry.hxx>
@@ -51,7 +53,7 @@ class SVT_DLLPUBLIC RemoteFilesDialog : public ModalDialog
 {
 public:
     RemoteFilesDialog(vcl::Window* pParent, WinBits nBits);
-    ~RemoteFilesDialog();
+    virtual ~RemoteFilesDialog();
 
     virtual void dispose() SAL_OVERRIDE;
     virtual void Resize() SAL_OVERRIDE;
@@ -70,6 +72,8 @@ private:
     VclPtr<MenuButton> m_pAddService_btn;
     VclPtr<ListBox> m_pServices_lb;
     VclPtr<Edit> m_pPath_ed;
+    VclPtr<Splitter> m_pSplitter;
+    VclPtr<SvTreeListBox> m_pTreeView;
     VclPtr<SvtFileView> m_pFileView;
     VclPtr<FileViewContainer> m_pContainer;
     VclPtr<ListBox> m_pFilter_lb;
@@ -92,6 +96,8 @@ private:
 
     DECL_LINK( DoubleClickHdl, void * );
     DECL_LINK( SelectHdl, void * );
+
+    DECL_LINK( SplitHdl, void * );
 };
 
 #endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index f13aa2d..5976ea6 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -17,11 +17,15 @@ class FileViewContainer : public vcl::Window
 {
     private:
     VclPtr<SvtFileView> m_pFileView;
+    VclPtr<SvTreeListBox> m_pTreeView;
+    VclPtr<Splitter> m_pSplitter;
 
     public:
     FileViewContainer(vcl::Window *pParent)
         : Window(pParent)
         , m_pFileView(NULL)
+        , m_pTreeView(NULL)
+        , m_pSplitter(NULL)
     {
     }
 
@@ -33,29 +37,51 @@ class FileViewContainer : public vcl::Window
     virtual void dispose() SAL_OVERRIDE
     {
         m_pFileView.clear();
+        m_pSplitter.clear();
         vcl::Window::dispose();
     }
 
-    void init(SvtFileView* pFileView)
+    void init(SvtFileView* pFileView,
+              Splitter* pSplitter,
+              SvTreeListBox* pTreeView)
     {
         m_pFileView = pFileView;
+        m_pTreeView = pTreeView;
+        m_pSplitter = pSplitter;
     }
 
     virtual void Resize() SAL_OVERRIDE
     {
         Window::Resize();
 
-        if(!m_pFileView)
+        if(!m_pFileView || !m_pTreeView)
             return;
 
         Size aSize = GetSizePixel();
-        m_pFileView->SetSizePixel( aSize );
+        Point aPos( m_pFileView->GetPosPixel() );
+        Size aNewSize(aSize.Width() - aPos.X(), aSize.Height());
+
+        m_pFileView->SetSizePixel( aNewSize );
+
+        // Resize the Splitter to fit the height
+        Size splitterNewSize = m_pSplitter->GetSizePixel( );
+        splitterNewSize.Height() = aSize.Height();
+        m_pSplitter->SetSizePixel( splitterNewSize );
+        sal_Int32 nMinX = m_pTreeView->GetPosPixel( ).X( );
+        sal_Int32 nMaxX = m_pFileView->GetPosPixel( ).X( ) + m_pFileView->GetSizePixel( ).Width() - nMinX;
+        m_pSplitter->SetDragRectPixel( Rectangle( Point( nMinX, 0 ), Size( nMaxX, aSize.Width() ) ) );
+
+        // Resize the tree list box to fit the height of the FileView
+        Size placesNewSize(m_pTreeView->GetSizePixel());
+        placesNewSize.Height() = aSize.Height();
+        m_pTreeView->SetSizePixel( placesNewSize );
     }
 };
 
 RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     : ModalDialog(pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui")
     , m_context(comphelper::getProcessComponentContext())
+    , m_pSplitter(NULL)
     , m_pFileView(NULL)
     , m_pContainer(NULL)
 {
@@ -98,7 +124,24 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) );
     m_pFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) );
 
-    m_pContainer->init(m_pFileView);
+    m_pSplitter = VclPtr<Splitter>::Create( m_pContainer, WB_HSCROLL );
+    m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
+    m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) );
+    m_pSplitter->Show();
+
+    m_pTreeView = VclPtr<SvTreeListBox>::Create( m_pContainer, WB_BORDER );
+    Size aSize(100, 200);
+    m_pTreeView->set_height_request(aSize.Height());
+    m_pTreeView->set_width_request(aSize.Width());
+    m_pTreeView->SetSizePixel(aSize);
+    m_pTreeView->Show();
+
+    sal_Int32 nPosX = m_pTreeView->GetSizePixel().Width();
+    m_pSplitter->SetPosPixel(Point(nPosX, 0));
+    nPosX += m_pSplitter->GetSizePixel().Width();
+    m_pFileView->SetPosPixel(Point(nPosX, 0));
+
+    m_pContainer->init(m_pFileView, m_pSplitter, m_pTreeView);
     m_pContainer->Show();
 
     m_pAddService_btn->SetMenuMode(MENUBUTTON_MENUMODE_TIMED);
@@ -120,6 +163,8 @@ RemoteFilesDialog::~RemoteFilesDialog()
 
 void RemoteFilesDialog::dispose()
 {
+    m_pFileView->SetSelectHdl( Link<>() );
+
     if(m_bIsUpdated)
     {
         Sequence< OUString > placesUrlsList(m_aServices.size());
@@ -139,6 +184,20 @@ void RemoteFilesDialog::dispose()
         batch->commit();
     }
 
+    m_pTreeView.disposeAndClear();
+    m_pFileView.disposeAndClear();
+    m_pSplitter.disposeAndClear();
+    m_pContainer.disposeAndClear();
+
+    m_pOpen_btn.clear();
+    m_pSave_btn.clear();
+    m_pCancel_btn.clear();
+    m_pAddService_btn.clear();
+    m_pServices_lb.clear();
+    m_pPath_ed.clear();
+    m_pFilter_lb.clear();
+    m_pName_ed.clear();
+
     ModalDialog::dispose();
 }
 
@@ -347,4 +406,28 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
     return 1;
 }
 
+IMPL_LINK_NOARG ( RemoteFilesDialog, SplitHdl )
+{
+    sal_Int32 nSplitPos = m_pSplitter->GetSplitPosPixel();
+
+    // Resize the tree list box
+    sal_Int32 nPlaceX = m_pTreeView->GetPosPixel( ).X();
+    Size placeSize = m_pTreeView->GetSizePixel( );
+    placeSize.Width() = nSplitPos - nPlaceX;
+    m_pTreeView->SetSizePixel( placeSize );
+
+    // Change Pos and size of the fileview
+    Point fileViewPos = m_pFileView->GetPosPixel();
+    sal_Int32 nOldX = fileViewPos.X();
+    sal_Int32 nNewX = nSplitPos + m_pSplitter->GetSizePixel().Width();
+    fileViewPos.X() = nNewX;
+    Size fileViewSize = m_pFileView->GetSizePixel();
+    fileViewSize.Width() -= ( nNewX - nOldX );
+    m_pFileView->SetPosSizePixel( fileViewPos, fileViewSize );
+
+    m_pSplitter->SetPosPixel( Point( placeSize.Width(), m_pSplitter->GetPosPixel().Y() ) );
+
+    return 1;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4be199c8dab2f3ebd6adb9701a4076b8bbdb29c3
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jun 4 16:39:44 2015 +0200

    added fields for name and filters
    
    Change-Id: I758bb4e1009c44aad7f4f5d3d0e07939b9962ce5

diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index 2ad82af..0ae497f 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -21,6 +21,7 @@
 #include <vcl/vclptr.hxx>
 
 #include <svtools/fileview.hxx>
+#include <svtools/treelistentry.hxx>
 
 #include <officecfg/Office/Common.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
@@ -71,6 +72,8 @@ private:
     VclPtr<Edit> m_pPath_ed;
     VclPtr<SvtFileView> m_pFileView;
     VclPtr<FileViewContainer> m_pContainer;
+    VclPtr<ListBox> m_pFilter_lb;
+    VclPtr<Edit> m_pName_ed;
 
     std::vector<ServicePtr> m_aServices;
 
@@ -79,6 +82,8 @@ private:
     /* If failure returns < 0 */
     int GetSelectedServicePos();
 
+    OUString getCurrentFilter();
+
     void OpenURL( OUString sURL );
 
     DECL_LINK ( AddServiceHdl, void * );
@@ -86,6 +91,7 @@ private:
     DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void );
 
     DECL_LINK( DoubleClickHdl, void * );
+    DECL_LINK( SelectHdl, void * );
 };
 
 #endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 98ace3d..f13aa2d 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -11,7 +11,7 @@
 
 using namespace ::com::sun::star::uno;
 
-#define NO_FILTER "*.*"
+#define FILTER_ALL "*.*"
 
 class FileViewContainer : public vcl::Window
 {
@@ -65,6 +65,8 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     get(m_pAddService_btn, "add_service_btn");
     get(m_pServices_lb, "services_lb");
     get(m_pPath_ed, "path");
+    get(m_pFilter_lb, "filter_lb");
+    get(m_pName_ed, "name_ed");
 
     m_eMode = (nBits & WB_SAVEAS) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
     m_eType = (nBits & WB_PATH) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
@@ -94,6 +96,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     m_pFileView->Show();
     m_pFileView->EnableAutoResize();
     m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) );
+    m_pFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) );
 
     m_pContainer->init(m_pFileView);
     m_pContainer->Show();
@@ -105,6 +108,9 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     FillServicesListbox();
 
     m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );
+
+    m_pFilter_lb->InsertEntry(FILTER_ALL);
+    m_pFilter_lb->SelectEntryPos(0);
 }
 
 RemoteFilesDialog::~RemoteFilesDialog()
@@ -196,16 +202,26 @@ int RemoteFilesDialog::GetSelectedServicePos()
     return nPos;
 }
 
+OUString RemoteFilesDialog::getCurrentFilter()
+{
+    OUString sFilter;
+
+    sFilter = m_pFilter_lb->GetSelectEntry();
+
+    return sFilter;
+}
+
 void RemoteFilesDialog::OpenURL( OUString sURL )
 {
     if(m_pFileView)
     {
         OUStringList BlackList;
         FileViewResult eResult = eFailure;
+        OUString sFilter = getCurrentFilter();
 
         m_pFileView->EndInplaceEditing( false );
         m_pPath_ed->SetText( sURL );
-        eResult = m_pFileView->Initialize( sURL, NO_FILTER, NULL, BlackList );
+        eResult = m_pFileView->Initialize( sURL, sFilter, NULL, BlackList );
     }
 }
 
@@ -320,4 +336,15 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl )
     return 1;
 }
 
+IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
+{
+    SvTreeListEntry* pEntry = m_pFileView->FirstSelected();
+    SvtContentEntry* pData = static_cast<SvtContentEntry*>(pEntry->GetUserData());
+
+    INetURLObject aURL(pData->maURL);
+    m_pName_ed->SetText(aURL.GetLastName());
+
+    return 1;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/uiconfig/ui/remotefilesdialog.ui b/svtools/uiconfig/ui/remotefilesdialog.ui
index 62ce906..c79b10b 100644
--- a/svtools/uiconfig/ui/remotefilesdialog.ui
+++ b/svtools/uiconfig/ui/remotefilesdialog.ui
@@ -65,7 +65,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">3</property>
+            <property name="position">4</property>
           </packing>
         </child>
         <child>
@@ -152,6 +152,65 @@
             <property name="position">2</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="filterLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Filter</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="nameLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Full name</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="name_ed">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="filter_lb">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
       </object>
     </child>
   </object>
commit bc61a37e91d396cf204b0b3123c61f0c20789c51
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jun 4 14:59:20 2015 +0200

    new dialog type flags, resizable fileView
    
    Change-Id: I1052b5edef3fa35678bcf2a6a4ac58090fd9e507

diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index ac96658..2ad82af 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -27,26 +27,40 @@
 
 #include <vector>
 
+#define WB_MULTISELECTION 0x20000000L
+
 enum SvtRemoteDlgMode
 {
     REMOTEDLG_MODE_OPEN = 0,
     REMOTEDLG_MODE_SAVE = 1
 };
 
+enum SvtRemoteDlgType
+{
+    REMOTEDLG_TYPE_FILEDLG = 0,
+    REMOTEDLG_TYPE_PATHDLG = 1
+};
+
 typedef std::shared_ptr<Place> ServicePtr;
 typedef ::com::sun::star::uno::Sequence<OUString>  OUStringList;
 
+class FileViewContainer;
+
 class SVT_DLLPUBLIC RemoteFilesDialog : public ModalDialog
 {
 public:
     RemoteFilesDialog(vcl::Window* pParent, WinBits nBits);
+    ~RemoteFilesDialog();
 
     virtual void dispose() SAL_OVERRIDE;
+    virtual void Resize() SAL_OVERRIDE;
 
 private:
     ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_context;
 
     SvtRemoteDlgMode m_eMode;
+    SvtRemoteDlgType m_eType;
+    bool m_bMultiselection;
     bool m_bIsUpdated;
 
     VclPtr<PushButton> m_pOpen_btn;
@@ -55,7 +69,8 @@ private:
     VclPtr<MenuButton> m_pAddService_btn;
     VclPtr<ListBox> m_pServices_lb;
     VclPtr<Edit> m_pPath_ed;
-    VclPtr<SvtFileView> m_pView;
+    VclPtr<SvtFileView> m_pFileView;
+    VclPtr<FileViewContainer> m_pContainer;
 
     std::vector<ServicePtr> m_aServices;
 
@@ -64,9 +79,13 @@ private:
     /* If failure returns < 0 */
     int GetSelectedServicePos();
 
+    void OpenURL( OUString sURL );
+
     DECL_LINK ( AddServiceHdl, void * );
     DECL_LINK ( SelectServiceHdl, void * );
     DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void );
+
+    DECL_LINK( DoubleClickHdl, void * );
 };
 
 #endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index db3ab1a..98ace3d 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -13,9 +13,51 @@ using namespace ::com::sun::star::uno;
 
 #define NO_FILTER "*.*"
 
+class FileViewContainer : public vcl::Window
+{
+    private:
+    VclPtr<SvtFileView> m_pFileView;
+
+    public:
+    FileViewContainer(vcl::Window *pParent)
+        : Window(pParent)
+        , m_pFileView(NULL)
+    {
+    }
+
+    virtual ~FileViewContainer()
+    {
+        disposeOnce();
+    }
+
+    virtual void dispose() SAL_OVERRIDE
+    {
+        m_pFileView.clear();
+        vcl::Window::dispose();
+    }
+
+    void init(SvtFileView* pFileView)
+    {
+        m_pFileView = pFileView;
+    }
+
+    virtual void Resize() SAL_OVERRIDE
+    {
+        Window::Resize();
+
+        if(!m_pFileView)
+            return;
+
+        Size aSize = GetSizePixel();
+        m_pFileView->SetSizePixel( aSize );
+    }
+};
+
 RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     : ModalDialog(pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui")
     , m_context(comphelper::getProcessComponentContext())
+    , m_pFileView(NULL)
+    , m_pContainer(NULL)
 {
     get(m_pOpen_btn, "open");
     get(m_pSave_btn, "save");
@@ -23,9 +65,10 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     get(m_pAddService_btn, "add_service_btn");
     get(m_pServices_lb, "services_lb");
     get(m_pPath_ed, "path");
-    get(m_pView, "files");
 
     m_eMode = (nBits & WB_SAVEAS) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
+    m_eType = (nBits & WB_PATH) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
+    m_bMultiselection = (nBits & WB_MULTISELECTION) ? true : false;
     m_bIsUpdated = false;
 
     if(m_eMode == REMOTEDLG_MODE_OPEN)
@@ -39,6 +82,22 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
         m_pOpen_btn->Hide();
     }
 
+    m_pContainer = VclPtr<FileViewContainer>::Create( get<vcl::Window>("container") );
+
+    m_pContainer->set_hexpand(true);
+    m_pContainer->set_vexpand(true);
+
+    m_pFileView = VclPtr<SvtFileView>::Create( m_pContainer, WB_BORDER,
+                                       REMOTEDLG_TYPE_PATHDLG == m_eType,
+                                       m_bMultiselection );
+
+    m_pFileView->Show();
+    m_pFileView->EnableAutoResize();
+    m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) );
+
+    m_pContainer->init(m_pFileView);
+    m_pContainer->Show();
+
     m_pAddService_btn->SetMenuMode(MENUBUTTON_MENUMODE_TIMED);
     m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
     m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) );
@@ -48,6 +107,11 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );
 }
 
+RemoteFilesDialog::~RemoteFilesDialog()
+{
+    disposeOnce();
+}
+
 void RemoteFilesDialog::dispose()
 {
     if(m_bIsUpdated)
@@ -72,6 +136,17 @@ void RemoteFilesDialog::dispose()
     ModalDialog::dispose();
 }
 
+void RemoteFilesDialog::Resize()
+{
+    ModalDialog::Resize();
+
+    if(m_pFileView && m_pContainer)
+    {
+        Size aSize = m_pContainer->GetSizePixel();
+        m_pFileView->SetSizePixel(aSize);
+    }
+}
+
 void RemoteFilesDialog::FillServicesListbox()
 {
     m_pServices_lb->Clear();
@@ -121,6 +196,19 @@ int RemoteFilesDialog::GetSelectedServicePos()
     return nPos;
 }
 
+void RemoteFilesDialog::OpenURL( OUString sURL )
+{
+    if(m_pFileView)
+    {
+        OUStringList BlackList;
+        FileViewResult eResult = eFailure;
+
+        m_pFileView->EndInplaceEditing( false );
+        m_pPath_ed->SetText( sURL );
+        eResult = m_pFileView->Initialize( sURL, NO_FILTER, NULL, BlackList );
+    }
+}
+
 IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
 {
     ScopedVclPtrInstance< PlaceEditDialog > aDlg(this);
@@ -154,13 +242,9 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl )
 
     if(nPos > 0)
     {
-        OUStringList BlackList;
         OUString sURL = m_aServices[nPos]->GetUrl();
-        FileViewResult eResult = eFailure;
-
-        m_pPath_ed->SetText(sURL);
 
-        eResult = m_pView->Initialize( sURL, NO_FILTER, NULL, BlackList );
+        OpenURL( sURL );
     }
 
     return 1;
@@ -227,4 +311,13 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
     }
 }
 
+IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl )
+{
+    OUString sURL = m_pFileView->GetCurrentURL();
+
+    OpenURL( sURL );
+
+    return 1;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/uiconfig/ui/remotefilesdialog.ui b/svtools/uiconfig/ui/remotefilesdialog.ui
index 0c59369..62ce906 100644
--- a/svtools/uiconfig/ui/remotefilesdialog.ui
+++ b/svtools/uiconfig/ui/remotefilesdialog.ui
@@ -2,7 +2,6 @@
 <!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkDialog" id="RemoteFilesDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -135,11 +134,16 @@
           </packing>
         </child>
         <child>
-          <object class="svtlo-SvtFileView" id="files">
+          <object class="GtkBox" id="container">
+            <property name="width_request">500</property>
+            <property name="height_request">200</property>
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <child internal-child="selection">
-              <object class="GtkTreeSelection" id="File View-selection1"/>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <placeholder/>
             </child>
           </object>
           <packing>


More information about the Libreoffice-commits mailing list