| 197 | } |
| 198 | |
| 199 | void TransactionView::setModel(WalletModel *_model) |
| 200 | { |
| 201 | this->model = _model; |
| 202 | if(_model) |
| 203 | { |
| 204 | transactionProxyModel = new TransactionFilterProxy(this); |
| 205 | transactionProxyModel->setSourceModel(_model->getTransactionTableModel()); |
| 206 | transactionProxyModel->setDynamicSortFilter(true); |
| 207 | transactionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); |
| 208 | transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
| 209 | transactionProxyModel->setSortRole(Qt::EditRole); |
| 210 | transactionView->setModel(transactionProxyModel); |
| 211 | transactionView->sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder); |
| 212 | |
| 213 | if (_model->getOptionsModel()) |
| 214 | { |
| 215 | // Add third party transaction URLs to context menu |
| 216 | QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", Qt::SkipEmptyParts); |
| 217 | bool actions_created = false; |
| 218 | for (int i = 0; i < listUrls.size(); ++i) |
| 219 | { |
| 220 | QString url = listUrls[i].trimmed(); |
| 221 | QString host = QUrl(url, QUrl::StrictMode).host(); |
| 222 | if (!host.isEmpty()) |
| 223 | { |
| 224 | if (!actions_created) { |
| 225 | contextMenu->addSeparator(); |
| 226 | actions_created = true; |
| 227 | } |
| 228 | /*: Transactions table context menu action to show the |
| 229 | selected transaction in a third-party block explorer. |
| 230 | %1 is a stand-in argument for the URL of the explorer. */ |
| 231 | contextMenu->addAction(tr("Show in %1").arg(host), [this, url] { openThirdPartyTxUrl(url); }); |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | void TransactionView::changeEvent(QEvent* e) |
| 239 | { |
no test coverage detected