CustomPickerRecipe::CustomPickerRecipe(Container *parent) :
        CustomControl(parent)
{
    bool connectResult;
    Q_UNUSED(connectResult);

    // Get the UIConfig object in order to use resolution independent sizes.
    UIConfig *ui = this->ui();
    int mediumPadding = ui->du(2);
    int largePadding = ui->du(3);

    // The recipe Container.
    Container *recipeContainer = Container::create().top(largePadding)
            .left(mediumPadding).right(mediumPadding);

    // A title label that will be updated depending on the picker selection.
    mDescription = Label::create("label");

    // A label to show the price
    mBill = Label::create("Bill:");

    // The custom picker its initiated in its expanded state.
    mPicker = Picker::create().title("Custom Pizza Picker").expanded(true);

    // An XMLModel is used for populating the different picker items, this
    // kind of data model is suitable for small lists with static content.
    XmlDataModel *pickerModel = new XmlDataModel(this);
    pickerModel->setSource(QUrl("models/custompickermodel.xml"));
    mPicker->setDataModel(pickerModel);

    // The items in the picker columns are created and handled by an PickerItemProvider,
    // see customprovider.h/cpp for details.
    CustomItemProvider *itemProvider = new CustomItemProvider(this, mPicker->dataModel());
    mPicker->setPickerItemProvider(itemProvider);

    // Finally the picker signal is connected to a slot function, so the title label
    // text can be set according to the selection in the picker.
    connectResult = connect(mPicker, SIGNAL(selectedValueChanged(const QVariant )),
                                     SLOT(onValueChanged(const QVariant )));
    Q_ASSERT(connectResult);

    // Add the label and the picker to the recipe Container.
    recipeContainer->add(mDescription);
    recipeContainer->add(mBill);
    recipeContainer->add(mPicker);

    setRoot(recipeContainer);
}
// Updates the ListView control
void ApplicationUI::onUpdateListView ()
{
   if (this->m_pFileObj->open(QIODevice::ReadWrite))
   {
      // Write to the file using the pNetReply
      this->m_pFileObj->write(this->m_pNetReply->readAll());
      this->m_pFileObj->flush();
      this->m_pFileObj->close();

      // Create a temporary data model using the contents
      // of a local XML file
      XmlDataModel* pDataModel = new XmlDataModel();
      QUrl fileUrl = "file://" + QDir::homePath() + "/model.xml";
      pDataModel->setSource(fileUrl);

      this->m_pListView->setDataModel(pDataModel);
   }
   else
   {
      emit this->fileOpenFailed();
   }
}