1
2
3
4
5
6
7
8
9
10 "Deals with Outlook Tasks import stuff"
11
12
13
14
15 import wx
16
17
18 import common_calendar
19 import native.outlook as ol
20 import outlook_calendar
21 import outlook_notes
22 import todo
23
24
25
26 _outlook_status={
27 ol.outlook_com.constants.olTaskNotStarted: todo.TodoEntry.ST_NotStarted,
28 ol.outlook_com.constants.olTaskInProgress: todo.TodoEntry.ST_InProgress,
29 ol.outlook_com.constants.olTaskComplete: todo.TodoEntry.ST_Completed,
30 ol.outlook_com.constants.olTaskWaiting: todo.TodoEntry.ST_NeedActions,
31 ol.outlook_com.constants.olTaskDeferred: todo.TodoEntry.ST_Cancelled }
32
33 _outlook_priority={
34 ol.outlook_com.constants.olImportanceLow: 10,
35 ol.outlook_com.constants.olImportanceNormal: 5,
36 ol.outlook_com.constants.olImportanceHigh: 1 }
37
42
44 try:
45 if v[0]>=common_calendar.no_end_date[0]:
46
47 return ''
48 return '%04d-%02d-%02d'% v[:3]
49 except (ValueError, TypeError):
50 return ''
51 except:
52 if __debug__: raise
53 return ''
54
60
61
63
64 _data_keys=[
65
66 ('Status', 'status', _convert_status),
67 ('DateCompleted', 'completion_date', outlook_calendar.to_bp_date),
68 ('Complete', 'complete', None),
69 ('Importance', 'priority', _convert_priority),
70 ('PercentComplete', 'percent_complete', None),
71 ('DueDate', 'due_date', outlook_calendar.to_bp_date),
72 ('Subject', 'summary', None),
73 ('Body', 'note', None),
74 ('Categories', 'categories', outlook_calendar.convert_categories),
75 ]
76
77 _default_filter={
78 'start': None,
79 'end': None,
80 'categories': None,
81 'non_completed': False,
82 }
83
84 _data_item_class=todo.TodoEntry
85 _default_folder_type='tasks'
86
89
91
92 if self._filter['non_completed'] and e['complete']:
93 return False
94
95 if e['due_date']!=common_calendar.no_end_date:
96 _date=e['due_date'][:3]
97 if self._filter['start'] is not None and \
98 _date<self._filter['start'][:3]:
99 return False
100 if self._filter['end'] is not None and \
101 _date>self._filter['end'][:3]:
102 return False
103 c=self._filter.get('categories', None)
104 if not c:
105
106 return True
107 if [x for x in e['categories'] if x in c]:
108 return True
109 return False
110
111 - def _populate_entry(self, entry, new_entry):
112 new_entry.status=entry.get('status', todo.TodoEntry.ST_NotStarted)
113 if entry['completion_date']!=common_calendar.no_end_date:
114 new_entry.completion_date='%04d%02d%02d'%entry['completion_date'][:3]
115 new_entry.priority=entry.get('priority', 5)
116 new_entry.percent_complete=entry.get('percent_complete', 0)
117 if entry['due_date']!=common_calendar.no_end_date:
118 new_entry.due_date='%04d%02d%02d'%entry['due_date'][:3]
119 new_entry.summary=entry.get('summary', None)
120 new_entry.note=entry.get('note', None)
121 v=[]
122 for k in entry.get('categories', []):
123 v.append({ 'category': k })
124 new_entry.categories=v
125
126
129
130
132 _column_labels=[
133 ('due_date', 'Due Date', 200, bp_date_str),
134 ('summary', 'Summary', 400, None),
135 ('status', 'Status', 200, status_str),
136 ('categories', 'Category', 200, common_calendar.category_str)
137 ]
138
139 _config_name='import/tasks/outlookdialog'
140 _browse_label='Outlook Tasks Folder:'
141 _progress_dlg_title='Outlook Tasks Import'
142 _error_dlg_title='Outlook Tasks Import Error'
143 _error_dlg_text='Outlook Tasks Items that failed to import:'
144 _data_class=OutlookTasksImportData
145 _filter_dlg_class=FilterDialog
146