135 |
135 |
136 def __addEntry(self): |
136 def __addEntry(self): |
137 """ |
137 """ |
138 Private slot to manually add an entry. |
138 Private slot to manually add an entry. |
139 """ |
139 """ |
140 # TODO: implement this |
140 tasks = [] |
|
141 for index in range(self.taskCombo.count()): |
|
142 tasks.append(self.taskCombo.itemText(index)) |
|
143 comments = [] |
|
144 for index in range(self.commentCombo.count()): |
|
145 comments.append(self.commentCombo.itemText(index)) |
|
146 dlg = TimeTrackerEntryDialog(self.__tracker, None, tasks, comments) |
|
147 if dlg.exec_() == QDialog.Accepted: |
|
148 self.__tracker.addTrackerEntry(*dlg.getData()) |
141 |
149 |
142 def __editEntry(self): |
150 def __editEntry(self): |
143 """ |
151 """ |
144 Private slot to edit the selected tracker entry. |
152 Private slot to edit the selected tracker entry. |
145 """ |
153 """ |
153 for index in range(self.taskCombo.count()): |
161 for index in range(self.taskCombo.count()): |
154 tasks.append(self.taskCombo.itemText(index)) |
162 tasks.append(self.taskCombo.itemText(index)) |
155 comments = [] |
163 comments = [] |
156 for index in range(self.commentCombo.count()): |
164 for index in range(self.commentCombo.count()): |
157 comments.append(self.commentCombo.itemText(index)) |
165 comments.append(self.commentCombo.itemText(index)) |
158 dlg = TimeTrackerEntryDialog(entry, tasks, comments) |
166 dlg = TimeTrackerEntryDialog(self.__tracker, entry, tasks, comments) |
159 if dlg.exec_() == QDialog.Accepted: |
167 if dlg.exec_() == QDialog.Accepted: |
160 start, duration, task, comment = dlg.getData() |
168 start, duration, task, comment = dlg.getData() |
161 |
169 |
162 entry.setStartDateTime(start) |
170 entry.setStartDateTime(start) |
163 entry.setDuration(duration) |
171 entry.setDuration(duration) |
164 entry.setTask(task) |
172 entry.setTask(task) |
165 entry.setComment(comment) |
173 entry.setComment(comment) |
166 self.__tracker.entryChanged() |
174 self.__tracker.entryChanged() |
167 |
175 |
168 eid, date, time, duration, task, comment, paused = entry.getEntryData() |
176 date, time, duration, task, comment = entry.getEntryData()[1:-1] |
169 itm.setText(0, self.tr("{0}, {1}", "date, time").format(date, time)) |
177 itm.setText(0, self.tr("{0}, {1}", "date, time").format(date, time)) |
170 itm.setText(1, self.tr("{0} min").format(duration)) |
178 itm.setText(1, self.tr("{0} min").format(duration)) |
171 itm.setText(2, task) |
179 itm.setText(2, task) |
172 itm.setText(3, comment) |
180 itm.setText(3, comment) |
173 self.__resizeColumns() |
181 self.__resizeColumns() |