[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - svtools/source
Szymon Kłos
eszkadev at gmail.com
Mon Jun 22 01:32:30 PDT 2015
svtools/source/dialogs/RemoteFilesDialog.cxx | 39 +++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
New commits:
commit 5c8202a61bb6e80e99acab95f165ca3f711a94cd
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Mon Jun 22 10:31:06 2015 +0200
RemoteFilesDialog: service type before the name
Change-Id: If89178e13abe7aaae06f03eb3bdd96f4d37d73db
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 594f1b1..9ec4883 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -276,6 +276,30 @@ void RemoteFilesDialog::Resize()
}
}
+OUString lcl_GetServiceType(ServicePtr pService)
+{
+ INetProtocol aProtocol = pService->GetUrlObject().GetProtocol();
+ switch(aProtocol)
+ {
+ case INetProtocol::Ftp:
+ return OUString("FTP");
+ case INetProtocol::Cmis:
+ return OUString("CMIS");
+ case INetProtocol::Smb:
+ return OUString("Windows Share");
+ case INetProtocol::File:
+ return OUString("SSH");
+ case INetProtocol::Http:
+ return OUString("WebDAV");
+ case INetProtocol::Https:
+ return OUString("WebDAV");
+ case INetProtocol::Generic:
+ return OUString("SSH");
+ default:
+ return OUString("");
+ }
+}
+
void RemoteFilesDialog::FillServicesListbox()
{
m_pServices_lb->Clear();
@@ -293,7 +317,12 @@ void RemoteFilesDialog::FillServicesListbox()
// Add to the listbox only remote services, not local bookmarks
if(!pService->IsLocal())
{
- m_pServices_lb->InsertEntry(placesNamesList[nPlace]);
+ OUString sPrefix = lcl_GetServiceType(pService);
+
+ if(!sPrefix.isEmpty())
+ sPrefix += ": ";
+
+ m_pServices_lb->InsertEntry(sPrefix + placesNamesList[nPlace]);
}
}
@@ -441,7 +470,13 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
ServicePtr newService = aDlg->GetPlace();
m_aServices.push_back(newService);
m_pServices_lb->Enable(true);
- m_pServices_lb->InsertEntry(newService->GetName());
+
+ OUString sPrefix = lcl_GetServiceType(newService);
+
+ if(!sPrefix.isEmpty())
+ sPrefix += ": ";
+
+ m_pServices_lb->InsertEntry(sPrefix + newService->GetName());
m_pServices_lb->SelectEntryPos(m_pServices_lb->GetEntryCount() - 1);
m_bIsUpdated = true;
More information about the Libreoffice-commits
mailing list