Exemplo n.º 1
0
void MTPageAcct_Nym::initializePage() //virtual
{
    std::string str_name;
    QString     qstr_id;
    // -------------------------------------------
    QString qstr_default_id = Moneychanger::It()->get_default_nym_id();
    // -------------------------------------------
    QString qstr_current_id = field("NymID").toString();
    // -------------------------------------------
    qstr_id = qstr_current_id.isEmpty() ? qstr_default_id : qstr_current_id;
    // -------------------------------------------
    if (qstr_id.isEmpty() && (OTAPI_Wrap::It()->GetNymCount() > 0))
        qstr_id = QString::fromStdString(OTAPI_Wrap::It()->GetNym_ID(0));
    // -------------------------------------------
    if (!qstr_id.isEmpty())
        str_name = OTAPI_Wrap::It()->GetNym_Name(qstr_id.toStdString());
    // -------------------------------------------
    if (str_name.empty() || qstr_id.isEmpty())
        SetFieldsBlank();
    else
    {
        QString qstrName = QString::fromStdString(str_name);
        // ---------------------------
        setField("NymID",   qstr_id);
        setField("NymName", qstrName);
        // ---------------------------
        ui->lineEditID->home(false);
        // ---------------------------
        if (qstr_default_id.isEmpty())
            emit SetDefaultNym(qstr_id, qstrName);
    }
}
Exemplo n.º 2
0
void MTPageAcct_Asset::on_pushButtonManage_clicked()
{
    MTDetailEdit * pWindow = new MTDetailEdit(this);

    pWindow->setAttribute(Qt::WA_DeleteOnClose);
    // -------------------------------------
    mapIDName & the_map = pWindow->m_map;
    // -------------------------------------
    the_map.clear();
    // -------------------------------------
    QString qstrPreSelected   = field("AssetID").toString();
    bool    bFoundPreselected = false;
    // -------------------------------------
    int32_t the_count = OTAPI_Wrap::GetAssetTypeCount();
    bool    bStartingWithNone = (the_count < 1);

    for (int32_t ii = 0; ii < the_count; ii++)
    {
        QString OT_id   = QString::fromStdString(OTAPI_Wrap::GetAssetType_ID(ii));
        QString OT_name = QString::fromStdString(OTAPI_Wrap::GetAssetType_Name(OT_id.toStdString()));

        the_map.insert(OT_id, OT_name);

        if (!qstrPreSelected.isEmpty() && (qstrPreSelected == OT_id))
            bFoundPreselected = true;
    } // for
    // -------------------------------------
    pWindow->setWindowTitle(tr("Manage Asset Types"));
    // -------------------------------------
    if (bFoundPreselected)
        pWindow->SetPreSelected(qstrPreSelected);
    // -------------------------------------
    pWindow->dialog(MTDetailEdit::DetailEditTypeAsset, true);
    // -------------------------------------
    if (bStartingWithNone && (OTAPI_Wrap::GetAssetTypeCount() > 0))
    {
        std::string str_id = OTAPI_Wrap::GetAssetType_ID(0);

        if (!str_id.empty())
        {
            std::string str_name = OTAPI_Wrap::GetAssetType_Name(str_id);

            if (str_name.empty())
                str_name = str_id;
            // --------------------------------
            setField("AssetID",   QString::fromStdString(str_id));
            setField("AssetName", QString::fromStdString(str_name));
            // --------------------------------
            ui->lineEditID->home(false);
        }
    }
    // -------------------------------------
    else if (OTAPI_Wrap::GetAssetTypeCount() < 1)
        SetFieldsBlank();
    // -------------------------------------------
}
void PageSmart_PartyAcct::initializePage() //virtual
{
    QString qstr_id = field("AcctName").toString();
    // -------------------------------------------
    if (qstr_id.isEmpty())
        SetFieldsBlank();
    else
    {
        setField("AcctName", qstr_id);
//        emit completeChanged();
    }
}
void MTPageCreateContract::initializePage() //virtual
{
    std::string str_name;
    QString     qstr_id;
    // -------------------------------------------
    QString qstr_default_id = Moneychanger::It()->get_default_nym_id();
    // -------------------------------------------
    QString qstr_current_id = field("NymID").toString();
    // -------------------------------------------
    qstr_id = qstr_current_id.isEmpty() ? qstr_default_id : qstr_current_id;
    // -------------------------------------------
    if (qstr_id.isEmpty() && (opentxs::OTAPI_Wrap::It()->GetNymCount() > 0))
        qstr_id = QString::fromStdString(opentxs::OTAPI_Wrap::It()->GetNym_ID(0));
    // -------------------------------------------
    if (!qstr_id.isEmpty())
        str_name = opentxs::OTAPI_Wrap::It()->GetNym_Name(qstr_id.toStdString());
    // -------------------------------------------
    QString qstrContractType = field("contractType").toString();

    if (0 == qstrContractType.compare("smart"))
    {
        ui->pushButton->setVisible(false);
        ui->plainTextEdit->setVisible(false);
        ui->label->setVisible(false);
    }
    // -------------------------------------------
    if (str_name.empty() || qstr_id.isEmpty())
        SetFieldsBlank();
    else
    {
        QString qstrName = QString::fromStdString(str_name);
        // ---------------------------
        setField("NymID",   qstr_id);
        setField("NymName", qstrName);
        // ---------------------------
        ui->lineEditID->home(false);
        // ---------------------------
        if (qstr_default_id.isEmpty())
            emit SetDefaultNym(qstr_id, qstrName);
    }
}