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

Szymon Kłos eszkadev at gmail.com
Fri Aug 7 09:34:48 PDT 2015


 fpicker/source/office/RemoteFilesDialog.cxx |   46 ++++++++++++++++++++++++++--
 fpicker/source/office/RemoteFilesDialog.hxx |    8 ++++
 fpicker/source/office/fpsofficeResMgr.hxx   |    2 -
 fpicker/source/office/iodlg.cxx             |    1 
 fpicker/uiconfig/ui/remotefilesdialog.ui    |   38 +++++++++++++++++++++--
 5 files changed, 88 insertions(+), 7 deletions(-)

New commits:
commit 14c0e9a2efd6b5c2517639acee22b4a903e214b6
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Fri Aug 7 18:32:32 2015 +0200

    added New Folder button
    
    Change-Id: I4b1ef03e707fdfb3d1968dca9f48c548f872612c

diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index bfdb3a6..cc96e02 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -183,6 +183,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     get( m_pServices_lb, "services_lb" );
     get( m_pFilter_lb, "filter_lb" );
     get( m_pName_ed, "name_ed" );
+    get( m_pNewFolder, "new_folder" );
 
     m_eMode = ( nBits & WB_SAVEAS ) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
     m_eType = ( nBits & WB_PATH ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
@@ -196,10 +197,20 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     m_pName_ed->Enable( false );
 
     if( m_eMode == REMOTEDLG_MODE_OPEN )
+    {
         get( m_pOk_btn, "open" );
+
+        m_pNewFolder->Hide();
+    }
     else
+    {
         get( m_pOk_btn, "save" );
 
+        m_aImages = ImageList( fpicker::SvtResId( RID_FILEPICKER_IMAGES ) );
+        m_pNewFolder->SetModeImage( m_aImages.GetImage( IMG_FILEDLG_CREATEFOLDER ) );
+        m_pNewFolder->SetClickHdl( LINK( this, RemoteFilesDialog, NewFolderHdl ) );
+    }
+
     m_pOk_btn->Show();
     m_pOk_btn->Enable( false );
 
@@ -324,6 +335,7 @@ void RemoteFilesDialog::dispose()
     m_pServices_lb.clear();
     m_pFilter_lb.clear();
     m_pName_ed.clear();
+    m_pNewFolder.clear();
 
     ModalDialog::dispose();
 }
@@ -876,6 +888,34 @@ IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr )
     return 1;
 }
 
+IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl )
+{
+    m_pFileView->EndInplaceEditing( false );
+
+    SmartContent aContent( m_pFileView->GetViewURL() );
+    OUString aTitle;
+    aContent.getTitle( aTitle );
+    ScopedVclPtrInstance< QueryFolderNameDialog > aDlg( this, aTitle, fpicker::SVT_RESSTR( STR_SVT_NEW_FOLDER ) );
+    bool bHandled = false;
+
+    while( !bHandled )
+    {
+        if( aDlg->Execute() == RET_OK )
+        {
+            OUString aUrl = aContent.createFolder( aDlg->GetName() );
+            if( !aUrl.isEmpty() )
+            {
+                m_pFileView->CreatedFolder( aUrl, aDlg->GetName() );
+                bHandled = true;
+            }
+        }
+        else
+            bHandled = true;
+    }
+
+    return 1;
+}
+
 IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
 {
     // auto extension
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 65e4ef2..72bf1b7 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -37,6 +37,9 @@
 
 #include "fpdialogbase.hxx"
 #include "fpsofficeResMgr.hxx"
+#include "OfficeFilePicker.hrc"
+#include "QueryFolderName.hxx"
+#include "iodlg.hrc"
 
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::uno;
@@ -143,6 +146,7 @@ private:
     VclPtr< MenuButton > m_pAddService_btn;
     VclPtr< ListBox > m_pServices_lb;
     VclPtr< Breadcrumb > m_pPath;
+    VclPtr<PushButton> m_pNewFolder;
     VclPtr< Splitter > m_pSplitter;
     VclPtr< FolderTree > m_pTreeView;
     VclPtr< SvtFileView > m_pFileView;
@@ -151,6 +155,8 @@ private:
     VclPtr< Edit > m_pName_ed;
     PopupMenu* m_pAddMenu;
 
+    ImageList m_aImages;
+
     std::vector< ServicePtr > m_aServices;
     std::vector< std::pair< OUString, OUString > > m_aFilters;
 
@@ -186,6 +192,8 @@ private:
 
     DECL_LINK( SelectBreadcrumbHdl, Breadcrumb * );
 
+    DECL_LINK( NewFolderHdl, void * );
+
     DECL_LINK( OkHdl, void * );
     DECL_LINK( CancelHdl, void * );
 };
diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui
index 8bf57a3..7c0c923 100644
--- a/fpicker/uiconfig/ui/remotefilesdialog.ui
+++ b/fpicker/uiconfig/ui/remotefilesdialog.ui
@@ -138,12 +138,44 @@
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="breadcrumb_container">
+          <object class="GtkBox" id="box2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
+            <property name="spacing">6</property>
             <child>
-              <placeholder/>
+              <object class="GtkBox" id="breadcrumb_container">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="valign">center</property>
+                <property name="hexpand">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="new_folder">
+                <property name="use_action_appearance">False</property>
+                <property name="width_request">25</property>
+                <property name="height_request">25</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="has_tooltip">True</property>
+                <property name="tooltip_markup" translatable="yes">Create New Folder</property>
+                <property name="tooltip_text" translatable="yes">Create New Folder</property>
+                <property name="margin_left">6</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
             </child>
           </object>
           <packing>
commit beafba254001c614769ae5c5513aac3fc5c7a759
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Fri Aug 7 14:54:39 2015 +0200

    avoid name conflict: SvtResId
    
    Change-Id: I5fbde751c9d6b0d9be7d6dd50abfb99bb14a3512

diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 271f60b..bfdb3a6 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -206,7 +206,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     m_pOk_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) );
     m_pCancel_btn->SetClickHdl( LINK( this, RemoteFilesDialog, CancelHdl ) );
 
-    m_sRootLabel = ResId( STR_SVT_ROOTLABEL, *ResMgrHolder::getOrCreate() );
+    m_sRootLabel = fpicker::SvtResId( STR_SVT_ROOTLABEL );
     m_pPath = VclPtr<Breadcrumb>::Create( get< vcl::Window >( "breadcrumb_container" ) );
     m_pPath->set_hexpand( true );
     m_pPath->SetClickHdl( LINK( this, RemoteFilesDialog, SelectBreadcrumbHdl ) );
@@ -714,7 +714,7 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
 
         if( nPos >= 0 )
         {
-            OUString sMsg = ResId( STR_SVT_DELETESERVICE, *ResMgrHolder::getOrCreate() );
+            OUString sMsg = fpicker::SvtResId( STR_SVT_DELETESERVICE );
             sMsg = sMsg.replaceFirst( "$servicename$", m_pServices_lb->GetSelectEntry() );
             ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO );
 
@@ -925,7 +925,7 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
     {
         if( m_eMode == REMOTEDLG_MODE_SAVE )
         {
-            OUString sMsg = ResId( STR_SVT_ALREADYEXISTOVERWRITE, *ResMgrHolder::getOrCreate() );
+            OUString sMsg = fpicker::SvtResId( STR_SVT_ALREADYEXISTOVERWRITE );
             sMsg = sMsg.replaceFirst( "$filename$", sName );
             ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO );
             if( aBox->Execute() != RET_YES )
diff --git a/fpicker/source/office/fpsofficeResMgr.hxx b/fpicker/source/office/fpsofficeResMgr.hxx
index 76b4538..359fc88 100644
--- a/fpicker/source/office/fpsofficeResMgr.hxx
+++ b/fpicker/source/office/fpsofficeResMgr.hxx
@@ -13,7 +13,7 @@
 #include <osl/getglobalmutex.hxx>
 #include <tools/resmgr.hxx>
 
-namespace
+namespace fpicker
 {
     struct ResMgrHolder
     {
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 387477a..9a61087 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -100,6 +100,7 @@ using namespace ::com::sun::star::ucb;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::task;
 using namespace ::com::sun::star::sdbc;
+using namespace ::fpicker;
 using namespace ::utl;
 using namespace ::svt;
 


More information about the Libreoffice-commits mailing list