[Libreoffice-commits] core.git: cui/source include/svx sd/inc sd/source

Heiko Tietze (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 17 08:32:18 UTC 2020


 cui/source/dialogs/dlgname.cxx                             |   13 ++++++++++--
 cui/source/factory/dlgfact.cxx                             |   14 +++++++++++++
 cui/source/factory/dlgfact.hxx                             |    3 ++
 cui/source/inc/dlgname.hxx                                 |    7 ++++++
 include/svx/svxdlg.hxx                                     |    1 
 sd/inc/strings.hrc                                         |    1 
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx     |    6 +++++
 sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx |    1 
 8 files changed, 44 insertions(+), 2 deletions(-)

New commits:
commit a4f5c8d38e307bb37f08e8f6ef3cfc9ffac84304
Author:     Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Fri Dec 13 12:01:34 2019 +0100
Commit:     Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Mon Feb 17 09:31:45 2020 +0100

    Resolves tdf#129032 - Missing warning when renaming page
    
    Edit field has type normal or error now
    Edit field and okay button return feedback per tooltip
    
    Change-Id: Ib2caf3280227cb00af25889ed111503745b471dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85101
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>

diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 133f1753fecd..d8044366b470 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -41,10 +41,19 @@ SvxNameDialog::SvxNameDialog(weld::Window* pParent, const OUString& rName, const
 IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry&, void)
 {
     // Do not allow empty names
+    bool bEnable;
     if (m_aCheckNameHdl.IsSet())
-        m_xBtnOK->set_sensitive(!m_xEdtName->get_text().isEmpty() && m_aCheckNameHdl.Call(*this));
+        bEnable = !m_xEdtName->get_text().isEmpty() && m_aCheckNameHdl.Call(*this);
     else
-        m_xBtnOK->set_sensitive(!m_xEdtName->get_text().isEmpty());
+        bEnable = !m_xEdtName->get_text().isEmpty();
+    m_xBtnOK->set_sensitive(bEnable);
+    // tdf#129032: feedback on reason to disabled controls
+    m_xEdtName->set_message_type(bEnable ? weld::EntryMessageType::Normal : weld::EntryMessageType::Error);
+    OUString rTip = "";
+    if (!bEnable && m_aCheckNameTooltipHdl.IsSet())
+       rTip = m_aCheckNameTooltipHdl.Call(*this);
+    m_xBtnOK->set_tooltip_text(rTip);
+    m_xEdtName->set_tooltip_text(rTip);
 }
 
 // #i68101#
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index d924938ad1d4..600882742427 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -740,6 +740,15 @@ void AbstractSvxNameDialog_Impl::SetCheckNameHdl( const Link<AbstractSvxNameDial
         m_xDlg->SetCheckNameHdl( Link<SvxNameDialog&,bool>(), bCheckImmediately );
 }
 
+void AbstractSvxNameDialog_Impl::SetCheckNameTooltipHdl( const Link<AbstractSvxNameDialog&,OUString>& rLink)
+{
+    aCheckNameTooltipHdl = rLink;
+    if( rLink.IsSet() )
+        m_xDlg->SetCheckNameTooltipHdl( LINK(this, AbstractSvxNameDialog_Impl, CheckNameTooltipHdl));
+    else
+        m_xDlg->SetCheckNameTooltipHdl( Link<SvxNameDialog&,OUString>());
+}
+
 void AbstractSvxNameDialog_Impl::SetEditHelpId(const OString& rHelpId)
 {
     m_xDlg->SetEditHelpId(rHelpId);
@@ -760,6 +769,11 @@ IMPL_LINK_NOARG(AbstractSvxNameDialog_Impl, CheckNameHdl, SvxNameDialog&, bool)
     return aCheckNameHdl.Call(*this);
 }
 
+IMPL_LINK_NOARG(AbstractSvxNameDialog_Impl, CheckNameTooltipHdl, SvxNameDialog&, OUString)
+{
+    return aCheckNameTooltipHdl.Call(*this);
+}
+
 void AbstractSvxObjectNameDialog_Impl::GetName(OUString& rName)
 {
     rName = m_xDlg->GetName();
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 9c60124748a1..0181e293f49d 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -446,6 +446,7 @@ public:
     virtual short Execute() override;
     virtual void    GetName( OUString& rName ) override ;
     virtual void    SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink, bool bCheckImmediately = false ) override ;
+    virtual void    SetCheckNameTooltipHdl( const Link<AbstractSvxNameDialog&, OUString>& rLink ) override ;
     virtual void    SetEditHelpId(const OString&) override ;
     //from class Window
     virtual void    SetHelpId( const OString& ) override ;
@@ -453,7 +454,9 @@ public:
 private:
     std::unique_ptr<SvxNameDialog> m_xDlg;
     Link<AbstractSvxNameDialog&,bool> aCheckNameHdl;
+    Link<AbstractSvxNameDialog&,OUString> aCheckNameTooltipHdl;
     DECL_LINK(CheckNameHdl, SvxNameDialog&, bool);
+    DECL_LINK(CheckNameTooltipHdl, SvxNameDialog&, OUString);
 };
 
 class SvxObjectNameDialog;
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
index a1e90f32db71..8fd754990885 100644
--- a/cui/source/inc/dlgname.hxx
+++ b/cui/source/inc/dlgname.hxx
@@ -30,6 +30,7 @@ private:
     std::unique_ptr<weld::Button> m_xBtnOK;
 
     Link<SvxNameDialog&,bool> m_aCheckNameHdl;
+    Link<SvxNameDialog&,OUString> m_aCheckNameTooltipHdl;
 
     DECL_LINK(ModifyHdl, weld::Entry&, void);
 
@@ -60,6 +61,12 @@ public:
             m_xBtnOK->set_sensitive(rLink.Call(*this));
     }
 
+    void SetCheckNameTooltipHdl(const Link<SvxNameDialog&,OUString>& rLink)
+    {
+        m_aCheckNameTooltipHdl = rLink;
+        m_xBtnOK->set_tooltip_text(rLink.Call(*this));
+    }
+
     void SetEditHelpId(const OString& aHelpId) { m_xEdtName->set_help_id(aHelpId);}
 };
 
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index f0fdbac8ed60..e12f1f1ee015 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -175,6 +175,7 @@ protected:
 public:
     virtual void    GetName( OUString& rName ) = 0;
     virtual void    SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink, bool bCheckImmediately = false ) = 0;
+    virtual void    SetCheckNameTooltipHdl( const Link<AbstractSvxNameDialog&,OUString>& rLink ) = 0;
     virtual void    SetEditHelpId(const OString&) = 0;
     //from class Window
     virtual void    SetHelpId( const OString& ) = 0;
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index a72d47e7d937..400b8ec22b00 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -236,6 +236,7 @@
 #define STR_STATUSBAR_MASTERPAGE                        NC_("STR_STATUSBAR_MASTERPAGE", "Slide Master name. Right-click for list and double-click for dialog.")
 #define STR_TITLE_RENAMESLIDE                           NC_("STR_TITLE_RENAMESLIDE", "Rename Slide")
 #define STR_TITLE_RENAMEPAGE                            NC_("STR_TITLE_RENAMEPAGE", "Rename Page")
+#define STR_TOOLTIP_RENAME                              NC_("STR_TOOLTIP_RENAME", "Duplicate or empty names are not possible")
 #define STR_DESC_RENAMESLIDE                            NC_("STR_DESC_RENAMESLIDE", "Name")
 #define STR_TITLE_RENAMEMASTER                          NC_("STR_TITLE_RENAMEMASTER", "Rename Master Slide")
 #define STR_PLACEHOLDER_DESCRIPTION_TITLE               NC_("STR_PLACEHOLDER_DESCRIPTION_TITLE", "Title Area for AutoLayouts" )
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index e885802fd98a..b371aa2ea1b8 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -918,6 +918,7 @@ void SlotManager::RenameSlide(const SfxRequest& rRequest)
         aNameDlg->GetName( aOldName );
         aNameDlg->SetText( aTitle );
         aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true );
+        aNameDlg->SetCheckNameTooltipHdl( LINK( this, SlotManager, RenameSlideTooltipHdl ) );
         aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
 
         if( aNameDlg->Execute() == RET_OK )
@@ -959,6 +960,11 @@ IMPL_LINK(SlotManager, RenameSlideHdl, AbstractSvxNameDialog&, rDialog, bool)
             && mrSlideSorter.GetViewShell()->GetDocSh()->IsNewPageNameValid( aNewName ) );
 }
 
+IMPL_STATIC_LINK_NOARG(SlotManager, RenameSlideTooltipHdl, AbstractSvxNameDialog&, OUString)
+{
+    return SdResId(STR_TOOLTIP_RENAME);
+}
+
 bool SlotManager::RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const OUString & rName  )
 {
     bool   bOutDummy;
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
index d5078bcfbedc..df378315afad 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
@@ -81,6 +81,7 @@ private:
     */
     void RenameSlide( const SfxRequest& rRequest );
     DECL_LINK(RenameSlideHdl, AbstractSvxNameDialog&, bool);
+    DECL_STATIC_LINK(SlotManager, RenameSlideTooltipHdl, AbstractSvxNameDialog&, OUString);
     bool RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const OUString& rName);
 
     /** Handle SID_INSERTPAGE slot calls.


More information about the Libreoffice-commits mailing list