258 return; |
258 return; |
259 |
259 |
260 QListWidgetItem* qItem = qHistoryList->selectedItems ()[0]; |
260 QListWidgetItem* qItem = qHistoryList->selectedItems ()[0]; |
261 |
261 |
262 // Find the index of the edit |
262 // Find the index of the edit |
263 long idx = -1; |
263 long lIdx; |
264 QListWidgetItem* it; |
264 for (lIdx = 0; lIdx < qHistoryList->count (); ++lIdx) |
265 while ((it = qHistoryList->item (++idx)) != null) |
265 if (qHistoryList->item (lIdx) == qItem) |
266 if (it == qItem) |
266 break; |
267 break; |
267 |
268 |
268 // qHistoryList is 0-based, History is -1-based, thus decrement |
269 idx--; // qHistoryList is 0-based, History is -1-based. |
269 // the index now |
270 |
270 lIdx--; |
271 if (idx == History::pos ()) |
271 |
|
272 if (lIdx == History::pos ()) |
272 return; |
273 return; |
273 |
274 |
274 // Seek to the selected edit by repeadetly undoing or redoing. |
275 // Seek to the selected edit by repeadetly undoing or redoing. |
275 while (History::pos () != idx) { |
276 while (History::pos () != lIdx) { |
276 if (History::pos () > idx) |
277 if (History::pos () > lIdx) |
277 History::undo (); |
278 History::undo (); |
278 else |
279 else |
279 History::redo (); |
280 History::redo (); |
280 } |
281 } |
281 |
282 |