Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
Posts: 4
Registered: ‎10-28-2013
My Device: Q5
My Carrier: Blackberry

SystemListDialog in QML?

[ Edited ]

Hi.

 

I'm a beginner! I'm trying to use a SystemListDialog in my .qml file. All the examples that I have found are about C++ code. This is my code 

attachedObjects: [
     SystemListDialog {
          property bool created: false
          id: listDialog
          title: qsTr("Please select an email account!")
          onFinished: {
              if (listDialog.result == SystemUiResult.ConfirmButtonSelection) {
                    myInformation.setSelectedAccount(listDialog.selectedIndices());
                    myInformation.getActivationCode();
              } 
          }
     }
]
onClicked: {
      if (myInformation.noAccounts())
            myInformation.showEmptyAccounts()
      else {
            myInformation.addAccounts(listDialog)
            listDialog.show()
            myInformation.getActivationCode()
      }
}

The problem is that it never execute onFinished code. Maybe I can't use onFinished whit a SystemListDialog but I haven't found other property. Any idea?

 

Thanks, Carmen

 

MOD EDIT: Subject changed to reflect a new topic

Developer
Posts: 115
Registered: ‎10-22-2012
My Device: Developer
My Carrier: Mobifone

Re: SystemListDialog in QML?

Try this:
attachedObjects: [
     SystemListDialog {
          id: listDialog
          title: qsTr("Please select an email account!")
          onFinished: {
              if (value == SystemUiResult.ConfirmButtonSelection) {
                    myInformation.setSelectedAccount(listDialog.selectedIndices());
                    myInformation.getActivationCode();
              } 
          }
     }
]
onClicked: {
      if (myInformation.noAccounts())
            myInformation.showEmptyAccounts()
      else {
            myInformation.addAccounts(listDialog)
            listDialog.show()
      }
}

If it doesn't work, try add console debug code in the onFinished slots



Like my answer if it's helpful. Mark as answer if it help you solve the problem.
New Contributor
Posts: 4
Registered: ‎10-28-2013
My Device: Q5
My Carrier: Blackberry

Re: SystemListDialog in QML?

[ Edited ]

Hi. It doesn't work Smiley Sad. I changed my code 

 

onFinished: {
    if (value == SystemUiButton.confirmButton) {
        myInformation.showWrongCode();
        myInformation.setSelectedAccount(dialog.selectedIndices());
        myInformation.getActivationCode();
    } else if (value == SystemUiButton.cancelButton)
        myInformation.showSuccessCode();

 

It's never executes the "if" or "else if" code. I know that onFinished is working. And I have checked that selectedIndices() funtion doesn't work neither. I didn't understand your last suggestion.

Thanks to reply me so fast.

Any more idea?

Thanks, Carmen