take sendtoaddr,myaddr and cid from contact object
This commit is contained in:
@@ -59,7 +59,7 @@ void AddressBookModel::removeItemAt(int row)
|
||||
if (row >= labels.size())
|
||||
return;
|
||||
|
||||
AddressBook::getInstance()->removeAddressLabel(labels[row].getName(), labels[row].getPartnerAddress(), labels[row].getMyAddress(),labels[row].getcid());
|
||||
AddressBook::getInstance()->removeAddressLabel(labels[row].getName(), labels[row].getPartnerAddress(), labels[row].getMyAddress(),labels[row].getCid());
|
||||
labels.clear();
|
||||
labels = AddressBook::getInstance()->getAllAddressLabels();
|
||||
dataChanged(index(0, 0), index(labels.size()-1, columnCount(index(0,0))-1));
|
||||
@@ -100,7 +100,7 @@ QVariant AddressBookModel::data(const QModelIndex &index, int role) const
|
||||
case 0: return labels.at(index.row()).getName();
|
||||
case 1: return labels.at(index.row()).getPartnerAddress();
|
||||
case 2: return labels.at(index.row()).getMyAddress();
|
||||
case 3: return labels.at(index.row()).getcid();
|
||||
case 3: return labels.at(index.row()).getCid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||
QString lbl = model.itemAt(index.row()).getName();
|
||||
QString addr = model.itemAt(index.row()).getPartnerAddress();
|
||||
QString myAddr = model.itemAt(index.row()).getMyAddress();
|
||||
QString cid = model.itemAt(index.row()).getcid();
|
||||
QString cid = model.itemAt(index.row()).getCid();
|
||||
d.accept();
|
||||
fnSetTargetLabelAddr(target, lbl, addr, myAddr, cid);
|
||||
});
|
||||
@@ -286,7 +286,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||
QString lbl = model.itemAt(index.row()).getName();
|
||||
QString addr = model.itemAt(index.row()).getPartnerAddress();
|
||||
QString myAddr = model.itemAt(index.row()).getMyAddress();
|
||||
QString cid = model.itemAt(index.row()).getcid();
|
||||
QString cid = model.itemAt(index.row()).getCid();
|
||||
|
||||
QMenu menu(parent);
|
||||
|
||||
@@ -312,7 +312,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||
auto selection = ab.addresses->selectionModel();
|
||||
if (selection && selection->hasSelection() && selection->selectedRows().size() > 0) {
|
||||
auto item = model.itemAt(selection->selectedRows().at(0).row());
|
||||
fnSetTargetLabelAddr(target, item.getName(), item.getMyAddress(), item.getPartnerAddress(), item.getcid());
|
||||
fnSetTargetLabelAddr(target, item.getName(), item.getMyAddress(), item.getPartnerAddress(), item.getCid());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -358,7 +358,7 @@ void AddressBook::readFromStorage()
|
||||
//qDebug() << "0:" << stuff[i][0];
|
||||
//qDebug() << "1:" << stuff[i][1];
|
||||
//qDebug() << "2:" << stuff[i][2];
|
||||
ContactItem contact = ContactItem(stuff[i][3],stuff[i][2], stuff[i][1], stuff[i][0]);
|
||||
ContactItem contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3]);
|
||||
//qDebug() << "contact=" << contact.toQTString();
|
||||
allLabels.push_back(contact);
|
||||
}
|
||||
@@ -393,7 +393,7 @@ void AddressBook::writeToStorage()
|
||||
c.push_back(item.getName());
|
||||
c.push_back(item.getPartnerAddress());
|
||||
c.push_back(item.getMyAddress());
|
||||
c.push_back(item.getcid());
|
||||
c.push_back(item.getCid());
|
||||
contacts.push_back(c);
|
||||
}
|
||||
out << QString("v1") << contacts;
|
||||
@@ -423,9 +423,9 @@ void AddressBook::addAddressLabel(QString label, QString address, QString myAddr
|
||||
// Iterate over the list and remove the label/address
|
||||
for (int i=0; i < allLabels.size(); i++)
|
||||
if (allLabels[i].getName() == label)
|
||||
removeAddressLabel(allLabels[i].getName(), allLabels[i].getPartnerAddress(),allLabels[i].getMyAddress(), allLabels[i].getcid());
|
||||
removeAddressLabel(allLabels[i].getName(), allLabels[i].getPartnerAddress(),allLabels[i].getMyAddress(), allLabels[i].getCid());
|
||||
|
||||
ContactItem item = ContactItem(myAddr, address, label, cid);
|
||||
ContactItem item = ContactItem(label, address, myAddr, cid);
|
||||
allLabels.push_back(item);
|
||||
writeToStorage();
|
||||
}
|
||||
|
||||
@@ -136,9 +136,9 @@ Tx MainWindow::createTxFromChatPage() {
|
||||
// For each addr/amt in the Chat tab
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
// ui->ContactZaddr->setText("Zaddr");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -155,10 +155,16 @@ Tx MainWindow::createTxFromChatPage() {
|
||||
amt = CAmount::fromDecimalString("0");
|
||||
totalAmt = totalAmt + amt;
|
||||
|
||||
// QString cid = QString::number( time(NULL) % std::rand() ); // low entropy for testing!
|
||||
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces); // Needs to get a fix
|
||||
QString hmemo= createHeaderMemo(cid,"Some ZADDR");
|
||||
|
||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||
|
||||
if (ui->ContactZaddr->text().trimmed() == c.getName()) {
|
||||
|
||||
QString cid = c.getCid();
|
||||
QString myAddr = c.getMyAddress();
|
||||
QString addr = c.getPartnerAddress();
|
||||
|
||||
QString hmemo= createHeaderMemo(cid,myAddr);
|
||||
QString memo = ui->memoTxtChat->toPlainText().trimmed();
|
||||
// ui->memoSizeChat->setLenDisplayLabel();
|
||||
|
||||
@@ -168,7 +174,7 @@ Tx MainWindow::createTxFromChatPage() {
|
||||
tx.toAddrs.push_back( ToFields{addr, amt, memo});
|
||||
|
||||
qDebug() << "pushback chattx";
|
||||
}
|
||||
} }
|
||||
|
||||
tx.fee = Settings::getMinerFee();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ void ContactModel::renderContactList(QListWidget* view)
|
||||
}
|
||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||
{
|
||||
view->addItem(c.getPartnerAddress()); //hide
|
||||
view->addItem(c.getName());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ class ContactItem
|
||||
|
||||
public:
|
||||
ContactItem();
|
||||
ContactItem(QString myAddress, QString partnerAddress, QString name, QString cid)
|
||||
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid)
|
||||
{
|
||||
_name = name;
|
||||
_myAddress = myAddress;
|
||||
_partnerAddress = partnerAddress;
|
||||
_name = name;
|
||||
_cid = cid;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class ContactItem
|
||||
return _partnerAddress;
|
||||
}
|
||||
|
||||
QString getcid() const
|
||||
QString getCid() const
|
||||
{
|
||||
return _cid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user