Use a second page

Hello

I think I'm doing everything wrong in my application,

Brief:

I have a Home Page, a Login Page and a Page of registry, so first of all, I created the Home Page and the Login Page:

Home.cpp

#include "Login.hpp"

....

PortoVias::PortoVias(bb::cascades::Application *app)
: QObject(app)
{
    QSettings settings("CompanyX", "AppNameX");

    if (settings.contains("userName") && settings.contains("password")) {

    }
    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole application lifetime
    QmlDocument *qml = QmlDocument::create("asset:///qml/homePage.qml");
    Login *loginService = new Login();
    qml->setContextProperty("loginService", loginService);
    // create root object for the UI
    AbstractPane *root = qml->createRootObject();
    // set created root object as a scene
    app->setScene(root);

}

and the Login.cpp

#include "Login.hpp"

..
..

Login::Login() {
    mNetworkAccessManager = new QNetworkAccessManager(this);

    bool result = connect(mNetworkAccessManager,
            SIGNAL(finished(QNetworkReply*)),
            this, SLOT(requestFinished(QNetworkReply*)));
    Q_ASSERT(result);
    Q_UNUSED(result);
}

QString Login::userName() {
    return m_userName;
}

void Login::setUserName(QString userName) {
    m_userName = userName;
    emit userNameChanged(m_userName);
}

QString Login::password() {
    return m_password;
}

void Login::setPassword(QString password) {
    m_password = password;
    emit passwordChanged(m_password);
}

void Login::initiateRequest()
{
    // Start the activity indicator
//  mActivityIndicator->start();

    // Create and send the network request
    QNetworkRequest request = QNetworkRequest();
    QUrl url = QUrl(loginUrl+m_userName+"&senha="+m_password);
    request.setUrl(url);
    mNetworkAccessManager->get(request);
}

void Login::requestFinished(QNetworkReply* reply)
{
    Label *errorLabel = root->findChild("objectName");
    // Check the network reply for errors
    if (reply->error() == QNetworkReply::NoError) {
        GroupDataModel *model = new GroupDataModel(QStringList());
        JsonDataAccess jda;

        if (jda.hasError()) {
            DataAccessError theError = jda.error();
            if (theError.errorType() == DataAccessErrorType::SourceNotFound)
                errorLabel->setText("Source not found: " + theError.errorMessage());
            else if (theError.errorType() == DataAccessErrorType::ConnectionFailure)
                errorLabel->setText("Connection failure: " + theError.errorMessage());
            else if (theError.errorType() == DataAccessErrorType::OperationFailure)
                errorLabel->setText("Operation failure: " + theError.errorMessage());
        } else {
            errorLabel->setText("No error.");
        }

        QString result =  QString::fromUtf8(reply->readAll());
        QVariantMap object = jda.loadFromBuffer(result).toMap();

        QString autorizacao = object["object"].toMap()["auth"].toString().toStdString().c_str();
        fprintf(stdout,"%s\n", autorizacao.toStdString().c_str());

        model->insert(object);

        // create a ListView control and add the model to the list
        ListView *listView = new ListView();
        listView->setDataModel(model);

    }
    else
    {
        fprintf(stdout,"%s\n", "Problem with the Network");
    }
}

But here, I realized that I don't have the root in the Login.cpp, I started to think that I do everything wrong... no idea on how to get the root of the Home.cpp to Login.cpp?

I use the qml to open Home.qml to Login.qml

Button {
                        text: StringDef.ACCESS_MY_ACCOUNT
                        horizontalAlignment: HorizontalAlignment.Center
                        preferredWidth: 600
                        onClicked: {
                            var page = loginPage.createObject();
                            navigationPane.push(page);
                        }

                        attachedObjects: ComponentDefinition {
                            id: loginPage;
                            source: "asset:///qml/login.qml"
                        }
                    }

My way: use the navigation pane to push

App::App() {
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("myClass", this);
    AbstractPane *root = qml->createRootObject();
    Application::instance()->setScene(root);
}

void App::pushScreen() {
    Second *sec = new Second((NavigationPane*)Application::instance()->scene(), this);
}
Second::Second(NavigationPane* navigationPane, QObject *parent) : QObject(parent) {
    QmlDocument *qml = QmlDocument::create("asset:///second.qml").parent(this);
    Page *root = qml->createRootObject();
    navigationPane->push(root);
}

Tags: BlackBerry Developers

Similar Questions

  • When you use quicklaunch to open a web page, if I already have an open page, how can I open a second page or pages using an icon from quick launch without closure or replacing the one I already opened?

    When you use quicklaunch to open a web page, if I already have an open page, how can I open a second page or pages using an icon from quick launch without closure or replacing the one I already opened?

    Hi Haubhaus,

    I know one thing to get your links to always open in a new window:
    1. Right-click on your desktop, select new, then shortcut
    2. Type "" C:\Program may Explorer\IEXPLORE. "." EXE" and click Next
    3. Name the shortcut (for example: Microsoft Home) and click Finish
    4. Right-click on the new shortcut and select Properties
    5. In the target box, arrow over until the end of the path, add a space and add -new (WEBSITEPATH). When your finished, your path should look like this:
      "" C:\Program may Explorer\IEXPLORE. "." "EXE" - new www.microsoft.com
    6. Click OK and try it!
    Let me know if it works or if I can be of further assistance!

    Cody C
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • LaserJet 1102w: force print the second page, Laserjet 1102w

    Hello

    New laptop.  I can print fine from the front.  When I try to print double-sided printer, as normal stop, after that the first page is complete, but used 'popup' support to continue does not appear.  OK, I'm working on this one.  But is it possible that I can press something on the printer to say "go ahead, print the second page."?

    Thank you!

    Evan

    Hello @evanmjones,

    It is a great place to get help! I read your post and see that you do not get the option "Continue" to print the second when the double-sided page. I want to help you solve this problem.

    You can continue the second page by opening and closing the printer cover. (this model does not have a resume button)

    Make sure that manual duplex printing option is selected from the printer driver:

    1. Click on the Windows icon (), and then click devices and printers.

    2. Right click on the HP product and then click on printerProperties.

    3. Click the device settings tab.

    4. The manual Duplex allows to "Enabled" and click OK to save the change. (click on the + to expand the list)

    Ensure that the bidirectional Support is enabled.

    Go to start, devices and printers, right click on the printer, the printer properties, click the Ports tab, put a check mark next to allow bidirectional support.

    You may have to restart the computer.

    Try to print again.

    If you're still having problems, try printing from another application to see if you have the same results, it could be a setting in the application of double-sided printing.

    You need to maybe uninstall and reinstall the printer if the problem persists.

    You can click on the "accept as a Solution" If the problem is resolved and the 'Thumbs Up' for my effort. Please hold me. Good luck!

  • Double-sided print second page upside down HP6700

    When I print 2 Facer, the second page is upside down. I looked for solutions on this forum and on the net, but nothing helped. I have installed new drivers, checked all the available boxes. The one I need ('turn page' or something like that) is not found.

    I have a new HP6700, to replace an old HP6700 which made duplex very well, but became old. Why is it suddenly so hard to make something of my old printer without problems?

    I use a MacBook Pro with OS X 10.9 laptop.

    I hope someone can help me.

    Hello Cheetah12,

    Thanks for your reply. In the meantime I discovered that the most important step is NOT to install the printer via AirPrint, but using HP6700. Only, then you have the possibility to click on the duplex option and install the printer with the 4.1.2 pilot.

    The solution mentioned by Roger2499 in the following thread has helped me tremendously, after a day of frustration!

    http://h30434.www3.HP.com/T5/Mac-printing-and-scanning/double-sided-printing-with-6700-e/TD-p/3476773

    Thanks for trying to help!

  • OfficejetPro 8600 - unexpected printing on every second page of output image

    HP Officejet Pro 8600 N911g product number: CM750A

    Printer has been in service for about 2 months, use of light (says page counter: 332).  Suddenly, today, every second page output (printed or copied) prints with a superimposed image mask which is actually a page to an external Web site.

    How could an image stored (and ongoing) like this in the device?

    Thanks in advance for any help.

    Sunshyn2005,

    I really enjoy taking the time to present a detailed approach to investigate this matter.  It is reassuring to know that it's really mysterious.

    However, in the meantime, I had taken drastic measures: I have uninstalled and reinstalled the software for printing on all connected computers and the problem is not (so far) reappeared.

    Thanks a lot for sharing your knowledge.

  • How to customize the pagination so that the first page (which is actually a cover sheet) is ignored and the second page is numbered on page 1?

    I'm working on the creation of a document that will be printed and bound as a book with comb-binding.

    The cover of the book is the first page of my PDF document. Because this first page is the cover, I don't want that it counted as a page for purposes of pagination. Basically, I want to configure so that paging starts with '1', but it starts from the second page of my PDF document.

    I'm using Acrobat 8 Pro. I've been fiddling with the menu of the header/footer page, but so far without success. Any help is greatly appreciated, thank you!

    Well, after having thought about it some, more I realized that there is a simple way around this!

    1 remove the cover page of my document

    2. Add a page numbering

    3 Add again the front page and do not update the footer

    I was driving myself crazy trying to find a way to do it!

  • Two spawning models to create the second page, possible?

    I don't know if this is possible, but based on a value on the first page, I want to be able to create a second page using two models.

    My script below creates just two additional pages. Any ideas please?

    var t = this.templates;

    var j = this.pageNum;

    This is my 3 models, depending on the value of the first page, second pick 2 of these models

    var T = t [0];

    var S = t [1];

    var R = t [2];

    If (this.getField ("P" + j + ".")) Background.Dropdown4 ") .value == 'Other') {}

    var XO = T.spawn (this.numPages, true, true);

    for (var i = 0; i < 0; i ++) T.spawn (this.numPages, true, true, XO);

    } else if (this.getField ("P" + j + ".")) Background.Dropdown4 ") .value == 'Colour') {}

    var XO = T.spawn (this.numPages, true, true);

    var XY = S.spawn (this.numPages, true, true);

    for (var i = 0; i < 0; i ++) T.spawn (this.numPages, true, true, XO);

    for (var i = 0; i < 0; i ++) S.spawn (this.numPages, true, true, XY);

    }

    this.pageNum ++;

    App.Alert ("a new page has been added")

    Your handsome George! That worked perfectly.

    Thank you very much

  • expnds of expandable text field, but does not go to the second page, why?

    Hello

    After working hours and read blogs, I was able to create a form with several fields stretch.

    the problem is that they aren't going to the second page. they will be cut off and sometimes everything is moving to a second page and I have a blank page first.

    Help, please.

    I need to talk to happen when I use tables in my forms. simple text will be more flow to the next page very well.

    The problem when there are tables

    Send the form and a description of the problem to [email protected] and I'll have a look when I get the chance.

    Paul

  • Slightly different format if there is a second page

    I have a cfm that uses cfdocument = 'pdf' format to create a pdf file with data in our sql DB. If data gets to be more that can appear on a page, I would slightly adjust the layout and include the words - continued from previous page. Any ideas how to do this without printing a second page for those who are on a page and do not require a second page?

    Found a great solution little by http://groups.google.com/group/CF-Talk/browse_thread/thread/d5ac73c88c9d3230/0ffa0614fb727 f2f?lnk=st&q=%23cfdocument.currentpagenumber%23&rnum=12&hl=en#0ffa0614fb727f2f

    Here is the code of the position:

    What it does is by default class paragraph SeeNextPage do NOT display,
    However, when the div inbetween is instance1 (such that it is created by the)
    CurrentPageNumber), he appears on the first page.

    To do this, the style tags MUST be in the footer element.

    I've not tested this precisely, but I learned things like that for
    work.

  • base-image menu to access a section in a second page

    Can you help me build it.

    I just created a menu image in flash in the main html page. I have also a second page contains details about each option in the menu of the home page. I try whenever I click any option in the menu on the home page; This should take me to the specific section on the second page describing this option

    Thank you very much

    No, use the images in your main flash script. fix a stop() on the first image. place on stage all you want to see when your flash opens.

    If you want something else seen after a key, put it on a different image (for example a marked frame option1). You can then attach to the frame that contains your button:

  • How to factory reset an imac using the second screen

    How to factory reset or restore my system using a second screen


  • Using the second ethernet port to connect to the printer?

    Hi I have a Mac Pro 2.1 old school and I'm wondering if I can connect to the network with an ethernet port and connect the latter to a printer?

    If so, how?

    Yosemite running.

    Thank you

    Physically, you use a port and a cable to connect to your network and use the second port and a second cable to connect directly to the printer. The printer must obviously have an interface Ethernet himself.

    However, you need to configure the second port on the Mac and the Ethernet port on the printer for each manually configured the TCP/IP addresses and these should be in a range of different network to your main network.

    If you the main network is something like 192.168.1.1 then your printer and the port on the Mac connection to this need to be in another network, such as 192.168.11.1.

    In theory, if the printer supports Hello aka. mDNS, then maybe you can get away with not having to configure TCP/IP addresses for the connection.

    The main reasons to use a second separate connection as this would be the performance or security, and frankly I don't think that's really relevant here. This would mean that no other computers on your network will be able to access the printer.

  • Is possible to use the second HDD in PPM81E Portege M800-105

    Hello!

    Does anyone know, if it is possible to extend a Portege M800 - 105 model No. PPM81E with a second HDD?
    Is there a MediaBay for the DVD player to install a second hard drive?

    My goal is to use a Solid State Disk (64GByte) as the first disc (System only) and store all user data on the second drive.

    Best regards
    Sven

    Hello

    To my knowledge it is not possible to use a second HDD Portege M800.

    The laptop supports eSATA connection so you can connect an external HARD drive.

    Welcome them

  • Satellite Pro P300-26U - can I use a second HDD?

    Satellite P300 obligations food raid0 and double HARD drive. All models? Manual of 26U don't say a word on the subject. Model as P300-1BP has double HARD drive.
    Can someone help me? I want to buy a P300-26U in Italy.

    Thank you.
    Guido

    Hi mate,

    Who said that the Satellite Pro P300 takes supported RAID? AFAIK P300 series don't have RAID controller and in the specifications detailed on the Web from Toshiba site I can't find anything about this

    Satellite P300 it of only possible to use a second HDD if it has a second HARD drive connector. You can check it if you remove the second HARD drive. If you can see a second HARD drive connector, you can use a second HDD.

  • When I open a new tab, the back button does not work on the second page, I discover - never the second page, regardless of the site.

    When I opened a new tab - or when I first open a browser - as soon as I go to a second page, I can't go back to the first. Thus, for example, I opened a new tab. I go to a news site. I click on a title. I can not then go back to the first page of the new site. If I go back to the first page manually (by typing the url, or by opening a bookmark) and then click on the same heading, I'll be able to go back.

    The inability to return only ever happens on the second page opens in a new tab or window. At any time, I can go back as normal - but the first page I was on that tab / in this window is erased from history.

    This isn't something that's happened only with FF4, either. I first noticed a couple of weeks, but I upgraded shortly after, assuming it was a bug that would set the new browser. But it's always like that. He still refuses to back the second page of the first.

    This problem may be caused by an extension (McAfee SiteAdvisor) that is not working properly.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the Add-ons is the cause of the problem (switch to the DEFAULT theme: Tools > Modules > appearance/themes).

    • Makes no changes on the start safe mode window.

    See:

Maybe you are looking for

  • Why backup says "access denied"? It has not worked in a month!

    Last backup that worked was May 12. Now, it says "access denied."   Why? How should I do? I had no backup since May 12. I backup on a 300 GB hard drive, which I just emptied.

  • R61 stops when the VGA cable is inserted

    Hello I have not hooked my laptop to a projector for more than a year and now when I insert the cable into the VGA slot that the laptop stops! And even if it is still connected to power, ALL lights on the computer off. I have to remove the battery an

  • Windows Diagnostics policy service does not

    Windows Diagnostics policy service does not Original title: Network wireless adapter NIC Ethernet network device

  • Display of blackBerry Smartphones only BES - no available BIS?

    I just bought a storm (1 BB never) of SFR (vodaphone) France. I have trouble to configure an e-mail account. There is no BIS showing. I visited the bb europe site to create a new account, but it says that my storm has not been saved? When I look at t

  • "Can't live scrolling" in grid mode

    I used to be able to scroll in the display of the grid, and as I slipped the scroll bar, the thumbs would immediately move upwards or downwards. Now when I scroll, nothing happens until I make the scroll bar will move and stop. This makes it harder t