void MTAssetDetails::ImportContract(QString qstrContents) { if (qstrContents.isEmpty()) { QMessageBox::warning(this, tr("Contract is Empty"), tr("Failed importing: contract is empty.")); return; } // ------------------------------------------------------ QString qstrContractID = QString::fromStdString(OTAPI_Wrap::CalculateAssetContractID(qstrContents.toStdString())); if (qstrContractID.isEmpty()) { QMessageBox::warning(this, tr("Failed Calculating Contract ID"), tr("Failed trying to calculate this contract's ID. Perhaps the 'contract' is malformed?")); return; } // ------------------------------------------------------ else { // Already in the wallet? // // std::string str_Contract = OTAPI_Wrap::LoadAssetContract(qstrContractID.toStdString()); // // if (!str_Contract.empty()) // { // QMessageBox::warning(this, tr("Contract Already in Wallet"), // tr("Failed importing this contract, since it's already in the wallet.")); // return; // } // --------------------------------------------------- int32_t nAdded = OTAPI_Wrap::AddAssetContract(qstrContents.toStdString()); if (1 != nAdded) { QMessageBox::warning(this, tr("Failed Importing Asset Contract"), tr("Failed trying to import contract. Is it already in the wallet?")); return; } // ----------------------------------------------- QString qstrContractName = QString::fromStdString(OTAPI_Wrap::GetAssetType_Name(qstrContractID.toStdString())); // ----------------------------------------------- // This was irritating knotwork. // // QMessageBox::information(this, tr("Success!"), QString("%1: '%2' %3: %4").arg(tr("Success Importing Asset Contract! Name")). // arg(qstrContractName).arg(tr("ID")).arg(qstrContractID)); // ---------- m_pOwner->m_map.insert(qstrContractID, qstrContractName); m_pOwner->SetPreSelected(qstrContractID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } // if (!qstrContractID.isEmpty()) }
//virtual void MTContactDetails::DeleteButtonClicked() { if (!m_pOwner->m_qstrCurrentID.isEmpty()) { bool bSuccess = MTContactHandler::getInstance()->DeleteContact(m_pOwner->m_qstrCurrentID.toInt()); if (bSuccess) { m_pOwner->m_map.remove(m_pOwner->m_qstrCurrentID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } } }
void MTAssetDetails::on_lineEditName_editingFinished() { if (!m_pOwner->m_qstrCurrentID.isEmpty()) { bool bSuccess = OTAPI_Wrap::SetAssetType_Name(m_pOwner->m_qstrCurrentID.toStdString(), // Asset Type ui->lineEditName->text(). toStdString()); // New Name if (bSuccess) { m_pOwner->m_map.remove(m_pOwner->m_qstrCurrentID); m_pOwner->m_map.insert(m_pOwner->m_qstrCurrentID, ui->lineEditName->text()); m_pOwner->SetPreSelected(m_pOwner->m_qstrCurrentID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } } }
//virtual void MTAccountDetails::DeleteButtonClicked() { if (!m_pOwner->m_qstrCurrentID.isEmpty()) { // ---------------------------------------------------- bool bCanRemove = OTAPI_Wrap::It()->Wallet_CanRemoveAccount(m_pOwner->m_qstrCurrentID.toStdString()); if (!bCanRemove) { QMessageBox::warning(this, tr("Account Cannot Be Deleted"), tr("This Account cannot be deleted yet, since it probably doesn't have a zero balance, " "and probably still has outstanding receipts. (This is where, in the future, " "you will be given the option to automatically close-out all that stuff and thus delete " "this Account.)")); return; } // ---------------------------------------------------- QMessageBox::StandardButton reply; reply = QMessageBox::question(this, "", tr("Are you sure you want to delete this Account?"), QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { // TODO: Need to use OT_ME to send a "delete account" message to the server. // Only if that is successful, do we set bSuccess here to true. // bool bSuccess = OTAPI_Wrap::It()->Wallet_RemoveAccount(m_pOwner->m_qstrCurrentID.toStdString()); bool bSuccess = false; if (!bSuccess) QMessageBox::warning(this, tr("Failure Deleting Account"), tr("Failed trying to delete this Account.")); else { m_pOwner->m_map.remove(m_pOwner->m_qstrCurrentID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } } } // ---------------------------------------------------- }
void MTContactDetails::on_lineEditName_editingFinished() { int nContactID = m_pOwner->m_qstrCurrentID.toInt(); if (nContactID > 0) { bool bSuccess = MTContactHandler::getInstance()->SetContactName(nContactID, ui->lineEditName->text()); if (bSuccess) { m_pOwner->m_map.remove(m_pOwner->m_qstrCurrentID); m_pOwner->m_map.insert(m_pOwner->m_qstrCurrentID, ui->lineEditName->text()); m_pOwner->SetPreSelected(m_pOwner->m_qstrCurrentID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } } }
//virtual void MTNymDetails::DeleteButtonClicked() { if (!m_pOwner->m_qstrCurrentID.isEmpty()) { // ---------------------------------------------------- bool bCanRemove = OTAPI_Wrap::Wallet_CanRemoveNym(m_pOwner->m_qstrCurrentID.toStdString()); if (!bCanRemove) { QMessageBox::warning(this, tr("Nym Cannot Be Deleted"), tr("This Nym cannot be deleted yet, since it's already been registered on at least one " "server, and perhaps even owns an asset account or two. (This is where, in the future, " "you will be given the option to automatically delete all that stuff and thus delete " "this Nym.)")); return; } // ---------------------------------------------------- QMessageBox::StandardButton reply; reply = QMessageBox::question(this, "", "Are you sure you want to delete this Nym?", QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { bool bSuccess = OTAPI_Wrap::Wallet_RemoveNym(m_pOwner->m_qstrCurrentID.toStdString()); if (bSuccess) { m_pOwner->m_map.remove(m_pOwner->m_qstrCurrentID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } else QMessageBox::warning(this, tr("Failure Deleting Nym"), tr("Failed trying to delete this Nym.")); } } // ---------------------------------------------------- }
//virtual void MTAssetDetails::DeleteButtonClicked() { if (!m_pOwner->m_qstrCurrentID.isEmpty()) { // ---------------------------------------------------- bool bCanRemove = OTAPI_Wrap::Wallet_CanRemoveAssetType(m_pOwner->m_qstrCurrentID.toStdString()); if (!bCanRemove) { QMessageBox::warning(this, tr("Asset Contract Cannot Be Removed"), tr("This Asset Contract cannot be removed, since you probably have already created accounts " "using this asset type. (This is where, in the future, you would be given the option " "to automatically delete those accounts, and remove this asset contract along with them.)")); return; } // ---------------------------------------------------- QMessageBox::StandardButton reply; reply = QMessageBox::question(this, "", tr("Are you sure you want to delete this Asset Contract?"), QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { bool bSuccess = OTAPI_Wrap::Wallet_RemoveAssetType(m_pOwner->m_qstrCurrentID.toStdString()); if (bSuccess) { m_pOwner->m_map.remove(m_pOwner->m_qstrCurrentID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } else QMessageBox::warning(this, tr("Failure Removing Asset Contract"), tr("Failed trying to remove this Asset Contract.")); } } // ---------------------------------------------------- }
//virtual void MTServerDetails::DeleteButtonClicked() { if (!m_pOwner->m_qstrCurrentID.isEmpty()) { // ---------------------------------------------------- bool bCanRemove = OTAPI_Wrap::It()->Wallet_CanRemoveServer(m_pOwner->m_qstrCurrentID.toStdString()); if (!bCanRemove) { QMessageBox::warning(this, tr("Server Cannot Be Deleted"), tr("This Server cannot be deleted yet, since you probably have Nyms registered there. " "(This is where, in the future, you'd be given the option to automatically delete those Nyms.)")); return; } // ---------------------------------------------------- QMessageBox::StandardButton reply; reply = QMessageBox::question(this, "", tr("Are you sure you want to remove this Server Contract?"), QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { bool bSuccess = OTAPI_Wrap::It()->Wallet_RemoveServer(m_pOwner->m_qstrCurrentID.toStdString()); if (bSuccess) { m_pOwner->m_map.remove(m_pOwner->m_qstrCurrentID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } else QMessageBox::warning(this, tr("Failure Removing Server Contract"), tr("Failed trying to remove this Server Contract.")); } } // ---------------------------------------------------- }
//virtual void MTAccountDetails::AddButtonClicked() { MTWizardAddAccount theWizard(this); theWizard.setWindowTitle(tr("Create Account")); if (QDialog::Accepted == theWizard.exec()) { QString qstrName = theWizard.field("Name") .toString(); QString qstrAssetID = theWizard.field("AssetID") .toString(); QString qstrNymID = theWizard.field("NymID") .toString(); QString qstrServerID = theWizard.field("ServerID").toString(); // --------------------------------------------------- QString qstrAssetName = QString::fromStdString(OTAPI_Wrap::It()->GetAssetType_Name(qstrAssetID .toStdString())); QString qstrNymName = QString::fromStdString(OTAPI_Wrap::It()->GetNym_Name (qstrNymID .toStdString())); QString qstrServerName = QString::fromStdString(OTAPI_Wrap::It()->GetServer_Name (qstrServerID.toStdString())); // --------------------------------------------------- QMessageBox::information(this, tr("Confirm Create Account"), QString("%1: '%2'<br/>%3: %4<br/>%5: %6<br/>%7: %8").arg(tr("Confirm Create Account:<br/>Name")). arg(qstrName).arg(tr("Asset")).arg(qstrAssetName).arg(tr("Nym")).arg(qstrNymName).arg(tr("Server")).arg(qstrServerName)); // --------------------------------------------------- // NOTE: theWizard won't allow each page to finish unless the ID is provided. // (Therefore we don't have to check here to see if any of the IDs are empty.) // ------------------------------ // First make sure the Nym is registered at the server, and if not, register him. // bool bIsRegiseredAtServer = OTAPI_Wrap::It()->IsNym_RegisteredAtServer(qstrNymID.toStdString(), qstrServerID.toStdString()); if (!bIsRegiseredAtServer) { OT_ME madeEasy; // If the Nym's not registered at the server, then register him first. // int32_t nSuccess = 0; { MTSpinner theSpinner; std::string strResponse = madeEasy.register_nym(qstrServerID.toStdString(), qstrNymID .toStdString()); // This also does getRequest internally, if success. nSuccess = madeEasy.VerifyMessageSuccess(strResponse); } // -1 is error, // 0 is reply received: failure // 1 is reply received: success // switch (nSuccess) { case (1): { bIsRegiseredAtServer = true; break; // SUCCESS } case (0): { QMessageBox::warning(this, tr("Failed Registration"), tr("Failed while trying to register Nym at Server.")); break; } default: { QMessageBox::warning(this, tr("Error in Registration"), tr("Error while trying to register Nym at Server.")); break; } } // switch // -------------------------- if (1 != nSuccess) { Moneychanger::HasUsageCredits(this, qstrServerID, qstrNymID); return; } } // -------------------------- // Send the request. // (Create Account here...) // OT_ME madeEasy; // Send the 'create_asset_acct' message to the server. // std::string strResponse; { MTSpinner theSpinner; strResponse = madeEasy.create_asset_acct(qstrServerID.toStdString(), qstrNymID .toStdString(), qstrAssetID .toStdString()); } // -1 error, 0 failure, 1 success. // if (1 != madeEasy.VerifyMessageSuccess(strResponse)) { const int64_t lUsageCredits = Moneychanger::HasUsageCredits(this, qstrServerID, qstrNymID); // HasUsageCredits already pops up an error box in the cases of -2 and 0. // if (((-2) != lUsageCredits) && (0 != lUsageCredits)) QMessageBox::warning(this, tr("Failed Creating Account"), tr("Failed trying to create Account at Server.")); return; } // ------------------------------------------------------ // Get the ID of the new account. // QString qstrID = QString::fromStdString(OTAPI_Wrap::It()->Message_GetNewAcctID(strResponse)); if (qstrID.isEmpty()) { QMessageBox::warning(this, tr("Failed Getting new Account ID"), tr("Failed trying to get the new account's ID from the server response.")); return; } // ------------------------------------------------------ // Set the Name of the new account. // //bool bNameSet = OTAPI_Wrap::It()->SetAccountWallet_Name(qstrID .toStdString(), qstrNymID.toStdString(), qstrName .toStdString()); // ----------------------------------------------- // Commenting out for now. // // QMessageBox::information(this, tr("Success!"), QString("%1: '%2'<br/>%3: %4").arg(tr("Success Creating Account!<br/>Name")). // arg(qstrName).arg(tr("ID")).arg(qstrID)); // ---------- m_pOwner->m_map.insert(qstrID, qstrName); m_pOwner->SetPreSelected(qstrID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } }
// This only does something the first time you run it. // void MTDetailEdit::FirstRun(MTDetailEdit::DetailEditType theType) { if (m_bFirstRun) { // ------------------------------------------- ui->comboBox->setHidden(true); // ------------------------------------------- ui->tableWidget->setColumnCount(2); ui->tableWidget->setSelectionMode (QAbstractItemView::SingleSelection); ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); // ------------------------------------------- ui->tableWidget->horizontalHeader()->resizeSection(0, 5); // ------------------------------------------- ui->tableWidget->horizontalHeader()->setStretchLastSection(true); ui->tableWidget->verticalHeader()->setDefaultSectionSize(60); ui->tableWidget->verticalHeader()->hide(); ui->tableWidget->horizontalHeader()->hide(); // ------------------------------------------- ui->tableWidget->setContentsMargins(10,0,0,0); // ------------------------------------------- ui->tableWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding); // ---------------------------------- m_pTabWidget = new QTabWidget; // ---------------------------------- m_pTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_pTabWidget->setContentsMargins(5, 5, 5, 5); // ---------------------------------- QWidget * pTab1 = new QWidget; // ---------------------------------- pTab1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pTab1->setContentsMargins(5, 5, 5, 5); // ---------------------------------- QString qstrTab1Title = tr("Details"); m_pTabWidget->addTab(pTab1, qstrTab1Title); // ------------------------------------------- // Instantiate m_pDetailPane to one of various types. // m_Type = theType; switch (m_Type) { case MTDetailEdit::DetailEditTypeServer: m_pDetailPane = new MTServerDetails(this, *this); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newServerAdded(QString)), Moneychanger::It(), SLOT (onNewServerAdded(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newServerAdded(QString)), m_pDetailPane, SIGNAL(RefreshRecordsAndUpdateMenu())); // ------------------------------------------- break; case MTDetailEdit::DetailEditTypeAsset: m_pDetailPane = new MTAssetDetails(this, *this); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newAssetAdded(QString)), Moneychanger::It(), SLOT (onNewAssetAdded(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newAssetAdded(QString)), m_pDetailPane, SIGNAL(RefreshRecordsAndUpdateMenu())); // ------------------------------------------- // For new issuer accounts: (which are created on the assets page when a user registers the currency onto a server.) // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newAccountAdded(QString)), Moneychanger::It(), SLOT (onNewAccountAdded(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newAccountAdded(QString)), m_pDetailPane, SIGNAL(RefreshRecordsAndUpdateMenu())); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newAccountAdded(QString)), m_pDetailPane, SIGNAL(ShowAccount(QString))); // ------------------------------------------- break; case MTDetailEdit::DetailEditTypeNym: m_pDetailPane = new MTNymDetails(this, *this); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newNymAdded(QString)), Moneychanger::It(), SLOT (onNewNymAdded(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newNymAdded(QString)), m_pDetailPane, SIGNAL(RefreshRecordsAndUpdateMenu())); // ------------------------------------------- break; case MTDetailEdit::DetailEditTypeContact: m_pDetailPane = new MTContactDetails (this, *this); break; case MTDetailEdit::DetailEditTypeCorporation: m_pDetailPane = new MTCorporationDetails(this, *this); break; case MTDetailEdit::DetailEditTypeTransport: m_pDetailPane = new TransportDetails (this, *this); break; case MTDetailEdit::DetailEditTypeAgreement: ui->comboBox->setHidden(false); m_pDetailPane = new MTAgreementDetails (this, *this); // ------------------------------------------- connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT (on_comboBox_currentIndexChanged(int))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(runSmartContract(QString, QString, int32_t)), Moneychanger::It(), SLOT (onRunSmartContract(QString, QString, int32_t))); // ------------------------------------------- break; case MTDetailEdit::DetailEditTypeOffer: ui->comboBox->setHidden(false); m_pDetailPane = new MTOfferDetails(this, *this); // ------------------------------------------- connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT (on_comboBox_currentIndexChanged(int))); // ------------------------------------------- break; case MTDetailEdit::DetailEditTypeMarket: EnableAdd (false); EnableDelete(false); m_pDetailPane = new MTMarketDetails(this, *this); break; case MTDetailEdit::DetailEditTypeAccount: m_pDetailPane = new MTAccountDetails(this, *this); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(DefaultAccountChanged(QString, QString)), Moneychanger::It(), SLOT (setDefaultAccount(QString, QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(SendFromAcct(QString)), Moneychanger::It(), SLOT (mc_send_from_acct(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(RequestToAcct(QString)), Moneychanger::It(), SLOT (mc_request_to_acct(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newAccountAdded(QString)), Moneychanger::It(), SLOT (onNewAccountAdded(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(newAccountAdded(QString)), m_pDetailPane, SIGNAL(RefreshRecordsAndUpdateMenu())); // ------------------------------------------- break; default: qDebug() << "MTDetailEdit::dialog: MTDetailEdit::DetailEditTypeError"; return; } //switch // ------------------------------------------- connect(m_pDetailPane, SIGNAL(NeedToUpdateMenu()), Moneychanger::It(), SLOT (onNeedToUpdateMenu())); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(RefreshRecordsAndUpdateMenu()), Moneychanger::It(), SLOT (onNeedToUpdateMenu())); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(RefreshRecordsAndUpdateMenu()), this, SLOT (onRefreshRecords())); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(ShowAsset(QString)), Moneychanger::It(), SLOT (mc_show_asset_slot(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(ShowNym(QString)), Moneychanger::It(), SLOT (mc_show_nym_slot(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(ShowServer(QString)), Moneychanger::It(), SLOT (mc_show_server_slot(QString))); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(ShowAccount(QString)), Moneychanger::It(), SLOT (mc_show_account_slot(QString))); // ------------------------------------------- m_pDetailPane->SetOwnerPointer(*this); m_pDetailPane->SetEditType(theType); // ------------------------------------------- m_pDetailLayout = new QVBoxLayout; m_pDetailLayout->addWidget(m_pDetailPane); m_pDetailPane ->setContentsMargins(1,1,1,1); m_pDetailLayout->setContentsMargins(1,1,1,1); // ---------------------------------- pTab1->setLayout(m_pDetailLayout); // ---------------------------------- int nCustomTabCount = m_pDetailPane->GetCustomTabCount(); if (nCustomTabCount > 0) { for (int ii = 0; ii < nCustomTabCount; ii++) { QWidget * pTab = m_pDetailPane->CreateCustomTab(ii); // ---------------------------------- if (NULL != pTab) { pTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pTab->setContentsMargins(5, 5, 5, 5); QString qstrTabName = m_pDetailPane->GetCustomTabName(ii); m_pTabWidget->addTab(pTab, qstrTabName); } // ---------------------------------- } } // ----------------------------------------------- QGridLayout * pGridLayout = new QGridLayout; pGridLayout->addWidget(m_pTabWidget); pGridLayout->setContentsMargins(0,0,0,0); m_pTabWidget->setTabPosition(QTabWidget::South); // ---------------------------------- ui->widget->setContentsMargins(1,1,1,1); // ---------------------------------- ui->widget->setLayout(pGridLayout); // ---------------------------------- if (!m_bEnableAdd) ui->addButton->setVisible(false); // ---------------------------------- if (!m_bEnableDelete) ui->deleteButton->setVisible(false); // ---------------------------------- if (m_pDetailPane) m_pDetailPane->setVisible(false); m_pTabWidget->setVisible(false); // ---------------------------------- m_bFirstRun = false; } // first run. }
//virtual void MTNymDetails::AddButtonClicked() { MTWizardAddNym theWizard(this); theWizard.setWindowTitle(tr("Create Nym (a.k.a. Create Identity)")); if (QDialog::Accepted == theWizard.exec()) { QString qstrName = theWizard.field("Name") .toString(); int nKeysizeIndex = theWizard.field("Keysize") .toInt(); int nAuthorityIndex = theWizard.field("Authority").toInt(); QString qstrSource = theWizard.field("Source") .toString(); QString qstrLocation = theWizard.field("Location") .toString(); // --------------------------------------------------- // NOTE: theWizard won't allow each page to finish unless the data is provided. // (Therefore we don't have to check here to see if any of the data is empty.) int32_t nKeybits = 1024; switch (nKeysizeIndex) { case 0: // 1024 nKeybits = 1024; break; case 1: // 2048 nKeybits = 2048; break; case 2: // 4096 nKeybits = 4096; break; default: qDebug() << QString("%1: %2").arg(tr("Error in keysize selection. Using default")).arg(nKeybits); break; } // ------------------------------------------- std::string NYM_ID_SOURCE(""); if (0 != nAuthorityIndex) // Zero would be Self-Signed, which needs no source. NYM_ID_SOURCE = qstrSource.toStdString(); // ------------------------------------------- std::string ALT_LOCATION(""); if (!qstrLocation.isEmpty()) ALT_LOCATION = qstrLocation.toStdString(); // ------------------------------------------- // Create Nym here... // OT_ME madeEasy; std::string str_id = madeEasy.create_pseudonym(nKeybits, NYM_ID_SOURCE, ALT_LOCATION); if (str_id.empty()) { QMessageBox::warning(this, tr("Failed Creating Nym"), tr("Failed trying to create Nym.")); return; } // ------------------------------------------------------ // Get the ID of the new nym. // QString qstrID = QString::fromStdString(str_id); // ------------------------------------------------------ // Register the Namecoin name. if (nAuthorityIndex == 1) { const unsigned cnt = OTAPI_Wrap::GetNym_CredentialCount (str_id); if (cnt != 1) { qDebug () << "Expected one master credential, got " << cnt << ". Skipping Namecoin registration."; } else { const std::string cred = OTAPI_Wrap::GetNym_CredentialID (str_id, 0); const QString qCred = QString::fromStdString (cred); NMC_NameManager& nmc = NMC_NameManager::getInstance (); nmc.startRegistration (qstrID, qCred); } } // ------------------------------------------------------ // Set the Name of the new Nym. // //bool bNameSet = OTAPI_Wrap::SetNym_Name(qstrID.toStdString(), qstrID.toStdString(), qstrName.toStdString()); // ----------------------------------------------- // Commenting this out for now. // // QMessageBox::information(this, tr("Success!"), QString("%1: '%2' %3: %4").arg(tr("Success Creating Nym! Name")). // arg(qstrName).arg(tr("ID")).arg(qstrID)); // ---------- m_pOwner->m_map.insert(qstrID, qstrName); m_pOwner->SetPreSelected(qstrID); // ------------------------------------------------ emit RefreshRecordsAndUpdateMenu(); // ------------------------------------------------ } }