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())
|
if (row >= labels.size())
|
||||||
return;
|
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.clear();
|
||||||
labels = AddressBook::getInstance()->getAllAddressLabels();
|
labels = AddressBook::getInstance()->getAllAddressLabels();
|
||||||
dataChanged(index(0, 0), index(labels.size()-1, columnCount(index(0,0))-1));
|
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 0: return labels.at(index.row()).getName();
|
||||||
case 1: return labels.at(index.row()).getPartnerAddress();
|
case 1: return labels.at(index.row()).getPartnerAddress();
|
||||||
case 2: return labels.at(index.row()).getMyAddress();
|
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 lbl = model.itemAt(index.row()).getName();
|
||||||
QString addr = model.itemAt(index.row()).getPartnerAddress();
|
QString addr = model.itemAt(index.row()).getPartnerAddress();
|
||||||
QString myAddr = model.itemAt(index.row()).getMyAddress();
|
QString myAddr = model.itemAt(index.row()).getMyAddress();
|
||||||
QString cid = model.itemAt(index.row()).getcid();
|
QString cid = model.itemAt(index.row()).getCid();
|
||||||
d.accept();
|
d.accept();
|
||||||
fnSetTargetLabelAddr(target, lbl, addr, myAddr, cid);
|
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 lbl = model.itemAt(index.row()).getName();
|
||||||
QString addr = model.itemAt(index.row()).getPartnerAddress();
|
QString addr = model.itemAt(index.row()).getPartnerAddress();
|
||||||
QString myAddr = model.itemAt(index.row()).getMyAddress();
|
QString myAddr = model.itemAt(index.row()).getMyAddress();
|
||||||
QString cid = model.itemAt(index.row()).getcid();
|
QString cid = model.itemAt(index.row()).getCid();
|
||||||
|
|
||||||
QMenu menu(parent);
|
QMenu menu(parent);
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
|||||||
auto selection = ab.addresses->selectionModel();
|
auto selection = ab.addresses->selectionModel();
|
||||||
if (selection && selection->hasSelection() && selection->selectedRows().size() > 0) {
|
if (selection && selection->hasSelection() && selection->selectedRows().size() > 0) {
|
||||||
auto item = model.itemAt(selection->selectedRows().at(0).row());
|
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() << "0:" << stuff[i][0];
|
||||||
//qDebug() << "1:" << stuff[i][1];
|
//qDebug() << "1:" << stuff[i][1];
|
||||||
//qDebug() << "2:" << stuff[i][2];
|
//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();
|
//qDebug() << "contact=" << contact.toQTString();
|
||||||
allLabels.push_back(contact);
|
allLabels.push_back(contact);
|
||||||
}
|
}
|
||||||
@@ -393,7 +393,7 @@ void AddressBook::writeToStorage()
|
|||||||
c.push_back(item.getName());
|
c.push_back(item.getName());
|
||||||
c.push_back(item.getPartnerAddress());
|
c.push_back(item.getPartnerAddress());
|
||||||
c.push_back(item.getMyAddress());
|
c.push_back(item.getMyAddress());
|
||||||
c.push_back(item.getcid());
|
c.push_back(item.getCid());
|
||||||
contacts.push_back(c);
|
contacts.push_back(c);
|
||||||
}
|
}
|
||||||
out << QString("v1") << contacts;
|
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
|
// Iterate over the list and remove the label/address
|
||||||
for (int i=0; i < allLabels.size(); i++)
|
for (int i=0; i < allLabels.size(); i++)
|
||||||
if (allLabels[i].getName() == label)
|
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);
|
allLabels.push_back(item);
|
||||||
writeToStorage();
|
writeToStorage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ Tx MainWindow::createTxFromChatPage() {
|
|||||||
// For each addr/amt in the Chat tab
|
// For each addr/amt in the Chat tab
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ui->ContactZaddr->setText("Zaddr");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -155,10 +155,16 @@ Tx MainWindow::createTxFromChatPage() {
|
|||||||
amt = CAmount::fromDecimalString("0");
|
amt = CAmount::fromDecimalString("0");
|
||||||
totalAmt = totalAmt + amt;
|
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
|
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
QString hmemo= createHeaderMemo(cid,"Some ZADDR");
|
|
||||||
|
|
||||||
|
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();
|
QString memo = ui->memoTxtChat->toPlainText().trimmed();
|
||||||
// ui->memoSizeChat->setLenDisplayLabel();
|
// ui->memoSizeChat->setLenDisplayLabel();
|
||||||
|
|
||||||
@@ -168,7 +174,7 @@ Tx MainWindow::createTxFromChatPage() {
|
|||||||
tx.toAddrs.push_back( ToFields{addr, amt, memo});
|
tx.toAddrs.push_back( ToFields{addr, amt, memo});
|
||||||
|
|
||||||
qDebug() << "pushback chattx";
|
qDebug() << "pushback chattx";
|
||||||
}
|
} }
|
||||||
|
|
||||||
tx.fee = Settings::getMinerFee();
|
tx.fee = Settings::getMinerFee();
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ void ContactModel::renderContactList(QListWidget* view)
|
|||||||
}
|
}
|
||||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
{
|
{
|
||||||
view->addItem(c.getPartnerAddress()); //hide
|
view->addItem(c.getName());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ class ContactItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ContactItem();
|
ContactItem();
|
||||||
ContactItem(QString myAddress, QString partnerAddress, QString name, QString cid)
|
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid)
|
||||||
{
|
{
|
||||||
|
_name = name;
|
||||||
_myAddress = myAddress;
|
_myAddress = myAddress;
|
||||||
_partnerAddress = partnerAddress;
|
_partnerAddress = partnerAddress;
|
||||||
_name = name;
|
|
||||||
_cid = cid;
|
_cid = cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class ContactItem
|
|||||||
return _partnerAddress;
|
return _partnerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getcid() const
|
QString getCid() const
|
||||||
{
|
{
|
||||||
return _cid;
|
return _cid;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user