Fix the update of TabView.currentIndex when inserting/removing tabs

- Update currentIndex when adding or inserting tabs.
- Make sure that we update the current index before updating the array
  to avoid a state of currentIndex > count -1 when removing the
  last tab, where a property binding on TabView.count could try
  fetching a tab past the array limit through TabView.getTab.
- Only decrease currentIndex when removedIndex <= currentIndex to
  keep the current tab active when possible. Activate the next tab
  instead of the previous one when the current tab is removed to make
  it more instinctive to remove multiple tabs successively.
- Keep the current behavior of leaving currentIndex to 0 when
  removing the last tab.

Change-Id: I030b86a03ce73f1177b1f04857abbdc2f7ec5835
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>