summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-07-10 11:33:23 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-07-16 09:53:41 +0200
commit31664660b2e1b3fec79ef7ae259be0d2e0e34861 (patch)
treee0c17efb88fd6ef32678924e263558de52f56ac4 /svtools
parent16ba8ede0af90516c9293b76f2f3a534e944b832 (diff)
RemoteFilesDialog: auto file extension in the save mode
Change-Id: I7b1dd5cc330de0c1ad713d68d93e7d12375033c6
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/dialogs/RemoteFilesDialog.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 03fa023d8063..869fcdf5f013 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -517,6 +517,23 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
return eResult;
}
+void RemoteFilesDialog::AddFileExtension()
+{
+ if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND )
+ {
+ OUString sExt = m_aFilters[m_nCurrentFilter].second;
+ OUString sFileName = m_pName_ed->GetText();
+
+ sal_Int32 nDotPos = sFileName.lastIndexOf( '.' );
+
+ if ( nDotPos == -1 )
+ {
+ sFileName += sExt.copy( 1 ); // without '*'
+ m_pName_ed->SetText( sFileName );
+ }
+ }
+}
+
void RemoteFilesDialog::EnableControls()
{
if( m_pServices_lb->GetEntryCount() > 0 )
@@ -787,6 +804,10 @@ IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr )
IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
{
+ // auto extension
+ if( m_eMode == REMOTEDLG_MODE_SAVE )
+ AddFileExtension();
+
// check if file/path exists
OUString sCurrentPath = m_pFileView->GetViewURL();