Skip to content

Commit

Permalink
metadexcanceldialog - add wallet model
Browse files Browse the repository at this point in the history
  • Loading branch information
zathras-crypto committed Apr 13, 2015
1 parent 3dc13cc commit b14074f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/qt/metadexcanceldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "guiutil.h"
#include "optionsmodel.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "wallet.h"
#include "base58.h"
#include "coincontrol.h"
Expand Down Expand Up @@ -68,7 +69,8 @@ using namespace leveldb;
MetaDExCancelDialog::MetaDExCancelDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::MetaDExCancelDialog),
clientModel(0)
clientModel(0),
walletModel(0)
{
ui->setupUi(this);

Expand All @@ -84,9 +86,6 @@ MetaDExCancelDialog::MetaDExCancelDialog(QWidget *parent) :

/**
* Sets the client model.
*
* Note: for metadex cancels we only need to know when the Omni state has been refreshed
* so only the client model (instead of both client and wallet models) is needed.
*/
void MetaDExCancelDialog::setClientModel(ClientModel *model)
{
Expand All @@ -96,6 +95,14 @@ void MetaDExCancelDialog::setClientModel(ClientModel *model)
}
}

/**
* Sets the wallet model.
*/
void MetaDExCancelDialog::setWalletModel(WalletModel *model)
{
if (model != NULL) this->walletModel = model;
}

/**
* Refreshes the cancellation address selector
*
Expand Down Expand Up @@ -332,7 +339,6 @@ void MetaDExCancelDialog::SendCancelTransaction()
return;
}

/* #REIMPLEMENT WALLETMODEL#
// unlock the wallet
WalletModel::UnlockContext ctx(walletModel->requestUnlock());
if(!ctx.isValid())
Expand All @@ -342,7 +348,6 @@ void MetaDExCancelDialog::SendCancelTransaction()
"The MetaDEx cancel transaction has been aborted.\n\nThe wallet unlock process must be completed to send a transaction." );
return;
}
*/

// create a payload for the transaction
// #CLASSC# std::vector<unsigned char> payload = CreatePayload_MetaDExTrade(propertyIdForSale, amountForSale, propertyIdDesired, amountDesired, action);
Expand Down
4 changes: 4 additions & 0 deletions src/qt/metadexcanceldialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define METADEXCANCELDIALOG_H

#include "clientmodel.h"
#include "walletmodel.h"

#include <QDialog>
#include <QString>
Expand All @@ -31,6 +32,8 @@ class MetaDExCancelDialog : public QDialog
explicit MetaDExCancelDialog(QWidget *parent = 0);

void setClientModel(ClientModel *model);
void setWalletModel(WalletModel *model);

/** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907).
*/
QWidget *setupTabChain(QWidget *prev);
Expand All @@ -50,6 +53,7 @@ public slots:
private:
Ui::MetaDExCancelDialog *ui;
ClientModel *clientModel;
WalletModel *walletModel;

private slots:

Expand Down
1 change: 1 addition & 0 deletions src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ void WalletView::setWalletModel(WalletModel *walletModel)
metaDExTab->setModel(walletModel);
mpTXTab->setWalletModel(walletModel);
orderHistoryTab->setModel(walletModel);
cancelTab->setWalletModel(walletModel);

if (walletModel)
{
Expand Down

0 comments on commit b14074f

Please sign in to comment.