TxInfoDialog: add copy Tx ID button

This commit is contained in:
tobtoht 2021-10-12 14:58:54 +02:00
parent 3fec15e4aa
commit 3deaa1bc1d
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
3 changed files with 17 additions and 4 deletions

View file

@ -29,8 +29,9 @@ TxInfoDialog::TxInfoDialog(QSharedPointer<AppContext> ctx, TransactionInfo *txIn
m_txid = txInfo->hash(); m_txid = txInfo->hash();
ui->label_txid->setText(m_txid); ui->label_txid->setText(m_txid);
connect(ui->btn_CopyTxKey, &QPushButton::pressed, this, &TxInfoDialog::copyTxKey); connect(ui->btn_copyTxID, &QPushButton::clicked, this, &TxInfoDialog::copyTxID);
connect(ui->btn_createTxProof, &QPushButton::pressed, this, &TxInfoDialog::createTxProof); connect(ui->btn_CopyTxKey, &QPushButton::clicked, this, &TxInfoDialog::copyTxKey);
connect(ui->btn_createTxProof, &QPushButton::clicked, this, &TxInfoDialog::createTxProof);
connect(m_ctx->wallet, &Wallet::newBlock, this, &TxInfoDialog::updateData); connect(m_ctx->wallet, &Wallet::newBlock, this, &TxInfoDialog::updateData);
@ -140,6 +141,10 @@ void TxInfoDialog::updateData() {
this->setData(tx); this->setData(tx);
} }
void TxInfoDialog::copyTxID() {
Utils::copyToClipboard(m_txid);
}
void TxInfoDialog::copyTxKey() { void TxInfoDialog::copyTxKey() {
m_ctx->wallet->getTxKeyAsync(m_txid, [this](QVariantMap map){ m_ctx->wallet->getTxKeyAsync(m_txid, [this](QVariantMap map){
QString txKey = map.value("tx_key").toString(); QString txKey = map.value("tx_key").toString();

View file

@ -28,6 +28,7 @@ signals:
void resendTranscation(const QString &txid); void resendTranscation(const QString &txid);
private: private:
void copyTxID();
void copyTxKey(); void copyTxKey();
void createTxProof(); void createTxProof();
void setData(TransactionInfo *tx); void setData(TransactionInfo *tx);

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>929</width> <width>929</width>
<height>631</height> <height>715</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -205,10 +205,17 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="btn_copyTxID">
<property name="text">
<string>Copy Tx ID/hash</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="btn_CopyTxKey"> <widget class="QPushButton" name="btn_CopyTxKey">
<property name="text"> <property name="text">
<string>Copy Transaction Key</string> <string>Copy Tx Secret Key</string>
</property> </property>
</widget> </widget>
</item> </item>