[Libreoffice-commits] core.git: cui/source cui/uiconfig
Heiko Tietze (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 20 12:27:40 UTC 2020
cui/source/dialogs/about.cxx | 27 +++++++++++++++++++++++++++
cui/source/inc/about.hxx | 3 +++
cui/uiconfig/ui/aboutdialog.ui | 16 +++++++++++++++-
3 files changed, 45 insertions(+), 1 deletion(-)
New commits:
commit d2323f3df20e77a1b1245783fac077b49456732d
Author: Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Fri Apr 17 13:20:36 2020 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Apr 20 14:27:03 2020 +0200
Resolves tdf#132179 - Improve accessibility for the About dialog
Button added to copy version info
Static text made non-selectable to avoid uncommon tabbing
Change-Id: I4c2107b8120797a7cd532b59ca5ccb58ab61a2ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92418
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index ec5d6b98930b..e96fb2a50ee1 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -37,6 +37,11 @@
#include <sfx2/app.hxx> //SfxApplication::loadBrandSvg
#include <strings.hrc>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
+#include <vcl/textview.hxx>
+#include <tools/diagnose_ex.h>
+
#include <config_feature_opencl.h>
#if HAVE_FEATURE_OPENCL
#include <opencl/openclwrapper.hxx>
@@ -52,6 +57,7 @@ AboutDialog::AboutDialog(weld::Window *pParent)
m_pWebsiteButton(m_xBuilder->weld_link_button("btnWebsite")),
m_pReleaseNotesButton(m_xBuilder->weld_link_button("btnReleaseNotes")),
m_pCloseButton(m_xBuilder->weld_button("btnClose")),
+ m_pCopyButton(m_xBuilder->weld_button("btnCopyVersion")),
m_pBrandImage(m_xBuilder->weld_image("imBrand")),
m_pAboutImage(m_xBuilder->weld_image("imAbout")),
m_pVersionLabel(m_xBuilder->weld_label("lbVersion")),
@@ -101,6 +107,7 @@ AboutDialog::AboutDialog(weld::Window *pParent)
m_pReleaseNotesButton->set_uri(sURL);
//Handler
+ m_pCopyButton->connect_clicked(LINK(this, AboutDialog, HandleClick));
m_pCloseButton->grab_focus();
}
@@ -241,4 +248,24 @@ OUString AboutDialog::GetCopyrightString() {
return aCopyrightString;
}
+IMPL_LINK_NOARG(AboutDialog, HandleClick, weld::Button &, void) {
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
+ css::datatransfer::clipboard::SystemClipboard::create(
+ comphelper::getProcessComponentContext());
+
+ if (xClipboard.is()) {
+ css::uno::Reference<css::datatransfer::XTransferable> xDataObj(
+ new TETextDataObject(m_pVersionLabel->get_label()));
+ try {
+ xClipboard->setContents(xDataObj, nullptr);
+
+ css::uno::Reference<css::datatransfer::clipboard::XFlushableClipboard>
+ xFlushableClipboard(xClipboard, css::uno::UNO_QUERY);
+ if (xFlushableClipboard.is())
+ xFlushableClipboard->flushClipboard();
+ } catch (const css::uno::Exception &) {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to copy");
+ }
+ }
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx
index ab03768a27df..bd90143a83e6 100644
--- a/cui/source/inc/about.hxx
+++ b/cui/source/inc/about.hxx
@@ -29,6 +29,7 @@ private:
std::unique_ptr<weld::LinkButton> m_pWebsiteButton;
std::unique_ptr<weld::LinkButton> m_pReleaseNotesButton;
std::unique_ptr<weld::Button> m_pCloseButton;
+ std::unique_ptr<weld::Button> m_pCopyButton;
std::unique_ptr<weld::Image> m_pBrandImage;
std::unique_ptr<weld::Image> m_pAboutImage;
@@ -41,6 +42,8 @@ private:
static OUString GetLocaleString();
static bool IsStringValidGitHash(const OUString& hash);
+ DECL_LINK(HandleClick, weld::Button&, void);
+
public:
AboutDialog(weld::Window* pParent);
virtual ~AboutDialog() override;
diff --git a/cui/uiconfig/ui/aboutdialog.ui b/cui/uiconfig/ui/aboutdialog.ui
index e1a1c1a18b71..d61aea94cf88 100644
--- a/cui/uiconfig/ui/aboutdialog.ui
+++ b/cui/uiconfig/ui/aboutdialog.ui
@@ -24,6 +24,21 @@
<property name="margin_top">12</property>
<property name="hexpand">True</property>
<property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="btnCopyVersion">
+ <property name="label" translatable="yes" context="aboutdialog|copy">Copy _Version Info</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>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
<child>
<object class="GtkButton" id="btnClose">
<property name="label">gtk-close</property>
@@ -136,7 +151,6 @@ CPU threads
Locale:
Calc:</property>
<property name="wrap">True</property>
- <property name="selectable">True</property>
<property name="max_width_chars">50</property>
<property name="xalign">0</property>
</object>
More information about the Libreoffice-commits
mailing list