HELP the multiple ContactPicker in QML

I have this code

ActionItem
            {
                title: "Invite Contacts"
                ActionBar.placement: ActionBarPlacement.OnBar
                imageSource: "asset:///images/titleAddFriend.png"
                onTriggered:
                {
                    contactPicker.open();
                }

                attachedObjects: ContactPicker
                {
                    id: contactPicker
                    mode: ContactSelectionMode.Multiple
                    onContactsSelected:
                    {
                        for(var i = 0; i < selectedContactsIds.length; i++)
                        {
                            var phoneNumber = _app.getContactPhoneNumber(selectedContactsIds[i]);
                            console.log("PHONE: " + phoneNumber);
                        }
                    }
                }
            }

but does simply not multiple selector. It still operates as the single contact selector by default. I added a qml register type in main.cpp and libraries are also imported. any suggestions please? This problem is also present although 10.1 and OS 10.2.1 tried.

I thought about it... its another case of QML it can not handle.  After testing your code, I noticed this error

file:///apps/com.example.dynamicattach.testDev_namicattach58cf113_/native/assets//main.qml:51: ReferenceError: Can't find variable: ContactSelectionMode

So I tried to import ContactSelectionMode qml as the selector is with no success.

So, I stuck with c ++ for the switch and got the results of work

The solution

applicationUI.cpp

#include 
#include 
void ApplicationUI::contacts()
{
      ContactPicker *contactPicker = new ContactPicker();
      contactPicker->setMode(ContactSelectionMode::Multiple);
      contactPicker->setKindFilters(QSet()
           << bb::pim::contacts::AttributeKind::Phone);

      bool success = QObject::connect(contactPicker,
             SIGNAL(contactsSelected(QList)),
             this,
             SLOT(onContactsSelected(QList)));

      if (success) { // Signal was successfully connected.
            contactPicker->open();
          } else { // Failed to connect to signal.
            qDebug() << "Didn't connect the picker signal";
          }
}

void ApplicationUI::onContactsSelected(const QList &contactIds) {

    qDebug() << "contacts" << contactIds;
}

applicationUI.hpp

public:
    ApplicationUI(bb::cascades::Application *app);
    virtual ~ApplicationUI() { }

    Q_INVOKABLE void contacts();

public slots:
    void onContactsSelected(const QList &contactIds);

. QML

Button {
                id: contact
                text: "Pick Contact"
                onClicked: {
                    cpp.contacts();
                }

            }

Now, given that the function is entirely in c ++, you should be able to take your code to

_app.getContactPhoneNumber(selectedContactsIds[i]);

and just insert into onContactsSelected to get your phone numbers

I hope that helps!  Now I know how to do it too =)

P. S.

If you are still having a problem where something must certainly work and it is not, it is very likely that you will succeed if you just pass it to the c code ++ like theres probably a problem with the QML support.

Tags: BlackBerry Developers

Similar Questions

  • Help to understand the basics of the integration of Javascript/QML

    Hey all!

    I am just development of BB for the first time, so please bear with me. I'm not sure that understand the interaction between JS and QML. I understand that you can write JS in QML, particularly in managers of signals, and I used chunks of it with success. Also, I show/read by the "Javascript in QML" and JS linked in the pages of Qt, which helped a bit.

    However, I am having a few problems incorporating it into my code.  Could you take a look at this and point me in the right direction? (I'm also new to JS itself, so maybe that my mistakes are with this instead?)

    onTriggered: {}

    When an item is selected, we push the recipe Page in the attribute of file chosenItem.

    var chosenItem = dataModel.data (row);

     

    Create the content page and place on top of drill down for it.

    contentPage var = pillDetailPageDefinition.createObject ();

     

    Set the properties of content to reflect the selected image.

    contentpage.contentImageURL = chosenItem.thumbnail

    contentpage.contentName = chosenItem.name + ', ' + chosenItem.mass

     

    * Errors begin to surface in this block *.

    contentpage.contentConsumption = {}

    Guide bar = "With"

    Mistakes of the top line: 'missing}, unknown symbol "guideline", missing colon "guideline", etc.

     

    Boolean multiInstruction = false;

    Top line errors: inconsistent input boolean expected RBRACE

                            

    If {(chosenItem.withFood)

    guideline += "food";

    multiInstruction = true;

    }

    If {(chosenItem.withWater)

    If (multiInstruction) guideline += 'and ';

    guideline += 'water '.

    }

    Return to the guideline;

    }

     


    Thanks in advance! I feel I'm missing something incredibly small/basic

    try calling it without braces.

    You can also create a function directly in QML, no need to export to a js file unless you want to use other components (that are not subcomponents) as well.

    to learn more about the construction of Qt/QML parent, I suggest to read this doc API:
    http://Qt-project.org/doc/Qt-4.8/objecttrees.html

    createObject (this) would create a new component with the parent defined on the object class, and if this is destroyed a new is also destroyed. This is useful when you create components dynamically as you don't have to delete them manually later.

  • Measurement Studio has a least-squares method to solve the multiplication of matrices?

    I'm looking for a least-squares method to solve the multiplication of a matrix of 99 x 99 to a 99 vector element.

    Is there a method similar to the "fminsearch' of Matlab function?

    This is the method I use now...

    NationalInstruments.Analysis.Math.LinearAlgebra.Multiply (InverseMatrix99x99, Vector_99)

    Thank you.

    To my knowledge there is not a feature that replicates Matlab function "fminsearch" in the analysis of Measurement Studio package nor is there a multiplication of matrix least-squares method. However, you could write a DLL and call it in your Measurement Studio project. LabVIEW has an implementation of "fminsearch" in its packaging MathScript. You can read the documentation on that here (http://zone.ni.com/reference/en-XX/help/371361D-01/lvtextmath/msfunc_fminsearch/).

    Kind regards

    Steven Zittrower

    Technical sales engineer

    National Instruments

    http://www.NI.com/support

  • Activation of Windows7 get error 0xc004c020 "the activation server reported that the Multiple Activation key has exceeded its limit."

    I installed Win7 Pro 64 - bit about 4 - 5 times with the same original key on the same computer, but now I have a problem; When I want to activate key, always error has occurred with this 0xC004C020 with description error Code: the activation server reported that the Multiple Activation key has exceeded its limit. How do I fix this problem?

    Hello

    Please find your resolution from this link: http://technet.microsoft.com/en-us/library/ff793399.aspx

    MAKs by design have a limited number of activations. Contact the Microsoft Activation call center.

    Hope that helps.

    Kind regards

    Joel

  • How AutoNumber developing table 4-digit, especially when the increment in the multiplication of 10

    Hi all

    I know it would be a simple solution, but being very new livecycle, I don't know how to do this.

    I have a table in my form, which develops according to the numbers entered into a separate digital field. Now, I even made AutoNumber itself, but the thing is that I wish it AutoNumber in 4 digits, which on the multiplication of 10.

    For example, 0010, 0020, 0030, 0040 and so on.

    Is someone can you please tell me how can I do this? Any help would be appreciated.

    Thanking you,

    Big Boss

    To add this script to the indexChange rows in table event.

    NumericField.rawValue = (this.index + 1) * 10;
    

    For the digital field uses the display num 9999 {}template.

    I hope this helps.

  • Generate a single XML file of the multiple JDBC result set

    Hello

    I need to create a single XML file of the multiple result set. The code below is to generate a XML signle leave a single result set, but suppose we have five different tables in the same database and the tables aren't relalted to the other.

    for example: select * from SAMPLE_PRODUCT
    Select * command
    Select * LOGISTICS... and many others.


    You can create multiple sets of results by top queries but how can write all values using a JDBC result set in a single xml file? Help, please.

    a signle file xml from one generator result

    import java.io.StringWriter;
    import java.sql.Connection;
    to import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;

    Import javax.xml.parsers.DocumentBuilder;
    Import javax.xml.parsers.DocumentBuilderFactory;
    Import javax.xml.transform.OutputKeys.
    Import javax.xml.transform.Transformer;
    Import javax.xml.transform.TransformerFactory;
    Import javax.xml.transform.dom.DOMSource;
    Import javax.xml.transform.stream.StreamResult;

    to import org.W3C.DOM.document;
    Import org.w3c.dom.Element;

    public class JDBCToXML {}

    Public Shared Sub main (string args []) throws Exception {}
    DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
    DocumentBuilder builder = factory.newDocumentBuilder ();
    Doc document = builder.newDocument ();
    Element results = doc.createElement ("Results");
    doc.appendChild (results);

    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager
    .getConnection("jdbc:odbc:RIS","USER","USER");

    ResultSet rs = con.createStatement () .executeQuery ("select * from SAMPLE_PRODUCT");

    ResultSetMetaData rsmd = rs.getMetaData ();
    int colCount = rsmd.getColumnCount ();

    While (RS. Next {}
    Element line = doc.createElement ("Row");
    results.appendChild (row);
    for (int i = 1; i < = colCount; i ++) {}
    String columnName = rsmd.getColumnName (i);
    Object value = rs.getObject (i);
    Element node = doc.createElement (columnName);
    node.appendChild (doc.createTextNode (value.toString (()));
    row.appendChild (node);
    }
    }
    DOMSource domSource = new DOMSource (doc);
    TransformerFactory tf = TransformerFactory.newInstance ();
    Transformer transformer = tf.newTransformer ();
    transformer.setOutputProperty (OutputKeys.OMIT_XML_DECLARATION, 'yes');
    transformer.setOutputProperty (OutputKeys.METHOD, "xml");
    transformer.setOutputProperty (OutputKeys.ENCODING, "ISO-8859-1");
    StringWriter sw = new StringWriter();
    StreamResult sr = new StreamResult (sw);
    transform. Transform (domSource, sr);

    System.out.println (SW. ToString());

    con. Close;
    RS. Close();
    }
    }

    Thank you
    Sumit

    Published by: user8687839 on April 4, 2012 23:04

    Published by: user8687839 on April 4, 2012 23:09

    As EJP says, you really want to get the data in a single request, if possible (and I don't see why that shouldn't be the case).
    In fact, you really want to get this query to return the data as close the format you need as you can.

    If you did this on Oracle, for example, I'd get Oracle to produce XML that you can then turn (assuming that you could not itself produce the XML you want directly).
    In your case, using some db (access?), and then just get the line structure such as the conversion to XML involves the least amount of faffing about.

    Rethink the SQL and the rest should be easy.

  • 'shift' key does not work in the multiple selection table

    I created a table by dragging default datacontrol vo, the multiple value RowSelection, override the SelectionListener a manageBean method as follows:

    {} public void tableMakeCurrent (SelectionEvent selectionEvent)
    RowKeySet rks = selectionEvent.getAddedSet ();
    System.out.println (RKS. GetSize());
    Iterator it = rks.iterator ();
    {while (IT.hasNext ())}
    System.out.println (IT. Next());
    }
    }

    The problem is when I use 'shift' button help me select several lines, it will only print the last line, which I selected.

    Is there a way to fix this? Thank you...

    jdeveloper11.1.1.3

    for rowSelection multiple = to work with 'shift' you should not have the selectionListener or selectedrowkeys for your af:table
    http://www.adftips.com/2010/11/ADF-UI-implementing-multi-select-table.html
    delete selectedrowkeys and ownership selectionListener in the table and you will get select using the 'shift '.

  • Change the multiple layers at the same time

    Hi all
    Is it possible to change the position of the multiple layers at the same time? that is to say: I've got a slideshow made with several layers (probably about 60) while back and now I need to re use it in a different size (smaller). When I just resize the document, my slide is no longer in the center of it and is bigger. I would like to: 1. change its position within the document. 2 reduce entire layer together. If 2 is not possible, fine, but to me, there may be a way to change its position. Thank you much for the help!

    If you look at the area where Flash displays your frames per second is a small button (it looks like 2 boxes blu - ish overlapping). It is the button "edit multiple layers. Once you press this, you will see a marker on your time line asking you to select the images to change. Stretch this segment to cover all the images you want to include in your editing - lock all layers you want to include in your installation. Then, you can press Ctrl + a to 'select all' - this will only select executives in "onion" and unlocked frames - from there, any changes will not affect what is selected. You have to play with how it works because it can be a little difficult to understand (when it comes to points of alignment and balance, etc.). I would like to make a copy of your flash document to test this point until understand you before you start your original edition.

  • How can I help the Uzbek language translation of Mozilla FireFox (Web browser)?

    How can I help the Uzbek language translation of Mozilla FireFox (Web browser)?

    Hi Erkin Farxodovich,
    I thank you for volunteering, to do this please contact the l10n team. And also the location on this page Quick Start Guide: https://wiki.mozilla.org/L10n:Starting_a_localization

    That should have all the information. Please reach out to the group mail as well and they can help with questions along the way.

    I hope this helps.

  • Firefox 4 warn me / restore when I close the multiple tabs.

    Even if in the Options, I checked "Warn me when closing multiple tabs" Firefox 4 don't warn me or restore the tabs when I close the multiple tabs. I use Windows Xp SP2.

    If you want Firefox to display the message to save the session, it can be turned on again by changing some preferences.

    1. Type of topic: config in the address bar and press on enter
    2. Accept the warning message that appears, you will be taken to a list of preferences
    3. Find browser.tabs.warnOnClosepreference, if its value is set to false, double-click on it to change its value to true
    4. Repeat this for 3 preferences browser.warnOnQuit, the browser.warnOnRestart and the browser.showQuitWarning
  • read the multiple analog inputs at the same time

    Hi all

    I use USB-6001 and want to develop an application to multiple tasks in C++. I try to read several analog inputs at the same time, but got some errors. To put it simply, I copy one of the sample code to read in analog data in a channel, and then turn it into function. Then I call this function to thread with the names of different poles (for example Dev1/ai0, Dev1/ai1) and I come across this error:

    "The specified source is reserved. The operation can not be specified such complete"code of State-50103

    I have search the forums, this may be because I use the hardware timing in this function, and this material timing cannot be used simultaneously by multiple tasks. I may have to put all the lines, I want to read in a single task (such as Dev1 / ai0:1). This way I can read two lines at the same time. However, when I try this, I encounter another error:

    Status code "buffer is too small to contain the data read" - 200299

    So here is my question, what should I do if I don't want to read the multiple analog inputs at the same time? Is the thing that hard time cannot be used by several true task? If I have to read several lines to a single task, how to set the settings?


  • HI PLZ I WANT TO HELP THE UPGRADE TO SSD ODNT WILL I KNOW IF MY BOARD OF DIRECTORS AND THE CPU SUPPORTS

    HI PLZ I WANT TO HELP THE UPGRADE TO SSD ODNT WILL I KNOW IF MY BOARD OF DIRECTORS AND THE CPU SUPPORTS

    MODEL

    Compaq Presario CQ42-372TU computer laptop

    http://h20566.www2.HP.com/portal/site/hpsc/template.page/public/KB/docDisplay/?javax.portlet.begCac=...

    PLZ ANY BODY HELP ME

    You can upgrade to an SSD.

    The simplest method is to use an SSD as the Corsair Force 3 and don't forget that you buy the kit of migration.

    The migration kit comes with cloning software and a usb to SATA power cable that connects again SSD.

    It is recommended that you purchase and SSD that is approximately 256 GB in quality if you can find one that is affordable.

    SSD with migration in a kit options search I did.

  • I received an error code 800b0100 update. I just installed windows 7 student disc and my computer guard stop. I me trying to get the updates that might help the closing of the bottom.

    I received an error code 800b0100 update. I just installed windows 7 student disc and my computer guard stop. I me trying to get the updates that might help the closing of the bottom.

    Hi Happyrockgeek,

    Welcome to Microsoft Windows 7 answers Forum!

    This problem occurs if the Windows security .dll files are incorrectly registered.

    To resolve this problem, you can perform the two methods of troubleshooting, check if the problem is resolved.
    Method 1:
    Run (Checksur.exe) system update readiness tool.
    To do this, follow these steps:
    1. download and run the system update readiness tool. This tool runs an ad hoc analysis of inconsistencies that might prevent future maintenance operations. For more information about how to download and run the Checksur.exe tool, click on the number below to view the article in the Microsoft Knowledge Base:
    http://support.Microsoft.com/default.aspx/KB/947821
    2. try to install the updates again.
     
    Methods 2.
    Reset the Windows Update components.
    1. to reset the Windows Update components automatically, click the fix button in the link below.
    http://support.Microsoft.com/kb/971058 
    2. click run in the file download dialog box and follow the steps described in the fix it Wizard.

    I also suggest you to install the latest version of Windows Installer 4.5.
    Follow the link below to download:
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en
    and you can also try to install after you turn off the firewall.
     
     
    It will be useful.
     
    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum.

  • Helps the KB981852 update

    helps the KB981852 update.  the following message was published in regedit: %Windir%\KB981852.log
     
    [KB981852.log]
    8.767: ================================================================================
    8.767: 2010-11-13 22:43:22.430 (local)
    8.767: c:\690c14c58cb8e8f058d1\update\update.exe (version 6.3.13.0)
    8.783: DoInstallation: GetProcAddress (InitializeCustomizationDLL) returned: 0x7f
    8.783: hotfix started with following command line:
    8,845: CheckSystem: main Version mismatch: STATUS_NT_VERSION_MISMATCH
    8,845: DoInstallation: CheckSystem failed: 0xf021
    8,845: the version of Windows you have installed does not match the update you are trying to install.
    14.602: message displayed to the user: the version of Windows you have installed does not match the update you are trying to install.
    14.602: user input: OK
    14.602: Update.exe extended error code = 0xf021
    14.602: Update.exe return code was masked to 0 x 643 for MSI custom action compliance.

    I am running windows vista with Service Pack 2 installed.

    If you need more info please let me know

    The repeated failures to install KB981852 suggest very strongly that you see the effects of a rootkit infection W32/Alureon-Variant!

    Following the instructions on this site should help you:

    http://www.bleepingcomputer.com/virus-removal/remove-TDSS-tdl3-Alureon-rootkit-using-TDSSKiller>

    ~ or ~.

    Visit the Microsoft Solution Center and antivirus security for resources and tools to keep your PC safe and healthy.  If you have problems with the installation of the update itself, visit the Microsoft Update Support for resources and tools to keep your PC updated with the latest updates.

    Buying to meet problems installing Microsoft security updates also can visit the following page for assistance:https://consumersecuritysupport.microsoft.com/>

    For more information about how to contact your local Microsoft subsidiary for security update support issues, visit the International Support Web site:http://support.microsoft.com/common/international.aspx>

    For enterprise customers, support for security updates is available through your usual support contacts.

  • How to help the user focus

    How to help the user focus

    Magnifier enlarges part of the screen. This is especially useful for viewing objects that are difficult to see. It is also useful for people who are generally difficult to see the screen.

Maybe you are looking for