escoz/QuickDialog — pull request #429 by bartvandendriessche (2013-03-04 07:03:09+00:00)
Title: Fix a bug where QuickDialogTableView throws an NSRangeException and crashes an app

QuickDialogTableView would sometimes try to scroll to an NSIndexPath beyond its bounds.

This happens when dynamically removing an indexPath from a tableview using deleteRowsAtIndexPaths:withRowAnimation:

e.g.:

Given: a QuickDialogTableView with 3 rows, and the indexPaths {0,0} {0,1} {0,2}.
And: indexPath {0,0} is selected (keyboard and prev|next buttons are visible)
When: I call deleteRowsAtIndexPaths:@[{0,1}] withRowAnimation:Whatever
And: I do not call [quickdialogTableView reloadData]
And: I tap the Next button
Then: QuickDialogTableView will try to scroll to {0,2}
And: the app will crash to a NSRangeException.

Removed QuickDialogTable::indexForElement: method because:

- it was only used in 2 places to obtain the NSIndexPath for the QElement to scroll to.
- it didn't take hidden QElements into account, which cause to NSRangeExceptions crashing an app

Instead, those 2 places now use QElement::getIndexPath which does take hidden QElements into account.