Accessibility OS X: Improve password handling
Set the right sub role (NSAccessibilitySecureTextFieldSubrole) and return the bullet point character for the text contents. This alignes the behavior with native widgets. Change-Id: I7305e08dca61097dd8c050aed64c792c06de0a4d Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
This commit is contained in:
parent
1568074a60
commit
4a251da5bb
@ -195,6 +195,8 @@ NSString *macSubrole(QAccessibleInterface *interface)
|
|||||||
QAccessible::State s = interface->state();
|
QAccessible::State s = interface->state();
|
||||||
if (s.searchEdit)
|
if (s.searchEdit)
|
||||||
return NSAccessibilitySearchFieldSubrole;
|
return NSAccessibilitySearchFieldSubrole;
|
||||||
|
if (s.passwordEdit)
|
||||||
|
return NSAccessibilitySecureTextFieldSubrole;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,18 +351,23 @@ id getValueAttribute(QAccessibleInterface *interface)
|
|||||||
const QAccessible::Role qtrole = interface->role();
|
const QAccessible::Role qtrole = interface->role();
|
||||||
if (qtrole == QAccessible::EditableText) {
|
if (qtrole == QAccessible::EditableText) {
|
||||||
if (QAccessibleTextInterface *textInterface = interface->textInterface()) {
|
if (QAccessibleTextInterface *textInterface = interface->textInterface()) {
|
||||||
|
|
||||||
|
int begin = 0;
|
||||||
|
int end = textInterface->characterCount();
|
||||||
|
QString text;
|
||||||
|
if (interface->state().passwordEdit) {
|
||||||
|
// return round password replacement chars
|
||||||
|
text = QString(end, QChar(kBulletUnicode));
|
||||||
|
} else {
|
||||||
// VoiceOver will read out the entire text string at once when returning
|
// VoiceOver will read out the entire text string at once when returning
|
||||||
// text as a value. For large text edits the size of the returned string
|
// text as a value. For large text edits the size of the returned string
|
||||||
// needs to be limited and text range attributes need to be used instead.
|
// needs to be limited and text range attributes need to be used instead.
|
||||||
// NSTextEdit returns the first sentence as the value, Do the same here:
|
// NSTextEdit returns the first sentence as the value, Do the same here:
|
||||||
int begin = 0;
|
|
||||||
int end = textInterface->characterCount();
|
|
||||||
// ### call to textAfterOffset hangs. Booo!
|
// ### call to textAfterOffset hangs. Booo!
|
||||||
//if (textInterface->characterCount() > 0)
|
//if (textInterface->characterCount() > 0)
|
||||||
// textInterface->textAfterOffset(0, QAccessible2::SentenceBoundary, &begin, &end);
|
// textInterface->textAfterOffset(0, QAccessible2::SentenceBoundary, &begin, &end);
|
||||||
|
text = textInterface->text(begin, end);
|
||||||
QString text = textInterface->text(begin, end);
|
}
|
||||||
//qDebug() << "text" << begin << end << text;
|
|
||||||
return QCFString::toNSString(text);
|
return QCFString::toNSString(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user