Repository: nvaccess/nvda

Issue:
MS Outlook, answered e-mails are reported as "read"
### Steps to reproduce:
1. Open MS Outlook
2. Open NVDA and reply to an e-mail
3. Go back to inbox
4. Press arrow keys to navigate to the e-mail you have replied to.


### Expected behavior:
NVDA should report "replied".

### Actual behavior:
NVDA reports "read".

### System configuration:
NVDA version:
2018.2 RC2

NVDA Installed or portable:
Installed

Windows version:
Windows 10 1803 spring creators update.


Name and version of other software in use when reproducing the issue:
MS Outlook 2016

### Other questions:

Does the issue still occur after restarting your PC?
Yes

Have you tried any other versions of NVDA?
No.


Discussion:
I'm guessing that perhaps  your Outlook is in a non-english locale?

Most likely we will have to back out #7949 @leonardder?



Yes is in german.


Von meinem iPhone gesendet

> Am 01.06.2018 um 00:47 schrieb Michael Curran <notifications@github.com>:
> 
> I'm guessing that perhaps  your Outlook is in a non-english locale?
> 
> Most likely we will have to back out #7949 @leonardder?
> 
> 
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.

Could you please provide your language of use along with translations of the words read, unread, replied and forwarded as how they are used in Outlook?

> Op 1 jun. 2018 om 00:34 heeft Adriani90 <notifications@github.com> het volgende geschreven:
> 
> Steps to reproduce:
> 
> Open MS Outlook
> Open NVDA and reply to an e-mail
> Go back to inbox
> Press arrow keys to navigate to the e-mail you have replied to.
> Expected behavior:
> 
> NVDA should report "replied".
> 
> Actual behavior:
> 
> NVDA reports "read".
> 
> System configuration:
> 
> NVDA version:
> 2018.2 RC2
> 
> NVDA Installed or portable:
> Installed
> 
> Windows version:
> Windows 10 1803 spring creators update.
> 
> Name and version of other software in use when reproducing the issue:
> MS Outlook 2016
> 
> Other questions:
> 
> Does the issue still occur after restarting your PC?
> Yes
> 
> Have you tried any other versions of NVDA?
> No.
> 
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.

Read: „Gelesen“
Unread: „Ungelesen“
Replied: „Beantwortet“
Forwarded: „Weitergeleitet“.

Do you have to adjust it for every language?


Von meinem iPhone gesendet

> Am 01.06.2018 um 05:47 schrieb Leonard de Ruijter <notifications@github.com>:
> 
> Could you please provide your language of use along with translations of the words read, unread, replied and forwarded as how they are used in Outlook?
> 
> > Op 1 jun. 2018 om 00:34 heeft Adriani90 <notifications@github.com> het volgende geschreven:
> > 
> > Steps to reproduce:
> > 
> > Open MS Outlook
> > Open NVDA and reply to an e-mail
> > Go back to inbox
> > Press arrow keys to navigate to the e-mail you have replied to.
> > Expected behavior:
> > 
> > NVDA should report "replied".
> > 
> > Actual behavior:
> > 
> > NVDA reports "read".
> > 
> > System configuration:
> > 
> > NVDA version:
> > 2018.2 RC2
> > 
> > NVDA Installed or portable:
> > Installed
> > 
> > Windows version:
> > Windows 10 1803 spring creators update.
> > 
> > Name and version of other software in use when reproducing the issue:
> > MS Outlook 2016
> > 
> > Other questions:
> > 
> > Does the issue still occur after restarting your PC?
> > Yes
> > 
> > Have you tried any other versions of NVDA?
> > No.
> > 
> > —
> > You are receiving this because you are subscribed to this thread.
> > Reply to this email directly, view it on GitHub, or mute the thread.
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.

Language is german.


Von meinem iPhone gesendet

> Am 01.06.2018 um 05:47 schrieb Leonard de Ruijter <notifications@github.com>:
> 
> Could you please provide your language of use along with translations of the words read, unread, replied and forwarded as how they are used in Outlook?
> 
> > Op 1 jun. 2018 om 00:34 heeft Adriani90 <notifications@github.com> het volgende geschreven:
> > 
> > Steps to reproduce:
> > 
> > Open MS Outlook
> > Open NVDA and reply to an e-mail
> > Go back to inbox
> > Press arrow keys to navigate to the e-mail you have replied to.
> > Expected behavior:
> > 
> > NVDA should report "replied".
> > 
> > Actual behavior:
> > 
> > NVDA reports "read".
> > 
> > System configuration:
> > 
> > NVDA version:
> > 2018.2 RC2
> > 
> > NVDA Installed or portable:
> > Installed
> > 
> > Windows version:
> > Windows 10 1803 spring creators update.
> > 
> > Name and version of other software in use when reproducing the issue:
> > MS Outlook 2016
> > 
> > Other questions:
> > 
> > Does the issue still occur after restarting your PC?
> > Yes
> > 
> > Have you tried any other versions of NVDA?
> > No.
> > 
> > —
> > You are receiving this because you are subscribed to this thread.
> > Reply to this email directly, view it on GitHub, or mute the thread.
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.

Strictly spoken, it doesn't have to be adjusted for every language, 
however the code might contain some assumptions that aren't true.

I'm installing the German office language pack on this very moment and 
will report back about my findings.



Resolving patch:
diff --git a/source/appModules/outlook.py b/source/appModules/outlook.py
--- a/source/appModules/outlook.py
+++ b/source/appModules/outlook.py
@@ -29,14 +29,6 @@
 from NVDAObjects.behaviors import RowWithFakeNavigation, Dialog
 from NVDAObjects.UIA import UIA
 
-#: When in a list view, the message classes which should not be announced for an item.
-#: For these, it should be safe to assume that their names consist of only one word.
-silentMessageClasses = [
-	"IPM.Appointment",
-	"IPM.Contact",
-	"IPM.Note", # The class for a message
-]
-
 #: The number of seconds in a day, used to make all day appointments and selections less verbose.
 #: Type: float
 SECONDS_PER_DAY = 86400.0
@@ -445,10 +437,8 @@ def _get_name(self):
 				unread=selection.unread
 			except COMError:
 				unread=False
-			try:
-				messageClass=selection.messageClass
-			except COMError:
-				messageClass=None
+			# Translators: when an email is unread
+			if unread: textList.append(_("unread"))
 			try:
 				flagIcon=selection.flagIcon
 			except COMError:
@@ -467,28 +457,13 @@ def _get_name(self):
 				importance=1
 			importanceLabel=importanceLabels.get(importance)
 			if importanceLabel: textList.append(importanceLabel)
-			if self.appModule.outlookVersion<15:
-				# Translators: when an email is unread
-				if unread: textList.append(_("unread"))
-				if messageClass=="IPM.Schedule.Meeting.Request":
-					# Translators: the email is a meeting request
-					textList.append(_("meeting request"))
-			elif messageClass is not None:
-				# Replied or forwarded state for this message is available from the object's value.
-				# We must parse this value correctly, as it may contain redundant information, such as the message class and read value.
-				# We only expose the unread state, and message class for non-messages.
-				# The several states are localized and separated by a space.
-				# Example output: 'Meeting request Replied Read'
-				valueParts = self._getUIACacheablePropertyValue(UIAHandler.UIA_ValueValuePropertyId).split(" ")
-				valueCount = len(valueParts)
-				# The last valuePart indicates whether the message is read or unread.
-				# Do not expose the read state
-				lastPart = valueCount if unread else valueCount-1
-				# The first valuePart is the type of the selection, e.g. Message, Contact.
-				# We can safely assume that the classes in silentMessageClasses are one word.
-				# For messages other than regular mail messages (e.g. meeting request), the message class is relevant.
-				firstPart = max(1, valueCount-2) if messageClass in silentMessageClasses else 0
-				textList.extend(valueParts[firstPart:lastPart])
+			try:
+				messageClass=selection.messageClass
+			except COMError:
+				messageClass=None
+			if messageClass=="IPM.Schedule.Meeting.Request":
+				# Translators: the email is a meeting request
+				textList.append(_("meeting request"))
 		childrenCacheRequest=UIAHandler.handler.baseCacheRequest.clone()
 		childrenCacheRequest.addProperty(UIAHandler.UIA_NamePropertyId)
 		childrenCacheRequest.addProperty(UIAHandler.UIA_TableItemColumnHeaderItemsPropertyId)


Test patch: