[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - fpicker/source

Szymon Kłos eszkadev at gmail.com
Mon Aug 24 03:52:53 PDT 2015


 fpicker/source/office/RemoteFilesDialog.cxx |   38 +++++++++++++++++++++++++---
 fpicker/source/office/RemoteFilesDialog.hxx |    3 ++
 2 files changed, 38 insertions(+), 3 deletions(-)

New commits:
commit 4ac63bef28858cdc455bbe4e8aaabb1998d003b7
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Mon Aug 24 12:51:21 2015 +0200

    Remember window size
    
    Change-Id: I4e9bd5e2516b66f47b560a388237b75059a7f142

diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index dc7e0c2..19ea5b5 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -6,7 +6,6 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
-
 #include "RemoteFilesDialog.hxx"
 
 class FileViewContainer : public vcl::Window
@@ -172,6 +171,8 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     : SvtFileDialog_Base( pParent, "RemoteFilesDialog", "fps/ui/remotefilesdialog.ui" )
     , m_xContext( comphelper::getProcessComponentContext() )
     , m_xMasterPasswd( PasswordContainer::create( m_xContext ) )
+    , m_nWidth( 0 )
+    , m_nHeight( 0 )
     , m_pCurrentAsyncAction( NULL )
     , m_pFileNotifier( NULL )
     , m_pSplitter( NULL )
@@ -297,9 +298,15 @@ void RemoteFilesDialog::dispose()
     {
         SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey );
         aDlgOpt.SetWindowState( OStringToOUString( GetWindowState(), osl_getThreadTextEncoding() ) );
+
+        Size aSize( GetSizePixel() );
+
+        OUString sSize = OUString::number( aSize.Width() ) + "|";
+        sSize = sSize + OUString::number( aSize.Height() ) + "|";
+
         OUString sUserData = m_pFileView->GetConfigString();
         aDlgOpt.SetUserItem( OUString( "UserData" ),
-                             makeAny( sUserData ) );
+                             makeAny( sSize + sUserData ) );
     }
 
     // save services
@@ -373,6 +380,17 @@ short RemoteFilesDialog::Execute()
     return nRet;
 }
 
+void RemoteFilesDialog::Show()
+{
+    SvtFileDialog_Base::Show();
+
+    if( m_nWidth > 0 && m_nHeight > 0 )
+    {
+        Size aSize( m_nWidth, m_nHeight );
+        SetSizePixel( aSize );
+    }
+}
+
 OUString lcl_GetServiceType( ServicePtr pService )
 {
     INetProtocol aProtocol = pService->GetUrlObject().GetProtocol();
@@ -423,7 +441,21 @@ void RemoteFilesDialog::InitSize()
         Any aUserData = aDlgOpt.GetUserItem( OUString( "UserData" ) );
         OUString sCfgStr;
         if( aUserData >>= sCfgStr )
-            m_pFileView->SetConfigString( sCfgStr );
+        {
+            int nPos = sCfgStr.indexOf( "|" );
+            if( nPos != -1 )
+            {
+                nPos = sCfgStr.indexOf( "|", nPos + 1 );
+                if( nPos != -1 )
+                {
+                    sal_Int32 nIdx = 0;
+                    m_nWidth = sCfgStr.getToken( 0, '|', nIdx ).toInt32();
+                    m_nHeight = sCfgStr.getToken( 0, '|', nIdx ).toInt32();
+
+                    m_pFileView->SetConfigString( sCfgStr.copy( nPos + 1) );
+                }
+            }
+        }
     }
 }
 
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index bb0abaa..d00191b 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -77,6 +77,7 @@ public:
     virtual void dispose() SAL_OVERRIDE;
     virtual void Resize() SAL_OVERRIDE;
     virtual short Execute() SAL_OVERRIDE;
+    virtual void Show();
 
     // SvtFileDialog_Base
 
@@ -134,6 +135,8 @@ private:
     bool m_bServiceChanged;
 
     OUString m_sIniKey;
+    int m_nWidth;
+    int m_nHeight;
 
     OUString m_sPath;
     OUString m_sStdDir;


More information about the Libreoffice-commits mailing list