~stomato463/+junk/nvdajp

« back to all changes in this revision

Viewing changes to source/appModules/outlook.py

  • Committer: Masataka Shinke
  • Date: 2011-10-25 12:35:26 UTC
  • mfrom: (4185 jpmain)
  • mto: This revision was merged to the branch mainline in revision 4211.
  • Revision ID: mshinke@users.sourceforge.jp-20111025123526-ze527a2rl3z0g2ky
lp:~nishimotz/nvdajp/main : 4185 をマージ

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
from comtypes import COMError
8
8
import comtypes.client
9
 
import _default
 
9
import winUser
 
10
import appModuleHandler
10
11
import eventHandler
11
12
import controlTypes
12
 
from keyUtils import key, sendKey
13
13
from NVDAObjects.IAccessible import IAccessible
14
14
from NVDAObjects.window import Window
 
15
from NVDAObjects.IAccessible.MSHTML import MSHTML
15
16
 
16
17
def getContactString(obj):
17
18
                return ", ".join([x for x in [obj.fullName,obj.companyName,obj.jobTitle,obj.email1address] if x and not x.isspace()])
36
37
        nameList.append(_("sent: %s")%obj.sentOn)
37
38
        return ", ".join(nameList)
38
39
 
39
 
class AppModule(_default.AppModule):
 
40
class AppModule(appModuleHandler.AppModule):
40
41
 
41
42
        def _get_nativeOm(self):
42
43
                if not getattr(self,'_nativeOm',None):
64
65
                if role==controlTypes.ROLE_EDITABLETEXT and windowClassName=="RichEdit20W" and controlID==8224:
65
66
                        obj.parent=Window._get_parent(Window._get_parent(obj))
66
67
                #The control that shows HTML messages has stuffed parents. Use the control's parent window as its parent
67
 
                if windowClassName=="Internet Explorer_Server" and role==controlTypes.ROLE_PANE and not getattr(obj,'HTMLNode'):
 
68
                if windowClassName=="Internet Explorer_Server" and role==controlTypes.ROLE_PANE and not isinstance(obj,MSHTML):
68
69
                        obj.parent=Window._get_parent(Window._get_parent(obj))
69
70
                if role in (controlTypes.ROLE_MENUBAR,controlTypes.ROLE_MENUITEM):
70
71
                        obj.description=None
71
72
                if role in (controlTypes.ROLE_TREEVIEW,controlTypes.ROLE_TREEVIEWITEM,controlTypes.ROLE_LIST,controlTypes.ROLE_LISTITEM):
72
73
                        obj.shouldAllowIAccessibleFocusEvent=True
73
74
                if ((windowClassName=="SUPERGRID" and controlID==4704) or (windowClassName=="rctrl_renwnd32" and controlID==109)) and role==controlTypes.ROLE_UNKNOWN:
74
 
                        obj.role=controlTypes.ROLE_ICON
 
75
                        obj.role=controlTypes.ROLE_LISTITEM
75
76
 
76
77
        def chooseNVDAObjectOverlayClasses(self, obj, clsList):
77
78
                role=obj.role
84
85
                        outlookVersion=self.outlookVersion
85
86
                        if outlookVersion and outlookVersion<=9:
86
87
                                clsList.insert(0, MessageList_pre2003)
87
 
                        return
 
88
                        elif isinstance(obj,IAccessible) and obj.event_objectID==winUser.OBJID_CLIENT and obj.event_childID==0:
 
89
                                clsList.insert(0,SuperGridClient2010)
 
90
 
 
91
class SuperGridClient2010(IAccessible):
 
92
 
 
93
        def isDuplicateIAccessibleEvent(self,obj):
 
94
                return False
88
95
 
89
96
class MessageList_pre2003(IAccessible):
90
97
 
117
124
                if msg:
118
125
                        eventHandler.executeEvent("gainFocus",self.curMessageItem)
119
126
 
120
 
        def script_moveByMessage(self,keyPress):
 
127
        def script_moveByMessage(self,gesture):
121
128
                if hasattr(self,'curMessageItem'):
122
129
                        oldEntryID=self.curMessageItem.msg.entryID
123
130
                else:
124
131
                        oldEntryID=None
125
 
                sendKey(keyPress)
 
132
                gesture.send()
126
133
                try:
127
134
                        msg=self.nativeOm.ActiveExplorer().selection[0]
128
135
                except:
135
142
                                self.curMessageItem=messageItem
136
143
                                eventHandler.executeEvent("gainFocus",messageItem)
137
144
 
138
 
[MessageList_pre2003.bindKey(keyName,scriptName) for keyName,scriptName in [
139
 
        ("extendedDown","moveByMessage"),
140
 
        ("extendedUp","moveByMessage"),
141
 
        ("extendedHome","moveByMessage"),
142
 
        ("extendedEnd","moveByMessage"),
143
 
        ("extendedDelete","moveByMessage"),
144
 
]]
 
145
        __moveByMessageGestures = (
 
146
                "kb:downArrow",
 
147
                "kb:upArrow",
 
148
                "kb:home",
 
149
                "kb:end",
 
150
                "kb:delete",
 
151
        )
 
152
 
 
153
        def initOverlayClass(self):
 
154
                for gesture in self.__moveByMessageGestures:
 
155
                        self.bindGesture(gesture, "moveByMessage")
145
156
 
146
157
class MessageItem(Window):
147
158
 
169
180
 
170
181
class AddressBookEntry(IAccessible):
171
182
 
172
 
        def script_moveByEntry(self,keyPress):
173
 
                sendKey(keyPress)
 
183
        def script_moveByEntry(self,gesture):
 
184
                gesture.send()
174
185
                eventHandler.queueEvent("nameChange",self)
175
186
 
176
 
[AddressBookEntry.bindKey(keyName,scriptName) for keyName,scriptName in [
177
 
        ("extendedDown","moveByEntry"),
178
 
        ("extendedUp","moveByEntry"),
179
 
        ("extendedHome","moveByEntry"),
180
 
        ("extendedEnd","moveByEntry"),
181
 
        ("extendedDelete","moveByEntry"),
182
 
]]
 
187
        __moveByEntryGestures = (
 
188
                "kb:downArrow",
 
189
                "kb:upArrow",
 
190
                "kb:home",
 
191
                "kb:end",
 
192
                "kb:delete",
 
193
        )
 
194
 
 
195
        def initOverlayClass(self):
 
196
                for gesture in self.__moveByEntryGestures:
 
197
                        self.bindGesture(gesture, "moveByEntry")