cui/source/dialogs/tipofthedaydlg.cxx       |    7 ++++---
 cui/source/inc/tipofthedaydlg.hxx           |    2 +-
 fpicker/source/office/RemoteFilesDialog.cxx |    3 ++-
 fpicker/source/office/RemoteFilesDialog.hxx |    2 +-
 fpicker/source/office/breadcrumb.cxx        |    8 ++++----
 fpicker/source/office/breadcrumb.hxx        |    6 +++---
 include/vcl/weld.hxx                        |    8 +++-----
 vcl/source/app/salvtables.cxx               |    5 +++--
 vcl/unx/gtk3/gtk3gtkinst.cxx                |    6 +++---
 9 files changed, 24 insertions(+), 23 deletions(-)

New commits:
commit 07bde58988705ca45a619eb7a4e670a5d951abf6
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Oct 27 16:17:59 2019 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 29 14:14:04 2019 +0100

    use activate-link instead of clicked
    
    so we can return true to consume the event and not continue to the
    default url dispatch handler
    
    Change-Id: I66400363a57d528a25d68a7f9314a8bc7d95876e
    Reviewed-on: https://gerrit.libreoffice.org/81555
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/dialogs/tipofthedaydlg.cxx 
b/cui/source/dialogs/tipofthedaydlg.cxx
index 8f82f6841293..25722420ddfc 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -103,7 +103,7 @@ void TipOfTheDayDialog::UpdateTip()
 
         m_pLink->set_label(CuiResId(STR_MORE_LINK));
         m_pLink->set_visible(true);
-        m_pLink->connect_clicked(Link<weld::LinkButton&, void>());
+        m_pLink->connect_activate_link(Link<weld::LinkButton&, bool>());
     }
     else
     {
@@ -111,7 +111,7 @@ void TipOfTheDayDialog::UpdateTip()
         m_pLink->set_label(CuiResId(STR_HELP_LINK));
         m_pLink->set_visible(true);
         //converts aLink into the proper offline/online hyperlink
-        m_pLink->connect_clicked(LINK(this, TipOfTheDayDialog, OnLinkClick));
+        m_pLink->connect_activate_link(LINK(this, TipOfTheDayDialog, 
OnLinkClick));
     }
     // image
     OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/tipoftheday/");
@@ -132,9 +132,10 @@ void TipOfTheDayDialog::UpdateTip()
     }
 }
 
-IMPL_LINK_NOARG(TipOfTheDayDialog, OnLinkClick, weld::LinkButton&, void)
+IMPL_LINK_NOARG(TipOfTheDayDialog, OnLinkClick, weld::LinkButton&, bool)
 {
     Application::GetHelp()->Start(aLink, static_cast<weld::Widget*>(nullptr));
+    return true;
 }
 
 IMPL_LINK_NOARG(TipOfTheDayDialog, OnNextClick, weld::Button&, void)
diff --git a/cui/source/inc/tipofthedaydlg.hxx 
b/cui/source/inc/tipofthedaydlg.hxx
index d013665a4055..425805af6fad 100644
--- a/cui/source/inc/tipofthedaydlg.hxx
+++ b/cui/source/inc/tipofthedaydlg.hxx
@@ -36,7 +36,7 @@ private:
     OUString aLink;
     void UpdateTip();
     DECL_LINK(OnNextClick, weld::Button&, void);
-    DECL_LINK(OnLinkClick, weld::LinkButton&, void);
+    DECL_LINK(OnLinkClick, weld::LinkButton&, bool);
 
 public:
     TipOfTheDayDialog(weld::Window* pWindow);
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx 
b/fpicker/source/office/RemoteFilesDialog.cxx
index a795338581f4..3adf45987975 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -787,9 +787,10 @@ IMPL_LINK(RemoteFilesDialog, TreeSelectHdl, 
weld::TreeView&, rBox, void)
     m_xFileView->grab_focus();
 }
 
-IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr, void )
+IMPL_LINK(RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr, bool)
 {
     OpenURL( pPtr->GetHdlURL() );
+    return true;
 }
 
 IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl, weld::Button&, void )
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx 
b/fpicker/source/office/RemoteFilesDialog.hxx
index 349a3f7d5d64..aae53a121ddf 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -181,7 +181,7 @@ private:
 
     DECL_LINK( TreeSelectHdl, weld::TreeView&, void );
 
-    DECL_LINK( SelectBreadcrumbHdl, Breadcrumb *, void );
+    DECL_LINK( SelectBreadcrumbHdl, Breadcrumb*, bool );
 
     DECL_LINK( NewFolderHdl, weld::Button&, void );
     DECL_LINK( IconViewHdl, weld::Button&, void );
diff --git a/fpicker/source/office/breadcrumb.cxx 
b/fpicker/source/office/breadcrumb.cxx
index 1216a543a00d..76bc0f1d17d3 100644
--- a/fpicker/source/office/breadcrumb.cxx
+++ b/fpicker/source/office/breadcrumb.cxx
@@ -40,7 +40,7 @@ void Breadcrumb::EnableFields( bool bEnable )
     }
 }
 
-void Breadcrumb::connect_clicked( const Link<Breadcrumb*,void>& rLink )
+void Breadcrumb::connect_clicked( const Link<Breadcrumb*,bool>& rLink )
 {
     m_aClickHdl = rLink;
 }
@@ -214,7 +214,7 @@ void Breadcrumb::appendField()
     m_aSegments.emplace_back(std::make_unique<BreadcrumbPath>(m_pParent));
     size_t nIndex = m_aSegments.size() - 1;
     m_aSegments[nIndex]->m_xLink->hide();
-    m_aSegments[nIndex]->m_xLink->connect_clicked( LINK( this, Breadcrumb, 
ClickLinkHdl ) );
+    m_aSegments[nIndex]->m_xLink->connect_activate_link(LINK(this, Breadcrumb, 
ClickLinkHdl));
     m_aSegments[nIndex]->m_xSeparator->set_label( ">" );
     m_aSegments[nIndex]->m_xSeparator->hide();
 }
@@ -242,10 +242,10 @@ bool Breadcrumb::showField( unsigned int nIndex, unsigned 
int nWidthMax )
     return true;
 }
 
-IMPL_LINK( Breadcrumb, ClickLinkHdl, weld::LinkButton&, rLink, void )
+IMPL_LINK(Breadcrumb, ClickLinkHdl, weld::LinkButton&, rLink, bool)
 {
     m_sClickedURL = m_aUris[&rLink];
-    m_aClickHdl.Call( this );
+    return m_aClickHdl.Call(this);
 }
 
 BreadcrumbPath::BreadcrumbPath(weld::Container* pContainer)
diff --git a/fpicker/source/office/breadcrumb.hxx 
b/fpicker/source/office/breadcrumb.hxx
index 784ef32b9391..9fc66f9bcd7b 100644
--- a/fpicker/source/office/breadcrumb.hxx
+++ b/fpicker/source/office/breadcrumb.hxx
@@ -46,13 +46,13 @@ private:
 
     SvtBreadcrumbMode m_eMode;
 
-    Link<Breadcrumb*,void> m_aClickHdl;
+    Link<Breadcrumb*,bool> m_aClickHdl;
 
     void appendField();
     bool showField( unsigned int nIndex, unsigned int nWidthMax );
 
     DECL_LINK(SizeAllocHdl, const Size&, void);
-    DECL_LINK(ClickLinkHdl, weld::LinkButton&, void);
+    DECL_LINK(ClickLinkHdl, weld::LinkButton&, bool);
 
 public:
     Breadcrumb(weld::Container* pParent);
@@ -60,7 +60,7 @@ public:
 
     void EnableFields( bool bEnable );
 
-    void connect_clicked( const Link<Breadcrumb*,void>& rLink );
+    void connect_clicked( const Link<Breadcrumb*,bool>& rLink );
     const OUString& GetHdlURL() const;
 
     void SetRootName( const OUString& rURL );
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 21550aae2b8c..c9019d8dfaf5 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1200,9 +1200,9 @@ class VCL_DLLPUBLIC RadioButton : virtual public 
ToggleButton
 class VCL_DLLPUBLIC LinkButton : virtual public Container
 {
 protected:
-    Link<LinkButton&, void> m_aClickHdl;
+    Link<LinkButton&, bool> m_aActivateLinkHdl;
 
-    void signal_clicked() { m_aClickHdl.Call(*this); }
+    bool signal_activate_link() { return m_aActivateLinkHdl.Call(*this); }
 
 public:
     virtual void set_label(const OUString& rText) = 0;
@@ -1210,9 +1210,7 @@ public:
     virtual void set_uri(const OUString& rUri) = 0;
     virtual OUString get_uri() const = 0;
 
-    void clicked() { signal_clicked(); }
-
-    void connect_clicked(const Link<LinkButton&, void>& rLink) { m_aClickHdl = 
rLink; }
+    void connect_activate_link(const Link<LinkButton&, bool>& rLink) { 
m_aActivateLinkHdl = rLink; }
 };
 
 class VCL_DLLPUBLIC Scale : virtual public Widget
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 6b4dcd0a4032..83def998e546 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2691,8 +2691,9 @@ public:
 
 IMPL_LINK(SalInstanceLinkButton, ClickHdl, FixedHyperlink&, rButton, void)
 {
-    m_aOrigClickHdl.Call(rButton);
-    signal_clicked();
+    bool bConsumed = signal_activate_link();
+    if (!bConsumed)
+        m_aOrigClickHdl.Call(rButton);
 }
 
 class SalInstanceRadioButton : public SalInstanceButton, public virtual 
weld::RadioButton
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index b72495c13dc4..58d6f86a0f83 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6953,18 +6953,18 @@ private:
     GtkLinkButton* m_pButton;
     gulong m_nSignalId;
 
-    static void signalClicked(GtkButton*, gpointer widget)
+    static bool signalActivateLink(GtkButton*, gpointer widget)
     {
         GtkInstanceLinkButton* pThis = 
static_cast<GtkInstanceLinkButton*>(widget);
         SolarMutexGuard aGuard;
-        pThis->signal_clicked();
+        return pThis->signal_activate_link();
     }
 
 public:
     GtkInstanceLinkButton(GtkLinkButton* pButton, GtkInstanceBuilder* 
pBuilder, bool bTakeOwnership)
         : GtkInstanceContainer(GTK_CONTAINER(pButton), pBuilder, 
bTakeOwnership)
         , m_pButton(pButton)
-        , m_nSignalId(g_signal_connect(pButton, "clicked", 
G_CALLBACK(signalClicked), this))
+        , m_nSignalId(g_signal_connect(pButton, "activate-link", 
G_CALLBACK(signalActivateLink), this))
     {
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to