| 201 | } |
| 202 | |
| 203 | void TransactionView::setModel(WalletModel *_model) |
| 204 | { |
| 205 | this->model = _model; |
| 206 | if(_model) |
| 207 | { |
| 208 | transactionProxyModel = new TransactionFilterProxy(this); |
| 209 | transactionProxyModel->setSourceModel(_model->getTransactionTableModel()); |
| 210 | transactionProxyModel->setDynamicSortFilter(true); |
| 211 | transactionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); |
| 212 | transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
| 213 | |
| 214 | transactionProxyModel->setSortRole(Qt::EditRole); |
| 215 | |
| 216 | transactionView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 217 | transactionView->setModel(transactionProxyModel); |
| 218 | transactionView->setAlternatingRowColors(true); |
| 219 | transactionView->setSelectionBehavior(QAbstractItemView::SelectRows); |
| 220 | transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection); |
| 221 | transactionView->setSortingEnabled(true); |
| 222 | transactionView->sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder); |
| 223 | transactionView->verticalHeader()->hide(); |
| 224 | |
| 225 | transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH); |
| 226 | transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH); |
| 227 | transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH); |
| 228 | transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH); |
| 229 | transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH); |
| 230 | |
| 231 | columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(transactionView, AMOUNT_MINIMUM_COLUMN_WIDTH, MINIMUM_COLUMN_WIDTH, this); |
| 232 | |
| 233 | if (_model->getOptionsModel()) |
| 234 | { |
| 235 | // Add third party transaction URLs to context menu |
| 236 | QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); |
| 237 | for (int i = 0; i < listUrls.size(); ++i) |
| 238 | { |
| 239 | QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); |
| 240 | if (!host.isEmpty()) |
| 241 | { |
| 242 | QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label |
| 243 | if (i == 0) |
| 244 | contextMenu->addSeparator(); |
| 245 | contextMenu->addAction(thirdPartyTxUrlAction); |
| 246 | connect(thirdPartyTxUrlAction, SIGNAL(triggered()), mapperThirdPartyTxUrls, SLOT(map())); |
| 247 | mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed()); |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | // show/hide column Watch-only |
| 253 | updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); |
| 254 | |
| 255 | // Watch-only signal |
| 256 | connect(_model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyColumn(bool))); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | void TransactionView::chooseDate(int idx) |
no test coverage detected