|
|
@ -43,18 +43,21 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidg |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// context menu actions
|
|
|
|
// context menu actions
|
|
|
|
|
|
|
|
QAction *copyURIAction = new QAction(tr("Copy URI"), this); |
|
|
|
QAction *copyLabelAction = new QAction(tr("Copy label"), this); |
|
|
|
QAction *copyLabelAction = new QAction(tr("Copy label"), this); |
|
|
|
QAction *copyMessageAction = new QAction(tr("Copy message"), this); |
|
|
|
QAction *copyMessageAction = new QAction(tr("Copy message"), this); |
|
|
|
QAction *copyAmountAction = new QAction(tr("Copy amount"), this); |
|
|
|
QAction *copyAmountAction = new QAction(tr("Copy amount"), this); |
|
|
|
|
|
|
|
|
|
|
|
// context menu
|
|
|
|
// context menu
|
|
|
|
contextMenu = new QMenu(); |
|
|
|
contextMenu = new QMenu(); |
|
|
|
|
|
|
|
contextMenu->addAction(copyURIAction); |
|
|
|
contextMenu->addAction(copyLabelAction); |
|
|
|
contextMenu->addAction(copyLabelAction); |
|
|
|
contextMenu->addAction(copyMessageAction); |
|
|
|
contextMenu->addAction(copyMessageAction); |
|
|
|
contextMenu->addAction(copyAmountAction); |
|
|
|
contextMenu->addAction(copyAmountAction); |
|
|
|
|
|
|
|
|
|
|
|
// context menu signals
|
|
|
|
// context menu signals
|
|
|
|
connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); |
|
|
|
connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); |
|
|
|
|
|
|
|
connect(copyURIAction, SIGNAL(triggered()), this, SLOT(copyURI())); |
|
|
|
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); |
|
|
|
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); |
|
|
|
connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage())); |
|
|
|
connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage())); |
|
|
|
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); |
|
|
|
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); |
|
|
@ -227,30 +230,50 @@ void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event) |
|
|
|
this->QDialog::keyPressEvent(event); |
|
|
|
this->QDialog::keyPressEvent(event); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// copy column of selected row to clipboard
|
|
|
|
QModelIndex ReceiveCoinsDialog::selectedRow() |
|
|
|
void ReceiveCoinsDialog::copyColumnToClipboard(int column) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel()) |
|
|
|
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel()) |
|
|
|
return; |
|
|
|
return QModelIndex(); |
|
|
|
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows(); |
|
|
|
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows(); |
|
|
|
if(selection.empty()) |
|
|
|
if(selection.empty()) |
|
|
|
return; |
|
|
|
return QModelIndex(); |
|
|
|
// correct for selection mode ContiguousSelection
|
|
|
|
// correct for selection mode ContiguousSelection
|
|
|
|
QModelIndex firstIndex = selection.at(0); |
|
|
|
QModelIndex firstIndex = selection.at(0); |
|
|
|
|
|
|
|
return firstIndex; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// copy column of selected row to clipboard
|
|
|
|
|
|
|
|
void ReceiveCoinsDialog::copyColumnToClipboard(int column) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QModelIndex firstIndex = selectedRow(); |
|
|
|
|
|
|
|
if (!firstIndex.isValid()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString()); |
|
|
|
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// context menu
|
|
|
|
// context menu
|
|
|
|
void ReceiveCoinsDialog::showMenu(const QPoint &point) |
|
|
|
void ReceiveCoinsDialog::showMenu(const QPoint &point) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel()) |
|
|
|
if (!selectedRow().isValid()) { |
|
|
|
return; |
|
|
|
|
|
|
|
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows(); |
|
|
|
|
|
|
|
if(selection.empty()) |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
contextMenu->exec(QCursor::pos()); |
|
|
|
contextMenu->exec(QCursor::pos()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// context menu action: copy URI
|
|
|
|
|
|
|
|
void ReceiveCoinsDialog::copyURI() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QModelIndex sel = selectedRow(); |
|
|
|
|
|
|
|
if (!sel.isValid()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const RecentRequestsTableModel * const submodel = model->getRecentRequestsTableModel(); |
|
|
|
|
|
|
|
const QString uri = GUIUtil::formatBitcoinURI(submodel->entry(sel.row()).recipient); |
|
|
|
|
|
|
|
GUIUtil::setClipboard(uri); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// context menu action: copy label
|
|
|
|
// context menu action: copy label
|
|
|
|
void ReceiveCoinsDialog::copyLabel() |
|
|
|
void ReceiveCoinsDialog::copyLabel() |
|
|
|
{ |
|
|
|
{ |
|
|
|