← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1534112] Re: Can select multiple files in downloads view when only one expected

 

So it appears it’s not a bug in the UITK, but in the way it is being
used in the browser and in the standalone example (see comment #1).
Changing ViewItems.selectedIndices in onSelectedChanged is not a good
idea.

I came up with a different approach which solves that issue:

import QtQuick 2.4
import Ubuntu.Components 1.3

ListView {
  id: listview
  width: 300
  height: 120
  model: 2
  delegate: ListItem {
    ListItemLayout {
      title.text: "selected: " + selected
    }
  }
  property int selectedIndex: -1
  ViewItems.selectMode: true
  ViewItems.onSelectedIndicesChanged: {
    if (ViewItems.selectedIndices.length > 1 && selectedIndex != -1) {
      var selection = ViewItems.selectedIndices
      selection.splice(selection.indexOf(selectedIndex), 1)
      selectedIndex = selection[0]
      ViewItems.selectedIndices = selection
      return
    }
    if (ViewItems.selectedIndices.length > 0) {
      selectedIndex = ViewItems.selectedIndices[0]
    } else {
      selectedIndex = -1
    }
  }
}

However I’m now seeing another issue: after selecting the first item,
then the second one, then the first one again, the 'selected' property
of the item doesn’t reflect the current state: the first item is
selected, selectedIndices is [0], yet the first delegate’s selected
property is false.

** Changed in: ubuntu-ui-toolkit (Ubuntu)
       Status: Confirmed => Invalid

** Changed in: ubuntu-ui-toolkit (Ubuntu)
     Assignee: Zsombor Egri (zsombi) => (unassigned)

-- 
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to ubuntu-ui-toolkit in Ubuntu.
https://bugs.launchpad.net/bugs/1534112

Title:
  Can select multiple files in downloads view when only one expected

Status in ubuntu-ui-toolkit package in Ubuntu:
  Invalid
Status in webbrowser-app package in Ubuntu:
  Triaged

Bug description:
  (originally reported in bug #1528651)

  Steps to reproduce:

   1) Browse to http://www.wufoo.com/html5/attributes/07-accept.html, click the "Select file" button
   2) Choose the browser as a content source
   3) Tap the first download in the list to select it
   4) Tap the second download in the list to select it, the first download is unselected
   5) Tap the first download again, the second one is unselected
   6) Tap the second one again

  Expected result: the first download in the list is unselected, only
  the second one is selected.

  Current result: both the first and the second download are selected.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1534112/+subscriptions