void PageOffer_Accounts::on_pushButtonManageServer_clicked() { MTDetailEdit * pWindow = new MTDetailEdit(this); pWindow->setAttribute(Qt::WA_DeleteOnClose); // ------------------------------------- mapIDName & the_map = pWindow->m_map; // ------------------------------------- the_map.clear(); // ------------------------------------- QString qstrPreselected = field("ServerID").toString(); bool bFoundPreselected = false; // ------------------------------------- int32_t the_count = OTAPI_Wrap::It()->GetServerCount(); for (int32_t ii = 0; ii < the_count; ii++) { QString OT_id = QString::fromStdString(OTAPI_Wrap::It()->GetServer_ID(ii)); QString OT_name = QString::fromStdString(OTAPI_Wrap::It()->GetServer_Name(OT_id.toStdString())); the_map.insert(OT_id, OT_name); if (!qstrPreselected.isEmpty() && (qstrPreselected == OT_id)) bFoundPreselected = true; } // for // ------------------------------------- if (bFoundPreselected) pWindow->SetPreSelected(qstrPreselected); // ------------------------------------- pWindow->setWindowTitle(tr("Manage Servers")); // ------------------------------------- pWindow->dialog(MTDetailEdit::DetailEditTypeServer, true); }
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(); // ------------------------------------------- }