示例#1
0
void SellsPage::on_cancelButton_clicked()
{
    QItemSelectionModel* selectionModel = ui->listingsTableWidget->selectionModel();
    QModelIndexList selected = selectionModel->selectedRows();
    if(selected.count() == 0)
        return;

    QModelIndex index = selected.at(0);
    int r = index.row();
    std::string id = ui->listingsTableWidget->item(r, 0)->text().toStdString();
    uint256 idHash = uint256(id);

    // ask the user if they really want to put in a buy request
    QMessageBox::StandardButton reply;
      reply = QMessageBox::question(this, "Cancel Listing", "Are you sure you want to cancel the listing for this item?",
                                QMessageBox::Yes|QMessageBox::No);
    if (reply == QMessageBox::Yes) 
    {
	CCancelListing cancel;
	cancel.listingId = idHash;
	cancel.sellerKey = pwalletMain->GenerateNewKey();
	cancel.nDate = GetTime();
	SignCancelListing(cancel, cancel.vchSig);
	ReceiveCancelListing(cancel);
	cancel.BroadcastToAll();
	LoadSells();
    }
}
示例#2
0
Value marketcancellisting(const Array& params, bool fHelp)
{
    if (fHelp || params.size() == 0)
        throw runtime_error("marketcancellisting \n"
                            "Cancels a market listing \n"
                            "parameters: <itemId>");

    string itemID = params[0].get_str();
    uint256 listingHashId = uint256(itemID);

    CCancelListing cancel;
    cancel.listingId = listingHashId;
    cancel.sellerKey = pwalletMain->GenerateNewKey();
    cancel.nDate = GetTime();
    SignCancelListing(cancel, cancel.vchSig);
    ReceiveCancelListing(cancel);
    cancel.BroadcastToAll();

    return Value::null;
}