#include <QDesktopServices>
#include <QSignalMapper>
#include <QUrl>
+#include <QEventLoop>
TransactionView::TransactionView(QWidget *parent) :
QWidget(parent), model(0), transactionProxyModel(0),
connect(clearOrphansAction, SIGNAL(triggered()), this, SLOT(clearOrphans()));
}
-void TransactionView::setModel(WalletModel *model)
+void TransactionView::setModel(WalletModel *model, bool fShoudAddThirdPartyURL)
{
this->model = model;
if(model)
transactionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
-// transactionProxyModel->setSortRole(Qt::EditRole);
- transactionProxyModel->setSortRole(TransactionTableModel::DateRole);
+ transactionProxyModel->setSortRole(Qt::EditRole);
+// transactionProxyModel->setSortRole(TransactionTableModel::DateRole);
transactionView->setModel(transactionProxyModel);
transactionView->setAlternatingRowColors(true);
transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch);
#endif
transactionView->horizontalHeader()->resizeSection(
- TransactionTableModel::Amount, 100);
+ TransactionTableModel::Amount, 130);
- if (model->getOptionsModel())
+ if (model->getOptionsModel() && fShoudAddThirdPartyURL)
{
// Add third party transaction URLs to context menu
QStringList listUrls = model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts);
break;
case LastMonth:
transactionProxyModel->setDateRange(
- QDateTime(QDate(current.year(), current.month()-1, 1)),
+ QDateTime(QDate(current.year(), current.month(), 1).addMonths(-1)),
QDateTime(QDate(current.year(), current.month(), 1)));
break;
case ThisYear:
if(!selection.isEmpty())
{
TransactionDescDialog dlg(selection.at(0));
- dlg.exec();
+ dlg.setWindowModality(Qt::ApplicationModal);
+ dlg.show();
+
+ // This loop will wait for the window is closed
+ QEventLoop loop;
+ connect(&dlg, SIGNAL(stopExec()), &loop, SLOT(quit()));
+ loop.exec();
}
}
model->clearOrphans();
model->getTransactionTableModel()->refresh();
delete transactionProxyModel;
- setModel(model);
+ setModel(model, false);
transactionView->sortByColumn(TransactionTableModel::Status, Qt::DescendingOrder);
transactionView->sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder);
}