summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2012-03-07 11:59:30 +0100
committerQt by Nokia <qt-info@nokia.com>2012-07-11 02:47:34 +0200
commit159b28d97226c9b40e3e47188396a17cee70852e (patch)
tree1abec302b1433a111a6df8127ce5a15ce88252ce /src/gui/accessible
parent825cd7b9e5ac16546fe224d48e5ea319fc171248 (diff)
Remove clipboard operations from QAccessibleEditableTextInterface
Also, remove its subclass QAccessibleSimpleEditableTextInterface Instead of having the subclass that implements this conveniently, we move this behaviour over to the bridge. The bridge should check if role() == EditableText is set, and then it should try to support the IAccessibleEditableText interface (i.e. it should accept the calls to replaceText(), deleteText() and insertText()) and change the text with the following operations: 1. Query the text using QAccessibleTextInterface::text() or by using QAccessibleInterface::text(QAccessible::Value) as a fallback 2. Do the requested delete/insert/replace manipulation 3. Update the text with setText(QAccessible::Value, newText); Change-Id: Iee5e41faf14351951e2bfca8c9eac970a113e878 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/qaccessible2.cpp113
-rw-r--r--src/gui/accessible/qaccessible2.h21
2 files changed, 1 insertions, 133 deletions
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index 41275628f2..4936846d6c 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -190,10 +190,6 @@ QT_BEGIN_NAMESPACE
When implementing this interface you will almost certainly also want to implement \l QAccessibleTextInterface.
- Since this interface can be implemented by means of the normal \l QAccessibleTextInterface,
- \l QAccessibleSimpleEditableTextInterface provides a convenience implementation of this interface.
- Consider inheriting \l QAccessibleSimpleEditableTextInterface instead.
-
\sa QAccessibleInterface
\l{IAccessible2 Specification}
@@ -206,14 +202,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QAccessibleEditableTextInterface::copyText(int startOffset, int endOffset) const
-
- Copies the text from \a startOffset to \a endOffset to the system clip board.
- The \a startOffset is the first character that will be copied.
- The \a endOffset is the first character that will not be copied.
-*/
-
-/*!
\fn void QAccessibleEditableTextInterface::deleteText(int startOffset, int endOffset)
Deletes the text from \a startOffset to \a endOffset.
@@ -226,18 +214,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QAccessibleEditableTextInterface::cutText(int startOffset, int endOffset)
-
- Removes the text from \a startOffset to \a endOffset and puts it in the system clip board.
-*/
-
-/*!
- \fn void QAccessibleEditableTextInterface::pasteText(int offset)
-
- Pastes text from the system clip board at the position \a offset.
-*/
-
-/*!
\fn void QAccessibleEditableTextInterface::replaceText(int startOffset, int endOffset, const QString &text)
Removes the text from \a startOffset to \a endOffset and instead inserts \a text.
@@ -250,20 +226,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \class QAccessibleSimpleEditableTextInterface
- \inmodule QtGui
- \ingroup accessibility
- \internal
-
- \brief The QAccessibleSimpleEditableTextInterface class is a convenience class for
- text-based widgets. It can be inherited instead of \l QAccessibleEditableTextInterface.
-
- \sa QAccessibleInterface, QAccessibleEditableTextInterface
-
- \l{IAccessible2 Specification}
-*/
-
-/*!
+ \class QAccessibleValueInterface
\class QAccessibleValueInterface
\inmodule QtGui
\ingroup accessibility
@@ -667,80 +630,6 @@ QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryT
return text.mid(*startOffset, *endOffset - *startOffset);
}
-QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface(
- QAccessibleInterface *accessibleInterface)
- : iface(accessibleInterface)
-{
- Q_ASSERT(iface);
-}
-
-#ifndef QT_NO_CLIPBOARD
-static QString textForRange(QAccessibleInterface *iface, int startOffset, int endOffset)
-{
- return iface->text(QAccessible::Value).mid(startOffset, endOffset - startOffset);
-}
-#endif
-
-/*! \reimp */
-void QAccessibleSimpleEditableTextInterface::copyText(int startOffset, int endOffset) const
-{
-#ifdef QT_NO_CLIPBOARD
- Q_UNUSED(startOffset);
- Q_UNUSED(endOffset);
-#else
- QGuiApplication::clipboard()->setText(textForRange(iface, startOffset, endOffset));
-#endif
-}
-
-/*! \reimp */
-void QAccessibleSimpleEditableTextInterface::deleteText(int startOffset, int endOffset)
-{
- QString txt = iface->text(QAccessible::Value);
- txt.remove(startOffset, endOffset - startOffset);
- iface->setText(QAccessible::Value, txt);
-}
-
-/*! \reimp */
-void QAccessibleSimpleEditableTextInterface::insertText(int offset, const QString &text)
-{
- QString txt = iface->text(QAccessible::Value);
- txt.insert(offset, text);
- iface->setText(QAccessible::Value, txt);
-}
-
-/*! \reimp */
-void QAccessibleSimpleEditableTextInterface::cutText(int startOffset, int endOffset)
-{
-#ifdef QT_NO_CLIPBOARD
- Q_UNUSED(startOffset);
- Q_UNUSED(endOffset);
-#else
- QString sub = textForRange(iface, startOffset, endOffset);
- deleteText(startOffset, endOffset);
- QGuiApplication::clipboard()->setText(sub);
-#endif
-}
-
-/*! \reimp */
-void QAccessibleSimpleEditableTextInterface::pasteText(int offset)
-{
-#ifdef QT_NO_CLIPBOARD
- Q_UNUSED(offset);
-#else
- QString txt = iface->text(QAccessible::Value);
- txt.insert(offset, QGuiApplication::clipboard()->text());
- iface->setText(QAccessible::Value, txt);
-#endif
-}
-
-/*! \reimp */
-void QAccessibleSimpleEditableTextInterface::replaceText(int startOffset, int endOffset, const QString &text)
-{
- QString txt = iface->text(QAccessible::Value);
- txt.replace(startOffset, endOffset - startOffset, text);
- iface->setText(QAccessible::Value, txt);
-}
-
QT_END_NAMESPACE
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index 922fb73b7d..91f6b73f3e 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -97,30 +97,9 @@ class Q_GUI_EXPORT QAccessibleEditableTextInterface
public:
virtual ~QAccessibleEditableTextInterface() {}
- virtual void copyText(int startOffset, int endOffset) const = 0;
virtual void deleteText(int startOffset, int endOffset) = 0;
virtual void insertText(int offset, const QString &text) = 0;
- virtual void cutText(int startOffset, int endOffset) = 0;
- virtual void pasteText(int offset) = 0;
virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
- virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0;
-};
-
-class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface
-{
-public:
- explicit QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); //###
-
- void copyText(int startOffset, int endOffset) const;
- void deleteText(int startOffset, int endOffset);
- void insertText(int offset, const QString &text);
- void cutText(int startOffset, int endOffset);
- void pasteText(int offset);
- void replaceText(int startOffset, int endOffset, const QString &text);
- inline void setAttributes(int, int, const QString &) {}
-
-private:
- QAccessibleInterface *iface;
};
class Q_GUI_EXPORT QAccessibleValueInterface