Commit 4e7c5381 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Share duplicated accessibility-related local helpers

GnuPG-bug-id: 5916
parent 93e93df6
......@@ -70,6 +70,7 @@ endif()
ki18n_wrap_ui(_kleopatra_uiserver_SRCS crypto/gui/signingcertificateselectionwidget.ui)
set(_kleopatra_SRCS
utils/accessibility.cpp
utils/gui-helper.cpp
utils/filedialog.cpp
utils/kdpipeiodevice.cpp
......
......@@ -13,6 +13,7 @@
#include "commands/detailscommand.h"
#include "dialogs/groupdetailsdialog.h"
#include "utils/accessibility.h"
#include "view/errorlabel.h"
#include <QAccessible>
......@@ -484,25 +485,6 @@ void CertificateLineEdit::Private::setAccessibleName(const QString &s)
updateAccessibleNameAndDescription();
}
namespace
{
QString getAccessibleName(QObject *object)
{
QString name;
if (const auto *const iface = QAccessible::queryAccessibleInterface(object)) {
name = iface->text(QAccessible::Name);
}
return name;
}
QString invalidEntryText()
{
return i18nc("text for screen readers to indicate that the associated object, "
"such as a form field, has an error",
"invalid entry");
}
}
void CertificateLineEdit::Private::updateAccessibleNameAndDescription()
{
// fall back to default accessible name if accessible name wasn't set explicitly
......
......@@ -11,6 +11,7 @@
#include <config-kleopatra.h>
#include "revokekeydialog.h"
#include "utils/accessibility.h"
#include "view/errorlabel.h"
#include <Libkleo/Formatting>
......@@ -48,22 +49,6 @@ using namespace GpgME;
namespace
{
QString getAccessibleName(QObject *object)
{
QString name;
if (const auto *const iface = QAccessible::queryAccessibleInterface(object)) {
name = iface->text(QAccessible::Name);
}
return name;
}
QString invalidEntryText()
{
return i18nc("text for screen readers to indicate that the associated object, "
"such as a form field, has an error",
"invalid entry");
}
class TextEdit : public QTextEdit
{
Q_OBJECT
......
/* utils/accessibility.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kleopatra.h>
#include "accessibility.h"
#include <KLocalizedString>
#include <QAccessible>
#include <QObject>
QString Kleo::getAccessibleName(QObject *object)
{
QString name;
if (const auto *const iface = QAccessible::queryAccessibleInterface(object)) {
name = iface->text(QAccessible::Name);
}
return name;
}
QString Kleo::invalidEntryText()
{
return i18nc("text for screen readers to indicate that the associated object, "
"such as a form field, has an error",
"invalid entry");
}
/* utils/accessibility.h
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
class QObject;
class QString;
namespace Kleo
{
QString getAccessibleName(QObject *object);
QString invalidEntryText();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment