svtools/source/dialogs/RemoteFilesDialog.cxx | 30 ++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-)
New commits: commit 060bafcdf8698f15e7246b41dd91371440115fe0 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu May 21 17:53:55 2015 +0200 filter places and add only remote services Change-Id: If4ced3f6766f07dfb454a5c8056a98d8365dcf70 diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index e91cf19..28b153d 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -11,6 +11,8 @@ using namespace ::com::sun::star::uno; +const OUString sLocalFilePrefix = "file://"; + RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits) : ModalDialog(pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui") , m_context(comphelper::getProcessComponentContext()) @@ -47,15 +49,18 @@ void RemoteFilesDialog::fillServicesListbox() Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_context)); Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_context)); - // TODO: filter - only online services if(placesUrlsList.getLength() > 0 && placesNamesList.getLength() > 0) { for(sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace) { - ServicePtr pService(new Place(placesNamesList[nPlace], placesUrlsList[nPlace], true)); - m_aServices.push_back(pService); + // Add only remote services, not local bookmarks + if(placesUrlsList[nPlace].compareTo(sLocalFilePrefix, sLocalFilePrefix.getLength()) != 0) + { + ServicePtr pService(new Place(placesNamesList[nPlace], placesUrlsList[nPlace], true)); + m_aServices.push_back(pService); - m_pServices_lb->InsertEntry(placesNamesList[nPlace]); + m_pServices_lb->InsertEntry(placesNamesList[nPlace]); + } } m_pServices_lb->SelectEntryPos(0); @@ -80,18 +85,15 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) m_pServices_lb->InsertEntry(newService->GetName()); m_pServices_lb->SelectEntryPos(m_pServices_lb->GetEntryCount() - 1); - // save services + // load all places (with local bookmarks), add new service and save all - Sequence< OUString > placesUrlsList(m_aServices.size()); - Sequence< OUString > placesNamesList(m_aServices.size()); + Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_context)); + placesUrlsList.realloc(placesUrlsList.getLength() + 1); + Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_context)); + placesNamesList.realloc(placesNamesList.getLength() + 1); - int i = 0; - for(std::vector<ServicePtr>::const_iterator it = m_aServices.begin(); it != m_aServices.end(); ++it) - { - placesUrlsList[i] = (*it)->GetUrl(); - placesNamesList[i] = (*it)->GetName(); - i++; - } + placesUrlsList[placesUrlsList.getLength() - 1] = newService->GetUrl(); + placesNamesList[placesNamesList.getLength() - 1] = newService->GetName(); std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(placesUrlsList, batch);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits