diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2015-08-07 18:32:32 +0200 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2015-08-14 08:45:40 +0200 |
commit | 41102d9fcd99416734c527bfd488377d09caf13c (patch) | |
tree | 1e2905027da20ae8ba9b676f521b17b68185e2f5 /fpicker | |
parent | 5c2a0cbb4825a658abbe0c915708eba28cd08ca9 (diff) |
added New Folder button
Change-Id: I4b1ef03e707fdfb3d1968dca9f48c548f872612c
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 40 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.hxx | 8 | ||||
-rw-r--r-- | fpicker/uiconfig/ui/remotefilesdialog.ui | 38 |
3 files changed, 83 insertions, 3 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 80abcac4401c..20ce343d056e 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(); } @@ -872,6 +884,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 0d61f419f38b..a63bef3e8eaa 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; @@ -141,6 +144,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; @@ -149,6 +153,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; @@ -184,6 +190,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 8bf57a37c8e9..7c0c92359034 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> |