include/svtools/PlaceEditDialog.hxx | 2 include/svtools/RemoteFilesDialog.hxx | 10 ++ svtools/source/dialogs/PlaceEditDialog.cxx | 4 svtools/source/dialogs/RemoteFilesDialog.cxx | 109 +++++++++++++++++---------- svtools/uiconfig/ui/remotefilesdialog.ui | 27 ++++++ 5 files changed, 111 insertions(+), 41 deletions(-)
New commits: commit 0daa944fd0ddb81f14a640b96d91296a2cc22ec6 Author: Szymon KÅos <[email protected]> Date: Wed Jun 3 10:03:07 2015 +0200 added SvtFileView, basic loading of the root directory Change-Id: I54a4aa3a2c68b4dbbc54a68469ea6fe41e361864 diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx index 4087188..ac96658 100644 --- a/include/svtools/RemoteFilesDialog.hxx +++ b/include/svtools/RemoteFilesDialog.hxx @@ -20,6 +20,8 @@ #include <vcl/dialog.hxx> #include <vcl/vclptr.hxx> +#include <svtools/fileview.hxx> + #include <officecfg/Office/Common.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -32,6 +34,7 @@ enum SvtRemoteDlgMode }; typedef std::shared_ptr<Place> ServicePtr; +typedef ::com::sun::star::uno::Sequence<OUString> OUStringList; class SVT_DLLPUBLIC RemoteFilesDialog : public ModalDialog { @@ -51,13 +54,18 @@ private: VclPtr<CancelButton> m_pCancel_btn; VclPtr<MenuButton> m_pAddService_btn; VclPtr<ListBox> m_pServices_lb; + VclPtr<Edit> m_pPath_ed; + VclPtr<SvtFileView> m_pView; std::vector<ServicePtr> m_aServices; void FillServicesListbox(); - unsigned int GetSelectedServicePos(); + + /* If failure returns < 0 */ + int GetSelectedServicePos(); DECL_LINK ( AddServiceHdl, void * ); + DECL_LINK ( SelectServiceHdl, void * ); DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void ); }; diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 60063d9..db3ab1a 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -11,6 +11,8 @@ using namespace ::com::sun::star::uno; +#define NO_FILTER "*.*" + RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits) : ModalDialog(pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui") , m_context(comphelper::getProcessComponentContext()) @@ -20,6 +22,8 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits) get(m_pCancel_btn, "cancel"); 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_bIsUpdated = false; @@ -40,6 +44,8 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits) m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) ); FillServicesListbox(); + + m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) ); } void RemoteFilesDialog::dispose() @@ -93,13 +99,16 @@ void RemoteFilesDialog::FillServicesListbox() m_pServices_lb->Enable(false); } -unsigned int RemoteFilesDialog::GetSelectedServicePos() +int RemoteFilesDialog::GetSelectedServicePos() { int nSelected = m_pServices_lb->GetSelectEntryPos(); - unsigned int nPos = 0; + int nPos = 0; int i = -1; - while(nPos < m_aServices.size()) + if(m_aServices.size() == 0) + return -1; + + while(nPos < (int)m_aServices.size()) { while(m_aServices[nPos]->IsLocal()) nPos++; @@ -139,58 +148,82 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) return 1; } +IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl ) +{ + int nPos = GetSelectedServicePos(); + + 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 ); + } + + return 1; +} + IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void ) { OString sIdent(pButton->GetCurItemIdent()); if(sIdent == "edit_service" && m_pServices_lb->GetEntryCount() > 0) { unsigned int nSelected = m_pServices_lb->GetSelectEntryPos(); - unsigned int nPos = GetSelectedServicePos(); - - ScopedVclPtrInstance< PlaceEditDialog > aDlg(this, m_aServices[nPos]); - short aRetCode = aDlg->Execute(); + int nPos = GetSelectedServicePos(); - switch(aRetCode) + if(nPos > 0) { - case RET_OK : - { - ServicePtr pEditedService = aDlg->GetPlace(); + ScopedVclPtrInstance< PlaceEditDialog > aDlg(this, m_aServices[nPos]); + short aRetCode = aDlg->Execute(); - m_aServices[nPos] = pEditedService; - m_pServices_lb->RemoveEntry(nSelected); - m_pServices_lb->InsertEntry(pEditedService->GetName(), nSelected); - m_pServices_lb->SelectEntryPos(nSelected); - - m_bIsUpdated = true; - break; - } - case RET_CANCEL : - default : - // Do Nothing - break; - }; + switch(aRetCode) + { + case RET_OK : + { + ServicePtr pEditedService = aDlg->GetPlace(); + + m_aServices[nPos] = pEditedService; + m_pServices_lb->RemoveEntry(nSelected); + m_pServices_lb->InsertEntry(pEditedService->GetName(), nSelected); + m_pServices_lb->SelectEntryPos(nSelected); + + m_bIsUpdated = true; + break; + } + case RET_CANCEL : + default : + // Do Nothing + break; + }; + } } else if(sIdent == "delete_service" && m_pServices_lb->GetEntryCount() > 0) { unsigned int nSelected = m_pServices_lb->GetSelectEntryPos(); - unsigned int nPos = GetSelectedServicePos(); + int nPos = GetSelectedServicePos(); - // TODO: Confirm dialog + if(nPos > 0) + { + // TODO: Confirm dialog - m_aServices.erase(m_aServices.begin() + nPos); - m_pServices_lb->RemoveEntry(nSelected); + m_aServices.erase(m_aServices.begin() + nPos); + m_pServices_lb->RemoveEntry(nSelected); - if(m_pServices_lb->GetEntryCount() > 0) - { - m_pServices_lb->SelectEntryPos(0); - } - else - { - m_pServices_lb->SetNoSelection(); - m_pServices_lb->Enable(false); - } + if(m_pServices_lb->GetEntryCount() > 0) + { + m_pServices_lb->SelectEntryPos(0); + } + else + { + m_pServices_lb->SetNoSelection(); + m_pServices_lb->Enable(false); + } - m_bIsUpdated = true; + m_bIsUpdated = true; + } } } diff --git a/svtools/uiconfig/ui/remotefilesdialog.ui b/svtools/uiconfig/ui/remotefilesdialog.ui index 894ce8e..0c59369 100644 --- a/svtools/uiconfig/ui/remotefilesdialog.ui +++ b/svtools/uiconfig/ui/remotefilesdialog.ui @@ -2,6 +2,7 @@ <!-- 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> @@ -65,7 +66,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -123,7 +124,29 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="path"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="svtlo-SvtFileView" id="files"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="File View-selection1"/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> </child> </object> </child> commit a70e92d1491324136981b52a585a724690fd269f Author: Szymon KÅos <[email protected]> Date: Wed Jun 3 08:51:07 2015 +0200 hide the type listbox while editing Change-Id: I41264f37208e19e862c2f78930deaf5c8b68d840 diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx index 9bd32eb..dc8840a 100644 --- a/include/svtools/PlaceEditDialog.hxx +++ b/include/svtools/PlaceEditDialog.hxx @@ -39,6 +39,8 @@ private : VclPtr<PushButton> m_pBTDelete; + VclPtr<VclGrid> m_pTypeGrid; + /** Vector holding the details UI control for each server type. The elements in this vector need to match the order in the type listbox, e.g. diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx index d23fe0e..1028a56 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -53,6 +53,7 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla get( m_pBTOk, "ok" ); get( m_pBTCancel, "cancel" ); get( m_pBTDelete, "delete" ); + get( m_pTypeGrid, "TypeGrid" ); m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); m_pBTDelete->SetClickHdl ( LINK( this, PlaceEditDialog, DelHdl) ); @@ -80,6 +81,9 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla m_pEDUsername->SetText( rUrl.GetUser( ) ); } } + + // In edit mode user can't change connection type + m_pTypeGrid->Hide(); } PlaceEditDialog::~PlaceEditDialog()
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
