[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - 7 commits - include/svtools sfx2/source svtools/source svtools/uiconfig

Szymon Kłos eszkadev at gmail.com
Thu Jul 9 04:15:09 PDT 2015


 include/svtools/RemoteFilesDialog.hxx        |   10 +--
 sfx2/source/appl/appuno.cxx                  |    2 
 sfx2/source/doc/guisaveas.cxx                |   16 ++++
 sfx2/source/doc/objserv.cxx                  |    4 -
 svtools/source/dialogs/RemoteFilesDialog.cxx |   87 +++++++++++++++++----------
 svtools/uiconfig/ui/remotefilesdialog.ui     |    1 
 6 files changed, 81 insertions(+), 39 deletions(-)

New commits:
commit c4ac7f6770e0fe985021c1e8bcf62ec98c611bb0
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 9 13:13:09 2015 +0200

    Default focus on filename field after selecting service
    
    Change-Id: I1c1d2855925b3d04b18a0401156b0a8c6e38d8dd

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 129dcee..05f1ac9 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -592,6 +592,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl )
             pRoot->SetUserData( static_cast< void* >( sData ) );
 
             m_pTreeView->Expand( pRoot );
+
+            m_pName_ed->GrabFocus();
         }
     }
 
commit db06396db314c969f5d918326d0864c9477d13b1
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 9 13:03:35 2015 +0200

    RemoteFilesDialog: enable controls in one place
    
    Change-Id: I21aab300a71c96308bc335ea4ac641f02ec2a4fc

diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index 8bd9361..44fce0c 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -121,6 +121,7 @@ private:
     SvtRemoteDlgType m_eType;
     bool m_bMultiselection;
     bool m_bIsUpdated;
+    bool m_bIsConnected;
     Image m_aFolderImage;
 
     OUString m_sPath;
@@ -152,6 +153,8 @@ private:
 
     FileViewResult OpenURL( OUString sURL );
 
+    void EnableControls();
+
     DECL_LINK ( AddServiceHdl, void * );
     DECL_LINK ( SelectServiceHdl, void * );
     DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void );
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 069973b..129dcee 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -250,6 +250,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     m_eType = ( nBits & WB_PATH ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
     m_bMultiselection = ( nBits & SFXWB_MULTISELECTION ) ? true : false;
     m_bIsUpdated = false;
+    m_bIsConnected = false;
     m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND;
 
     m_pFilter_lb->Enable( false );
@@ -442,8 +443,8 @@ void RemoteFilesDialog::FillServicesListbox()
 
     if( m_pServices_lb->GetEntryCount() > 0 )
         m_pServices_lb->SelectEntryPos( 0 );
-    else
-        m_pServices_lb->Enable( false );
+
+    EnableControls();
 }
 
 int RemoteFilesDialog::GetSelectedServicePos()
@@ -502,18 +503,42 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
         {
             m_pPath->SetURL( sURL );
             m_pTreeView->SetTreePath( sURL );
-            m_pFilter_lb->Enable( true );
-            m_pName_ed->Enable( true );
-            m_pContainer->Enable( true );
 
-            if( !m_pName_ed->GetText().isEmpty() )
-                m_pOk_btn->Enable( true );
+            m_bIsConnected = true;
+            EnableControls();
         }
     }
 
     return eResult;
 }
 
+void RemoteFilesDialog::EnableControls()
+{
+    if( m_pServices_lb->GetEntryCount() > 0 )
+        m_pServices_lb->Enable( true );
+    else
+        m_pServices_lb->Enable( false );
+
+    if( m_bIsConnected )
+    {
+        m_pFilter_lb->Enable( true );
+        m_pName_ed->Enable( true );
+        m_pContainer->Enable( true );
+
+        if( !m_pName_ed->GetText().isEmpty() )
+            m_pOk_btn->Enable( true );
+        else
+            m_pOk_btn->Enable( false );
+    }
+    else
+    {
+        m_pFilter_lb->Enable( false );
+        m_pName_ed->Enable( false );
+        m_pContainer->Enable( false );
+        m_pOk_btn->Enable( false );
+    }
+}
+
 IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
 {
     ScopedVclPtrInstance< PlaceEditDialog > aDlg( this );
@@ -525,7 +550,6 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
         {
             ServicePtr newService = aDlg->GetPlace();
             m_aServices.push_back( newService );
-            m_pServices_lb->Enable( true );
 
             OUString sPrefix = lcl_GetServiceType( newService );
 
@@ -536,6 +560,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
             m_pServices_lb->SelectEntryPos( m_pServices_lb->GetEntryCount() - 1 );
 
             m_bIsUpdated = true;
+
+            EnableControls();
       break;
         }
         case RET_CANCEL :
@@ -625,12 +651,13 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
             else
             {
                 m_pServices_lb->SetNoSelection();
-                m_pServices_lb->Enable( false );
             }
 
             m_bIsUpdated = true;
         }
     }
+
+    EnableControls();
 }
 
 IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl )
@@ -664,16 +691,15 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
         m_sPath = pData->maURL;
 
         m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) );
-
-        m_pOk_btn->Enable( true );
     }
     else
     {
-        m_pOk_btn->Enable( false );
         m_sPath = "";
         m_pName_ed->SetText( "" );
     }
 
+    EnableControls();
+
     return 1;
 }
 
@@ -686,11 +712,7 @@ IMPL_LINK_NOARG( RemoteFilesDialog, FileNameGetFocusHdl )
 IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl )
 {
     m_pFileView->SetNoSelection();
-
-    if( !m_pName_ed->GetText().isEmpty() )
-        m_pOk_btn->Enable( true );
-    else
-        m_pOk_btn->Enable( false );
+    EnableControls();
 
     return 1;
 }
commit 2be9fcb3b2efaa8d34181846301850b447add7ba
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 9 12:36:35 2015 +0200

    RemoteFilesDialog: enable OK button when file name isn't empty
    
    Change-Id: Idf84d4d46a72c3fb339e28c1f3923cd2f0f3c12d

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 574acc5..069973b 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -505,6 +505,9 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
             m_pFilter_lb->Enable( true );
             m_pName_ed->Enable( true );
             m_pContainer->Enable( true );
+
+            if( !m_pName_ed->GetText().isEmpty() )
+                m_pOk_btn->Enable( true );
         }
     }
 
commit c505d27f7055f811f7748e08b0c95e7b71dd0264
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 9 12:25:13 2015 +0200

    RemoteFilesDialog: set default filename in the save mode
    
    Change-Id: I4739c101ac6b57e5c17e912515b1c8bccce33b68

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 704f287..574acc5 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -845,6 +845,14 @@ const OUString& RemoteFilesDialog::GetStandardDir() const
 void RemoteFilesDialog::SetPath( const OUString& rNewURL )
 {
     m_sPath = rNewURL;
+
+    if( m_eMode == REMOTEDLG_MODE_SAVE )
+    {
+        INetURLObject aUrl( m_sPath );
+        OUString sFileName = aUrl.GetLastName( INetURLObject::DECODE_WITH_CHARSET );
+
+        m_pName_ed->SetText( sFileName );
+    }
 }
 
 void RemoteFilesDialog::AddFilterGroup(
commit ebb0d1e15f254607145488520b49a0cddb73a0c3
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 9 12:07:26 2015 +0200

    RemoteFilesDialog: handled save button
    
    Change-Id: Iec9129eac618d21370b8e5ecb331eb9518ecf082

diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index 1e9afcb..8bd9361 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -110,8 +110,8 @@ public:
 
     virtual bool getShowState();
 
-    virtual Control* getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const SAL_OVERRIDE;
-    virtual void enableControl( sal_Int16 _nControlId, bool _bEnable );
+    virtual Control* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const SAL_OVERRIDE;
+    virtual void enableControl( sal_Int16 nControlId, bool bEnable );
     virtual OUString getCurFilter( ) const;
 
 private:
@@ -130,8 +130,7 @@ private:
     ::com::sun::star::uno::Sequence< OUString > m_aBlackList;
     ::svt::IFilePickerListener* m_pFileNotifier;
 
-    VclPtr< PushButton > m_pOpen_btn;
-    VclPtr< PushButton > m_pSave_btn;
+    VclPtr< PushButton > m_pOk_btn;
     VclPtr< CancelButton > m_pCancel_btn;
     VclPtr< MenuButton > m_pAddService_btn;
     VclPtr< ListBox > m_pServices_lb;
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 03c7bcf..704f287 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -240,8 +240,6 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     , m_pFileView( NULL )
     , m_pContainer( NULL )
 {
-    get( m_pOpen_btn, "open" );
-    get( m_pSave_btn, "save" );
     get( m_pCancel_btn, "cancel" );
     get( m_pAddService_btn, "add_service_btn" );
     get( m_pServices_lb, "services_lb" );
@@ -254,23 +252,18 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     m_bIsUpdated = false;
     m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND;
 
-    m_pOpen_btn->Enable( false );
-    m_pSave_btn->Enable( false );
     m_pFilter_lb->Enable( false );
     m_pName_ed->Enable( false );
 
     if( m_eMode == REMOTEDLG_MODE_OPEN )
-    {
-        m_pSave_btn->Hide();
-        m_pOpen_btn->Show();
-    }
+        get( m_pOk_btn, "open" );
     else
-    {
-        m_pSave_btn->Show();
-        m_pOpen_btn->Hide();
-    }
+        get( m_pOk_btn, "save" );
+
+    m_pOk_btn->Show();
+    m_pOk_btn->Enable( false );
 
-    m_pOpen_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) );
+    m_pOk_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) );
 
     m_pPath = VclPtr<Breadcrumb>::Create( get< vcl::Window >( "breadcrumb_container" ) );
     m_pPath->set_hexpand( true );
@@ -365,8 +358,7 @@ void RemoteFilesDialog::dispose()
     m_pContainer.disposeAndClear();
     m_pPath.disposeAndClear();
 
-    m_pOpen_btn.clear();
-    m_pSave_btn.clear();
+    m_pOk_btn.clear();
     m_pCancel_btn.clear();
     m_pAddService_btn.clear();
     m_pServices_lb.clear();
@@ -670,11 +662,11 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
 
         m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) );
 
-        m_pOpen_btn->Enable( true );
+        m_pOk_btn->Enable( true );
     }
     else
     {
-        m_pOpen_btn->Enable( false );
+        m_pOk_btn->Enable( false );
         m_sPath = "";
         m_pName_ed->SetText( "" );
     }
@@ -693,9 +685,9 @@ IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl )
     m_pFileView->SetNoSelection();
 
     if( !m_pName_ed->GetText().isEmpty() )
-        m_pOpen_btn->Enable( true );
+        m_pOk_btn->Enable( true );
     else
-        m_pOpen_btn->Enable( false );
+        m_pOk_btn->Enable( false );
 
     return 1;
 }
diff --git a/svtools/uiconfig/ui/remotefilesdialog.ui b/svtools/uiconfig/ui/remotefilesdialog.ui
index f4a591f..0ba817b 100644
--- a/svtools/uiconfig/ui/remotefilesdialog.ui
+++ b/svtools/uiconfig/ui/remotefilesdialog.ui
@@ -35,7 +35,6 @@
             <child>
               <object class="GtkButton" id="open">
                 <property name="label">gtk-open</property>
-                <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="receives_default">True</property>
commit 7e178f97187e5041cfc422ef2df1fb348acc31af
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 9 10:53:30 2015 +0200

    removed warning: 'Unknown item detected'
    
    Change-Id: I36b2faca9205aba870aa993214d0c062ae4f83d9

diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 29e0892..27abb60 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -922,7 +922,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
 
     if ( nSlotId == SID_OPENURL )
         nSlotId = SID_OPENDOC;
-    if ( nSlotId == SID_SAVEASURL )
+    if ( nSlotId == SID_SAVEASURL || nSlotId == SID_SAVEASREMOTE )
         nSlotId = SID_SAVEASDOC;
 
     // find number of properties to avoid permanent reallocations in the sequence
commit ed4392d317100a6e9e00572c7ba16f184ba20c2f
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 9 10:43:26 2015 +0200

    SaveAsRemote: corresponding dialog type
    
    Change-Id: I5face9064bafc3c99b9a7af7809bd40a105b11bd

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index a9b8296..b0e31ab 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -547,6 +547,9 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceAnyFilter( Sf
 
 uno::Sequence< beans::PropertyValue > ModelData_Impl::GetPreselectedFilter_Impl( sal_Int8 nStoreMode )
 {
+    if ( nStoreMode == SAVEASREMOTE_REQUESTED )
+        nStoreMode = SAVEAS_REQUESTED;
+
     uno::Sequence< beans::PropertyValue > aFilterProps;
 
     SfxFilterFlags nMust = getMustFlags( nStoreMode );
@@ -885,6 +888,9 @@ bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
                                             const OUString& rStandardDir,
                                             const ::com::sun::star::uno::Sequence< OUString >& rBlackList)
 {
+    if ( nStoreMode == SAVEASREMOTE_REQUESTED )
+        nStoreMode = SAVEAS_REQUESTED;
+
     bool bUseFilterOptions = false;
 
     ::comphelper::SequenceAsHashMap::const_iterator aOverwriteIter =
@@ -1399,7 +1405,15 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel,
     bool bSetStandardName = false; // can be set only for SaveAs
 
     // parse the slot name
+    bool bRemote = false;
     sal_Int8 nStoreMode = getStoreModeFromSlotName( aSlotName );
+
+    if ( nStoreMode == SAVEASREMOTE_REQUESTED )
+    {
+        nStoreMode = SAVEAS_REQUESTED;
+        bRemote = true;
+    }
+
     sal_Int8 nStatusSave = STATUS_NO_ACTION;
 
     ::comphelper::SequenceAsHashMap::const_iterator aSaveACopyIter =
@@ -1554,7 +1568,7 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel,
     {
         sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG;
 
-        if( nStoreMode == SAVEASREMOTE_REQUESTED )
+        if( bRemote )
         {
             nDialog = SFX2_IMPL_DIALOG_REMOTE;
         }
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 4c442b1..be08ce6 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -561,7 +561,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
             {
                 SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, GetTitle() ); // ???
 
-                if ( nId == SID_SAVEASDOC )
+                if ( nId == SID_SAVEASDOC || nId == SID_SAVEASREMOTE )
                 {
                     // in case of plugin mode the SaveAs operation means SaveTo
                     SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, false );
@@ -726,7 +726,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                 nErrorCode = ( lErr != ERRCODE_IO_ABORT ) && ( nErrorCode == ERRCODE_NONE ) ? nErrorCode : lErr;
             }
 
-            if ( nId == SID_SAVEASDOC  && nErrorCode == ERRCODE_NONE )
+            if ( ( nId == SID_SAVEASDOC || nId == SID_SAVEASREMOTE ) && nErrorCode == ERRCODE_NONE )
             {
                 SfxBoolItem const * saveTo = static_cast<SfxBoolItem const *>(
                     rReq.GetArg(SID_SAVETO, false, TYPE(SfxBoolItem)));


More information about the Libreoffice-commits mailing list