Kaydet (Commit) 7278462e authored tarafından Szymon Kłos's avatar Szymon Kłos

remember user settings

Change-Id: I69c4672646365ca4cbeb04d6956741ffe365ad35
üst 2ee42eec
......@@ -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();
......
......@@ -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>
......@@ -121,6 +123,8 @@ private:
bool m_bIsConnected;
bool m_bServiceChanged;
OUString m_sIniKey;
OUString m_sPath;
OUString m_sStdDir;
OUString m_sLastServiceUrl;
......@@ -147,6 +151,8 @@ private:
std::vector< ServicePtr > m_aServices;
std::vector< std::pair< OUString, OUString > > m_aFilters;
void InitSize();
void FillServicesListbox();
/* If failure returns < 0 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment