summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-08-03 13:19:51 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-08-14 08:45:23 +0200
commit7278462e12a6e41bb0e9496520e7a00d97856ce6 (patch)
tree0a18c1bd660b0398386eb30c6a2e2b2b5146768d /fpicker
parent2ee42eecd40a47736d7112845f08568194733572 (diff)
remember user settings
Change-Id: I69c4672646365ca4cbeb04d6956741ffe365ad35
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx33
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx6
2 files changed, 39 insertions, 0 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index cdb38ec996e2..dde7eebcb81c 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 2bb7c353c1bd..ea6af5f281aa 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>
@@ -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 */