desktop/source/deployment/gui/dp_gui.hrc | 2 desktop/source/deployment/gui/dp_gui_dialog.src | 5 desktop/source/deployment/gui/dp_gui_dialog2.cxx | 92 ++++++--------- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 4 desktop/uiconfig/ui/extensionmanager.ui | 136 +++++++++++++++++------ 5 files changed, 142 insertions(+), 97 deletions(-)
New commits: commit 989cf68b68eda98b9f3942bb738e60ec649707dc Author: Muhammet Kara <muhammet.k...@pardus.org.tr> Date: Tue Nov 1 14:09:54 2016 +0300 tdf#103146 Revamp Extension Manager Dialog, Part 1 Moved the "Check for Updates", and "Add" buttons to the new row, and started moving the buttons from the ExtBoxWithBtns_Impl to the new row. Needed to create new public methods to be able to update button states of ExtMgrDialog from within the ExtBoxWithBtns_Impl class. Change-Id: Iea784d0b7237da3f8aa05862dbf1faf5acf98655 Reviewed-on: https://gerrit.libreoffice.org/30560 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index ddee13a..b970d44 100644 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -67,7 +67,7 @@ #define RID_CTX_ITEM_ENABLE (RID_DEPLOYMENT_GUI_START+81) #define RID_CTX_ITEM_DISABLE (RID_DEPLOYMENT_GUI_START+82) #define RID_CTX_ITEM_CHECK_UPDATE (RID_DEPLOYMENT_GUI_START+83) -#define RID_CTX_ITEM_OPTIONS (RID_DEPLOYMENT_GUI_START+84) +//There is a gap here #define RID_STR_ADDING_PACKAGES (RID_DEPLOYMENT_GUI_START+85) #define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+86) diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index ae85a1d..9078a35 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -44,11 +44,6 @@ String RID_CTX_ITEM_CHECK_UPDATE Text [ en-US ] = "~Update..."; }; -String RID_CTX_ITEM_OPTIONS -{ - Text [ en-US ] = "~Options..."; -}; - String RID_STR_ADDING_PACKAGES { Text [ en-US ] = "Adding %EXTENSION_NAME"; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 6afa3ae..043021d 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -116,7 +116,6 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl { bool m_bInterfaceLocked; - VclPtr<PushButton> m_pOptionsBtn; VclPtr<PushButton> m_pEnableBtn; VclPtr<PushButton> m_pRemoveBtn; @@ -130,7 +129,6 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl DECL_LINK( ScrollHdl, ScrollBar*, void ); - DECL_LINK( HandleOptionsBtn, Button*, void ); DECL_LINK( HandleEnableBtn, Button*, void ); DECL_LINK( HandleRemoveBtn, Button*, void ); @@ -153,7 +151,6 @@ public: ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl(vcl::Window* pParent) : ExtensionBox_Impl(pParent) , m_bInterfaceLocked(false) - , m_pOptionsBtn(nullptr) , m_pEnableBtn(nullptr) , m_pRemoveBtn(nullptr) , m_pParent(nullptr) @@ -166,26 +163,21 @@ void ExtBoxWithBtns_Impl::InitFromDialog(ExtMgrDialog *pParentDialog) m_pParent = pParentDialog; - m_pOptionsBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP ); m_pEnableBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP ); m_pRemoveBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP ); SetHelpId( HID_EXTENSION_MANAGER_LISTBOX ); - m_pOptionsBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_OPTIONS ); m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE ); m_pRemoveBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_REMOVE ); - m_pOptionsBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleOptionsBtn ) ); m_pEnableBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleEnableBtn ) ); m_pRemoveBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleRemoveBtn ) ); - m_pOptionsBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_OPTIONS ) ); m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); m_pRemoveBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); Size aSize = LogicToPixel( Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ), MapMode( MapUnit::MapAppFont ) ); - m_pOptionsBtn->SetSizePixel( aSize ); m_pEnableBtn->SetSizePixel( aSize ); m_pRemoveBtn->SetSizePixel( aSize ); @@ -207,7 +199,6 @@ ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl() void ExtBoxWithBtns_Impl::dispose() { - m_pOptionsBtn.disposeAndClear(); m_pEnableBtn.disposeAndClear(); m_pRemoveBtn.disposeAndClear(); m_pParent.clear(); @@ -225,8 +216,7 @@ void ExtBoxWithBtns_Impl::RecalcAll() } else { - m_pOptionsBtn->Disable(); - m_pOptionsBtn->Hide(); + m_pParent->enableOptionsButton( false ); m_pEnableBtn->Disable(); m_pEnableBtn->Hide(); m_pRemoveBtn->Disable(); @@ -252,14 +242,12 @@ void ExtBoxWithBtns_Impl::selectEntry( const long nPos ) void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect ) { - Size aBtnSize( m_pOptionsBtn->GetSizePixel() ); + Size aBtnSize( m_pRemoveBtn->GetSizePixel() ); Point aBtnPos( rRect.Left() + ICON_OFFSET, rRect.Bottom() - TOP_OFFSET - aBtnSize.Height() ); - m_pOptionsBtn->SetPosPixel( aBtnPos ); - aBtnPos.X() = rRect.Right() - TOP_OFFSET - aBtnSize.Width(); m_pRemoveBtn->SetPosPixel( aBtnPos ); - aBtnPos.X() -= ( TOP_OFFSET + aBtnSize.Width() ); + aBtnPos.X() = rRect.Right() - TOP_OFFSET - aBtnSize.Width(); m_pEnableBtn->SetPosPixel( aBtnPos ); } @@ -296,14 +284,12 @@ void ExtBoxWithBtns_Impl::SetButtonStatus(const TEntry_Impl& rEntry) if ( rEntry->m_bHasOptions && bShowOptionBtn ) { - m_pOptionsBtn->Enable(); - m_pOptionsBtn->Show(); + m_pParent->enableOptionsButton( true ); rEntry->m_bHasButtons = true; } else { - m_pOptionsBtn->Disable(); - m_pOptionsBtn->Hide(); + m_pParent->enableOptionsButton( false ); } if ( rEntry->m_bUser || rEntry->m_bShared ) @@ -329,15 +315,9 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) PushButton *pNext = nullptr; - if ( m_pOptionsBtn->HasFocus() ) { - if ( !bReverse && !GetEntryData( nIndex )->m_bLocked ) - pNext = m_pEnableBtn; - } - else if ( m_pEnableBtn->HasFocus() ) { + if ( m_pEnableBtn->HasFocus() ) { if ( !bReverse ) pNext = m_pRemoveBtn; - else if ( GetEntryData( nIndex )->m_bHasOptions ) - pNext = m_pOptionsBtn; } else if ( m_pRemoveBtn->HasFocus() ) { if ( bReverse ) @@ -345,15 +325,11 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) } else { if ( !bReverse ) { - if ( GetEntryData( nIndex )->m_bHasOptions ) - pNext = m_pOptionsBtn; - else if ( ! GetEntryData( nIndex )->m_bLocked ) + if ( ! GetEntryData( nIndex )->m_bLocked ) pNext = m_pEnableBtn; } else { if ( ! GetEntryData( nIndex )->m_bLocked ) pNext = m_pRemoveBtn; - else if ( GetEntryData( nIndex )->m_bHasOptions ) - pNext = m_pOptionsBtn; } } @@ -471,9 +447,9 @@ void ExtBoxWithBtns_Impl::enableButtons( bool bEnable ) } else { - m_pOptionsBtn->Enable( false ); m_pRemoveBtn->Enable( false ); m_pEnableBtn->Enable( false ); + m_pParent->enableOptionsButton( false ); } } @@ -482,37 +458,15 @@ IMPL_LINK( ExtBoxWithBtns_Impl, ScrollHdl, ScrollBar*, pScrBar, void ) { long nDelta = pScrBar->GetDelta(); - Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) ); Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) ); Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) ); DoScroll( nDelta ); - m_pOptionsBtn->SetPosPixel( aNewOptPt ); m_pRemoveBtn->SetPosPixel( aNewRemPt ); m_pEnableBtn->SetPosPixel( aNewEnPt ); } - -IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleOptionsBtn, Button*, void) -{ - const sal_Int32 nActive = getSelIndex(); - - if ( nActive != svt::IExtensionListBox::ENTRY_NOTFOUND ) - { - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - - if ( pFact ) - { - OUString sExtensionId = GetEntryData( nActive )->m_xPackage->getIdentifier().Value; - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog( this, sExtensionId, OUString() )); - - pDlg->Execute(); - } - } -} - - IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleEnableBtn, Button*, void) { const sal_Int32 nActive = getSelIndex(); @@ -689,8 +643,9 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, , m_pManager(pManager) { get(m_pExtensionBox, "extensions"); - get(m_pAddBtn, "add"); - get(m_pUpdateBtn, "update"); + get(m_pOptionsBtn, "optionsbtn"); + get(m_pAddBtn, "addbtn"); + get(m_pUpdateBtn, "updatebtn"); get(m_pCloseBtn, "close"); get(m_pBundledCbx, "bundled"); get(m_pSharedCbx, "shared"); @@ -702,6 +657,9 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, m_pExtensionBox->InitFromDialog(this); + m_pOptionsBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_OPTIONS ); + + m_pOptionsBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleOptionsBtn ) ); m_pAddBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleAddBtn ) ); m_pCloseBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleCloseBtn ) ); @@ -738,6 +696,7 @@ void ExtMgrDialog::dispose() { m_aIdle.Stop(); m_pExtensionBox.clear(); + m_pOptionsBtn.clear(); m_pAddBtn.clear(); m_pUpdateBtn.clear(); m_pCloseBtn.clear(); @@ -942,6 +901,10 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker() return files; } +void ExtMgrDialog::enableOptionsButton( bool bEnable ) +{ + m_pOptionsBtn->Enable( bEnable ); +} IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, Button*, void) { @@ -1042,6 +1005,23 @@ void ExtMgrDialog::updatePackageInfo( const uno::Reference< deployment::XPackage m_pExtensionBox->updateEntry( xPackage ); } +IMPL_LINK_NOARG(ExtMgrDialog, HandleOptionsBtn, Button*, void) +{ + const sal_Int32 nActive = m_pExtensionBox->getSelIndex(); + + if ( nActive != svt::IExtensionListBox::ENTRY_NOTFOUND ) + { + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + + if ( pFact ) + { + OUString sExtensionId = m_pExtensionBox->GetEntryData( nActive )->m_xPackage->getIdentifier().Value; + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog( this, sExtensionId, OUString() )); + + pDlg->Execute(); + } + } +} IMPL_LINK_NOARG(ExtMgrDialog, HandleAddBtn, Button*, void) { diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index db0ad30..3f03171 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -102,6 +102,7 @@ class ExtMgrDialog : public ModelessDialog, public DialogHelper { VclPtr<ExtBoxWithBtns_Impl> m_pExtensionBox; + VclPtr<PushButton> m_pOptionsBtn; VclPtr<PushButton> m_pAddBtn; VclPtr<PushButton> m_pUpdateBtn; VclPtr<CloseButton> m_pCloseBtn; @@ -132,6 +133,7 @@ class ExtMgrDialog : public ModelessDialog, bool removeExtensionWarn( const OUString &rExtensionTitle ) const; + DECL_LINK( HandleOptionsBtn, Button*, void ); DECL_LINK( HandleAddBtn, Button*, void ); DECL_LINK( HandleUpdateBtn, Button*, void ); DECL_LINK( HandleCancelBtn, Button*, void ); @@ -171,6 +173,8 @@ public: virtual void checkEntries() override; css::uno::Sequence< OUString > raiseAddPicker(); + + void enableOptionsButton( bool bEnable ); }; diff --git a/desktop/uiconfig/ui/extensionmanager.ui b/desktop/uiconfig/ui/extensionmanager.ui index 7db4d20..af2f904 100644 --- a/desktop/uiconfig/ui/extensionmanager.ui +++ b/desktop/uiconfig/ui/extensionmanager.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.0 --> <interface> <requires lib="gtk+" version="3.0"/> <requires lib="LibreOffice" version="1.0"/> @@ -33,34 +33,6 @@ </packing> </child> <child> - <object class="GtkButton" id="add"> - <property name="label" translatable="yes">Add...</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="update"> - <property name="label" translatable="yes">Check for updates...</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> <object class="GtkButton" id="close"> <property name="label">gtk-close</property> <property name="visible">True</property> @@ -71,7 +43,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">1</property> </packing> </child> </object> @@ -100,6 +72,93 @@ </packing> </child> <child> + <object class="GtkButtonBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="optionsbtn"> + <property name="label" translatable="yes">_Options</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="updatebtn"> + <property name="label" translatable="yes">Check for _Updates</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + <property name="secondary">True</property> + </packing> + </child> + <child> + <object class="GtkButton" id="addbtn"> + <property name="label" translatable="yes">_Add</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + <property name="secondary">True</property> + </packing> + </child> + <child> + <object class="GtkButton" id="removebtn"> + <property name="label" translatable="yes">Remove</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">3</property> + <property name="secondary">True</property> + </packing> + </child> + <child> + <object class="GtkButton" id="enablebtn"> + <property name="label" translatable="yes">Enable</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">4</property> + <property name="secondary">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -187,7 +246,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -199,8 +258,8 @@ <object class="GtkLabel" id="progressft"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="justify">right</property> <property name="label" translatable="yes">Adding %EXTENSION_NAME</property> + <property name="justify">right</property> </object> <packing> <property name="left_attach">0</property> @@ -247,11 +306,20 @@ <property name="top_attach">1</property> </packing> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </object> @@ -265,8 +333,6 @@ </child> <action-widgets> <action-widget response="0">help</action-widget> - <action-widget response="0">add</action-widget> - <action-widget response="0">update</action-widget> <action-widget response="0">close</action-widget> </action-widgets> </object> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits