Ejemplo n.º 1
0
void WizardWelcome::serialInvalidHandle()
{
    qDebug() << Q_FUNC_INFO;
    ConfirmDialog* dialog = new ConfirmDialog(this,tr("There is an error with the Serial Number ") + "(" + DeviceInfo::getInstance()->getSerialNumber() + ")" + tr(". Please contact with support."));
    QBookApp::instance()->getStatusBar()->setSpinner(false);
    Screen::getInstance()->setMode(Screen::MODE_SAFE,true,FLAG_IGNORE_QUEUE,Q_FUNC_INFO);
    dialog->exec();
    delete dialog;
    QBookApp::instance()->goToHome();
}
Ejemplo n.º 2
0
void WizardWelcome::headersProblem()
{
    qDebug() << Q_FUNC_INFO;

    ConfirmDialog* dialog = new ConfirmDialog(this,tr("There is a problem in wizard. Please contact with support."));
    QBookApp::instance()->getStatusBar()->setSpinner(false);
    Screen::getInstance()->setMode(Screen::MODE_SAFE,true,FLAG_IGNORE_QUEUE,Q_FUNC_INFO);
    dialog->exec();
    delete dialog;

    ConnectionManager::getInstance()->removeAll();
    goToWifi();
}
Ejemplo n.º 3
0
void WizardWelcome::connectivityProblem()
{
    qDebug() << Q_FUNC_INFO;

    ConfirmDialog* dialog = new ConfirmDialog(this,tr("Connection problem. Please, select another WiFi."));
    QBookApp::instance()->getStatusBar()->setSpinner(false);
    Screen::getInstance()->setMode(Screen::MODE_SAFE,true,FLAG_IGNORE_QUEUE,Q_FUNC_INFO);
    dialog->exec();
    delete dialog;

    ConnectionManager::getInstance()->removeAll();
    goToWifi();
}
Ejemplo n.º 4
0
void WizardWelcome::showRegisterFailed()
{
    qDebug() << Q_FUNC_INFO;

    ConfirmDialog* dialog = new ConfirmDialog(this,tr("Credit Card Register failed."));
    Screen::getInstance()->setMode(Screen::MODE_SAFE,true,Q_FUNC_INFO);
    dialog->exec();
    delete dialog;

    QBookApp::instance()->popForm(QBookApp::instance()->browserWizard());

    if(!m_elfFinishWizard)
    {
        m_elfFinishWizard = new WizardFinish(this);
        connect(m_elfFinishWizard, SIGNAL(closeWizard()), this, SLOT(goToCloseWizard()));
    }
    showElement(m_elfFinishWizard);
}
void SettingsDictionariesMenu::activateExtraDicts()
{
    qDebug() << Q_FUNC_INFO;
    bqDeviceServices* services = QBookApp::instance()->getDeviceServices();
    services->processSyncCanceled();
    b_downloadCanceled = false;

    if(!downloadDialog)
    {
        downloadDialog = new ProgressDialog(this,tr("Downloading dictionary, please wait for a few minutes."));
        downloadDialog->setHideBtn(false);
        downloadDialog->setTextValue(false);
        downloadDialog->setModal(true);
        connect(downloadDialog, SIGNAL(cancel()),               this,          SLOT(downloadCanceled()), Qt::UniqueConnection);
        connect(services,       SIGNAL(downloadProgress(int)), downloadDialog, SLOT(setProgressBar(int)), Qt::UniqueConnection);
    }

    downloadDialog->setProgressBar(0);
    bool installingPending = false;
    newDictionaryNames.clear();

    QList<DictionaryParams>::const_iterator it = pendingDictsList.constBegin();
    QList<DictionaryParams>::const_iterator itEnd = pendingDictsList.constEnd();
    while(it != itEnd)
    {
        Screen::getInstance()->setMode(Screen::MODE_SAFE,true,FLAG_FULLSCREEN_UPDATE,Q_FUNC_INFO);
        downloadDialog->show();

        if(!(*it).activationState)
        {
            int dixioSize = (*it).dixFileSize * 1024 * 1024;
            int downloadComplementSize = (*it).compFileSize * 1024 * 1024;

            QString downloadPath = Storage::getInstance()->getPrivatePartition()->getMountPoint() + QDir::separator() + "dictionaries" + QDir::separator();
            newDictionaryNames.append(downloadPath + QString((*it).downloadFileName));
            bool downloaded = services->downloadDictionary((*it).downloadUrl, downloadPath + QString((*it).downloadFileName),dixioSize);

            if(downloaded)
            {
                installingPending = true;
                if((*it).downloadUrlComp.size())
                {
                    qDebug() << Q_FUNC_INFO << "downloadUrlComp: " << (*it).downloadUrlComp;
                    downloadDialog->setText(tr("Downloading complements, please wait for a few minutes."));
                    Screen::getInstance()->refreshScreen();
                    newDictionaryNames.append(downloadPath + QString((*it).downloadFileNameComp));
                    if(!services->downloadDictionary((*it).downloadUrlComp, downloadPath + QString((*it).downloadFileNameComp), downloadComplementSize))
                    {
                        downloaded = false;
                        installingPending = false;
                    }
                }
            }

            if(!downloaded && !b_downloadCanceled)
            {
                delete downloadDialog;
                downloadDialog = NULL;
                deleteDictionaryFiles(newDictionaryNames);
                ConfirmDialog* confirmDialog = new ConfirmDialog(this,tr("Download failed. Please try again."));
                Screen::getInstance()->resetQueue();
                Screen::getInstance()->setMode(Screen::MODE_SAFE,true,FLAG_FULLSCREEN_UPDATE|FLAG_IGNORE_QUEUE,Q_FUNC_INFO);
                confirmDialog->exec();
                delete confirmDialog;
                Screen::getInstance()->refreshScreen();
                return;
            }
        }
        it++;
    }

    if(installingPending) {
        downloadDialog->setText(tr("Installing..."));
        downloadDialog->hideCancelButton();
        Screen::getInstance()->refreshScreen();
    } else {
        if(downloadDialog) {
            delete downloadDialog;
            downloadDialog = NULL;
        }
        return;
    }

    QString dixioKey = Dictionary::instance()->getDixioKey();
    qDebug() << Q_FUNC_INFO << "dixioKey: " << dixioKey;
    QString callUrl;
    QString postParameters;
    QString activationResponse;
    bool installingError = false;

    // Get activation data
    if(Dictionary::instance()->getActivation(dixioKey, callUrl, postParameters))
    {
        QString activationRequest = postParameters.split("activationRequest=")[1];
        if(services->callActivationDictionary(activationResponse, activationRequest))
        {
            qDebug() << Q_FUNC_INFO << "activationResponse: " << activationResponse;
            QString activation = QString::fromStdString(Dictionary::instance()->setActivation(dixioKey, activationResponse));
            qDebug() << Q_FUNC_INFO << "activation: " << activation;
            installingError = activation.contains("error");
        } else
            installingError = true;
    } else
        installingError = true;

    delete downloadDialog;
    downloadDialog = NULL;
    ConfirmDialog* confirmDialog;
    if(!installingError)
    {
        confirmDialog = new ConfirmDialog(this,tr("Installing success. Now the system will be turned off."));
        Screen::getInstance()->setMode(Screen::MODE_SAFE,true,FLAG_FULLSCREEN_UPDATE,Q_FUNC_INFO);
        confirmDialog->exec();
        delete confirmDialog;
        QBook::settings().setValue("setting/dictionaryAvailable", false);
        QBook::settings().sync();
        Screen::getInstance()->refreshScreen(Screen::MODE_SAFE,true);
        PowerManager::powerOffDevice(false);
    } else
    {
        deleteDictionaryFiles(newDictionaryNames);
        confirmDialog = new ConfirmDialog(this,tr("Install failed. Please try again."));
        Screen::getInstance()->setMode(Screen::MODE_SAFE,true,FLAG_FULLSCREEN_UPDATE,Q_FUNC_INFO);
        confirmDialog->exec();
        delete confirmDialog;
        Screen::getInstance()->refreshScreen();
    }
}