| 207 | } |
| 208 | |
| 209 | void TransactionView::setModel(WalletModel *_model) |
| 210 | { |
| 211 | this->model = _model; |
| 212 | if(_model) |
| 213 | { |
| 214 | transactionProxyModel = new TransactionFilterProxy(this); |
| 215 | transactionProxyModel->setSourceModel(_model->getTransactionTableModel()); |
| 216 | transactionProxyModel->setDynamicSortFilter(true); |
| 217 | transactionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); |
| 218 | transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
| 219 | transactionProxyModel->setSortRole(Qt::EditRole); |
| 220 | transactionView->setModel(transactionProxyModel); |
| 221 | transactionView->sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder); |
| 222 | |
| 223 | if (_model->getOptionsModel()) |
| 224 | { |
| 225 | // Add third party transaction URLs to context menu |
| 226 | QStringList listUrls = GUIUtil::SplitSkipEmptyParts(_model->getOptionsModel()->getThirdPartyTxUrls(), "|"); |
| 227 | bool actions_created = false; |
| 228 | for (int i = 0; i < listUrls.size(); ++i) |
| 229 | { |
| 230 | QString url = listUrls[i].trimmed(); |
| 231 | QString host = QUrl(url, QUrl::StrictMode).host(); |
| 232 | if (!host.isEmpty()) |
| 233 | { |
| 234 | if (!actions_created) { |
| 235 | contextMenu->addSeparator(); |
| 236 | actions_created = true; |
| 237 | } |
| 238 | /*: Transactions table context menu action to show the |
| 239 | selected transaction in a third-party block explorer. |
| 240 | %1 is a stand-in argument for the URL of the explorer. */ |
| 241 | contextMenu->addAction(tr("Show in %1").arg(host), [this, url] { openThirdPartyTxUrl(url); }); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | // show/hide column Watch-only |
| 247 | updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); |
| 248 | |
| 249 | // Watch-only signal |
| 250 | connect(_model, &WalletModel::notifyWatchonlyChanged, this, &TransactionView::updateWatchOnlyColumn); |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | void TransactionView::changeEvent(QEvent* e) |
| 255 | { |
no test coverage detected