[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - fpicker/source
Szymon Kłos
eszkadev at gmail.com
Mon Aug 3 04:26:23 PDT 2015
fpicker/source/office/RemoteFilesDialog.cxx | 33 ++++++++++++++++++++++++++++
fpicker/source/office/RemoteFilesDialog.hxx | 6 +++++
2 files changed, 39 insertions(+)
New commits:
commit dbd1b064b6ec49276576c0dea5fff8ee8d2af8ea
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Mon Aug 3 13:19:51 2015 +0200
remember user settings
Change-Id: I69c4672646365ca4cbeb04d6956741ffe365ad35
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 969e8f3..3f577b6 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -249,6 +249,9 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
m_pContainer->Show();
m_pContainer->Enable( false );
+ m_sIniKey = "RemoteFilesDialog";
+ InitSize();
+
m_pName_ed->SetGetFocusHdl( LINK( this, RemoteFilesDialog, FileNameGetFocusHdl ) );
m_pName_ed->SetModifyHdl( LINK( this, RemoteFilesDialog, FileNameModifyHdl ) );
@@ -273,6 +276,17 @@ void RemoteFilesDialog::dispose()
{
m_pFileView->SetSelectHdl( Link<>() );
+ // save window state
+ if( !m_sIniKey.isEmpty() )
+ {
+ SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey );
+ aDlgOpt.SetWindowState( OStringToOUString( GetWindowState(), osl_getThreadTextEncoding() ) );
+ OUString sUserData = m_pFileView->GetConfigString();
+ aDlgOpt.SetUserItem( OUString( "UserData" ),
+ makeAny( sUserData ) );
+ }
+
+ // save services
std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_context ) );
officecfg::Office::Common::Misc::FilePickerLastService::set( m_sLastServiceUrl, batch );
@@ -381,6 +395,25 @@ OUString lcl_GetServiceType( ServicePtr pService )
}
}
+void RemoteFilesDialog::InitSize()
+{
+ if( m_sIniKey.isEmpty() )
+ return;
+
+ // initialize from config
+ SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey );
+
+ if( aDlgOpt.Exists() )
+ {
+ SetWindowState( OUStringToOString( aDlgOpt.GetWindowState(), osl_getThreadTextEncoding() ) );
+
+ Any aUserData = aDlgOpt.GetUserItem( OUString( "UserData" ) );
+ OUString sCfgStr;
+ if( aUserData >>= sCfgStr )
+ m_pFileView->SetConfigString( sCfgStr );
+ }
+}
+
void RemoteFilesDialog::FillServicesListbox()
{
m_pServices_lb->Clear();
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 63fbd94..bfc6c37 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -19,6 +19,8 @@
#include <tools/errinf.hxx>
#include <tools/resid.hxx>
+#include <unotools/viewoptions.hxx>
+
#include <vcl/button.hxx>
#include <vcl/fpicker.hrc>
#include <vcl/menubtn.hxx>
@@ -123,6 +125,8 @@ private:
bool m_bIsConnected;
bool m_bServiceChanged;
+ OUString m_sIniKey;
+
OUString m_sPath;
OUString m_sStdDir;
OUString m_sLastServiceUrl;
@@ -149,6 +153,8 @@ private:
std::vector< ServicePtr > m_aServices;
std::vector< std::pair< OUString, OUString > > m_aFilters;
+ void InitSize();
+
void FillServicesListbox();
/* If failure returns < 0 */
More information about the Libreoffice-commits
mailing list