81 entry = self.__tracker.getCurrentEntry() |
81 entry = self.__tracker.getCurrentEntry() |
82 duration = entry.getDuration() |
82 duration = entry.getDuration() |
83 |
83 |
84 itm = self.entriesList.topLevelItem(0) |
84 itm = self.entriesList.topLevelItem(0) |
85 itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) |
85 itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) |
86 self.entriesList.resizeColumnToContents(self.CommentColumn) |
86 self.entriesList.resizeColumnToContents(self.DurationColumn) |
87 |
87 |
88 self.durationSpinBox.setValue(duration) |
88 self.durationSpinBox.setValue(duration) |
89 else: |
89 else: |
90 self.__tracker.continueTrackerEntry() |
90 self.__tracker.continueTrackerEntry() |
91 |
91 |
101 itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) |
101 itm.setText(self.DurationColumn, self.tr("{0} min").format(duration)) |
102 itm.setData(0, Qt.UserRole, eid) |
102 itm.setData(0, Qt.UserRole, eid) |
103 else: |
103 else: |
104 itm = self.entriesList.takeTopLevelItem(0) |
104 itm = self.entriesList.takeTopLevelItem(0) |
105 del itm |
105 del itm |
106 self.entriesList.resizeColumnToContents(self.CommentColumn) |
106 self.__resizeColumns() |
107 |
107 |
108 # start a new one |
108 # start a new one |
109 self.__tracker.startTrackerEntry() |
109 self.__tracker.startTrackerEntry() |
110 |
110 |
111 @pyqtSlot(QPoint) |
111 @pyqtSlot(QPoint) |
141 |
141 |
142 def __editEntry(self): |
142 def __editEntry(self): |
143 """ |
143 """ |
144 Private slot to edit the selected tracker entry. |
144 Private slot to edit the selected tracker entry. |
145 """ |
145 """ |
146 eid = self.entriesList.selectedItems()[0].data(0, Qt.UserRole) |
146 itm = self.entriesList.selectedItems()[0] |
|
147 eid = itm.data(0, Qt.UserRole) |
147 if eid > -1: |
148 if eid > -1: |
148 # the current entry is edited via the elements of this widget |
149 # the current entry is edited via the elements of this widget |
149 entry = self.__tracker.getEntry(eid) |
150 entry = self.__tracker.getEntry(eid) |
150 if entry is not None: |
151 if entry is not None: |
151 tasks = [] |
152 tasks = [] |
155 for index in range(self.commentCombo.count()): |
156 for index in range(self.commentCombo.count()): |
156 comments.append(self.commentCombo.itemText(index)) |
157 comments.append(self.commentCombo.itemText(index)) |
157 dlg = TimeTrackerEntryDialog(entry, tasks, comments) |
158 dlg = TimeTrackerEntryDialog(entry, tasks, comments) |
158 if dlg.exec_() == QDialog.Accepted: |
159 if dlg.exec_() == QDialog.Accepted: |
159 start, duration, task, comment = dlg.getData() |
160 start, duration, task, comment = dlg.getData() |
|
161 |
160 entry.setStartDateTime(start) |
162 entry.setStartDateTime(start) |
161 entry.setDuration(duration) |
163 entry.setDuration(duration) |
162 entry.setTask(task) |
164 entry.setTask(task) |
163 entry.setComment(comment) |
165 entry.setComment(comment) |
164 self.__tracker.entryChanged() |
166 self.__tracker.entryChanged() |
|
167 |
|
168 eid, date, time, duration, task, comment, paused = entry.getEntryData() |
|
169 itm.setText(0, self.tr("{0}, {1}", "date, time").format(date, time)) |
|
170 itm.setText(1, self.tr("{0} min").format(duration)) |
|
171 itm.setText(2, task) |
|
172 itm.setText(3, comment) |
|
173 self.__resizeColumns() |
165 |
174 |
166 def __deleteSelectedEntries(self): |
175 def __deleteSelectedEntries(self): |
167 """ |
176 """ |
168 Private slot to delete the selected tracker entries. |
177 Private slot to delete the selected tracker entries. |
169 """ |
178 """ |