summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svtools/RemoteFilesDialog.hxx2
-rw-r--r--svtools/source/dialogs/RemoteFilesDialog.cxx21
2 files changed, 23 insertions, 0 deletions
diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index 44fce0cc02fb..f1dc755e13c9 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -153,6 +153,8 @@ private:
FileViewResult OpenURL( OUString sURL );
+ void AddFileExtension();
+
void EnableControls();
DECL_LINK ( AddServiceHdl, void * );
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();