History, Coins, Xmr.to: double click row to open info dialog

This commit is contained in:
tobtoht 2020-10-11 21:45:28 +02:00
parent bd7ebdf947
commit 970f8e084d
4 changed files with 22 additions and 6 deletions

View file

@ -57,6 +57,7 @@ CoinsWidget::CoinsWidget(QWidget *parent)
connect(m_thawAllSelectedAction, &QAction::triggered, this, &CoinsWidget::thawAllSelected);
connect(ui->coins, &QTreeView::customContextMenuRequested, this, &CoinsWidget::showContextMenu);
connect(ui->coins, &QTreeView::doubleClicked, this, &CoinsWidget::viewOutput);
}
void CoinsWidget::setModel(CoinsModel * model, Coins * coins) {

View file

@ -35,6 +35,14 @@ HistoryWidget::HistoryWidget(QWidget *parent)
}
});
connect(ui->search, &QLineEdit::textChanged, this, &HistoryWidget::setSearchFilter);
connect(ui->history, &QTreeView::doubleClicked, [this](QModelIndex index){
if (m_model == nullptr) return;
if (!(m_model->flags(index) & Qt::ItemIsEditable)) {
this->showTxDetails();
}
});
}
void HistoryWidget::setModel(Coins *coins, TransactionHistoryProxyModel *model, TransactionHistory *txHistory)

View file

@ -34,12 +34,7 @@ XMRToWidget::XMRToWidget(QWidget *parent) :
m_showDetailsAction = m_contextMenu->addAction("Details");
m_viewOnXmrToAction = m_contextMenu->addAction("View order on XMR.to");
m_viewOnXmrToAction->setIcon(QIcon(":/assets/images/xmrto.png"));
connect(m_showDetailsAction, &QAction::triggered, [&](){
QModelIndex index = ui->historyTable->currentIndex();
XmrToOrder *order = this->tableModel->orders->at(index.row());
auto * dialog = new XmrToInfoDialog(order, this);
dialog->exec();
});
connect(m_showDetailsAction, &QAction::triggered, this, &XMRToWidget::showInfoDialog);
connect(m_viewOnXmrToAction, &QAction::triggered, [&](){
QModelIndex index = ui->historyTable->currentIndex();
XmrToOrder *order = this->tableModel->orders->at(index.row());
@ -67,6 +62,8 @@ XMRToWidget::XMRToWidget(QWidget *parent) :
if (m_ctx->isTails || m_ctx->isWhonix) {
ui->torCheckBox->setDisabled(true);
}
connect(ui->historyTable, &QTreeView::doubleClicked, this, &XMRToWidget::showInfoDialog);
}
void XMRToWidget::setHistoryModel(XmrToModel *model) {
@ -184,6 +181,14 @@ void XMRToWidget::onEndTransaction() {
ui->btnCreate->setEnabled(true);
}
void XMRToWidget::showInfoDialog() {
QModelIndex index = ui->historyTable->currentIndex();
XmrToOrder *order = this->tableModel->orders->at(index.row());
auto *dialog = new XmrToInfoDialog(order, this);
dialog->exec();
dialog->deleteLater();
}
XMRToWidget::~XMRToWidget() {
delete ui;
}

View file

@ -43,6 +43,8 @@ signals:
void viewOrder(const QString &orderId);
private:
void showInfoDialog();
QMap<QString, TickerWidget*> m_tickerWidgets;
QMenu *m_contextMenu;
QAction *m_viewOnXmrToAction;