#include <QString>
#include <QTreeWidget>
#include <QTreeWidgetItem>
+#include <QKeyEvent>
using namespace std;
QList<qint64> CoinControlDialog::payAmounts;
CCoinControl* CoinControlDialog::coinControl = new CCoinControl();
CoinControlDialog::CoinControlDialog(QWidget *parent) :
- QDialog(parent, DIALOGWINDOWHINTS),
+ QWidget(parent, DIALOGWINDOWHINTS),
ui(new Ui::CoinControlDialog),
model(0)
{
}
// ok button
-void CoinControlDialog::buttonBoxClicked(QAbstractButton* button)
+void CoinControlDialog::on_buttonBox_accepted()
{
- if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
- done(QDialog::Accepted); // closes the dialog
+ close(); // closes the dialog
}
// (un)select all
else ui->labelLocked->setVisible(false);
}*/
-void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
+void CoinControlDialog::updateLabels(WalletModel *model, QWidget* dialog)
{
if (!model) return;
sortView(sortColumn, sortOrder);
ui->treeWidget->setEnabled(true);
}
+
+void CoinControlDialog::keyPressEvent(QKeyEvent *event)
+{
+#ifdef ANDROID
+ if(event->key() == Qt::Key_Back)
+ {
+ close();
+ }
+#else
+ if(event->key() == Qt::Key_Escape)
+ {
+ close();
+ }
+#endif
+}
\ No newline at end of file
#include <QAbstractButton>
#include <QAction>
-#include <QDialog>
+#include <QWidget>
#include <QList>
#include <QMenu>
#include <QPoint>
class WalletModel;
class CCoinControl;
-class CoinControlDialog : public QDialog
+class CoinControlDialog : public QWidget
{
Q_OBJECT
void setModel(WalletModel *model);
// static because also called from sendcoinsdialog
- static void updateLabels(WalletModel*, QDialog*);
+ static void updateLabels(WalletModel*, QWidget*);
static QString getPriorityLabel(double);
static QList<qint64> payAmounts;
void sortView(int, Qt::SortOrder);
void updateView();
+ void keyPressEvent(QKeyEvent *);
+
enum
{
COLUMN_CHECKBOX,
void radioListMode(bool);
void viewItemChanged(QTreeWidgetItem*, int);
void headerSectionClicked(int);
- void buttonBoxClicked(QAbstractButton*);
+ void on_buttonBox_accepted();
void buttonSelectAllClicked();
//void updateLabelLocked();
};
if(this->currentItem())
this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked));
}
+#ifdef ANDROID
+ else if (event->key() == Qt::Key_Back) // press back -> close dialog
+#else
else if (event->key() == Qt::Key_Escape) // press esc -> close dialog
+#endif
{
event->ignore();
CoinControlDialog *coinControlDialog = (CoinControlDialog*)this->parentWidget();
- coinControlDialog->done(QDialog::Accepted);
+ coinControlDialog->close();
}
else
{
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CoinControlDialog</class>
- <widget class="QDialog" name="CoinControlDialog">
+ <widget class="QWidget" name="CoinControlDialog">
<property name="geometry">
<rect>
<x>0</x>
SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
QDialog(parent, DIALOGWINDOWHINTS),
ui(new Ui::SendCoinsDialog),
- model(0)
+ model(0),
+ coinControl(0)
{
ui->setupUi(this);
ui->labelCoinControlChange->addAction(clipboardChangeAction);
fNewRecipientAllowed = true;
+
+ coinControl = new CoinControlDialog(0);
+ QAction *updateLabes = new QAction(coinControl);
+ connect(updateLabes, SIGNAL(close()), this, SLOT(coinControlUpdateLabels()));
}
void SendCoinsDialog::setModel(WalletModel *model)
SendCoinsDialog::~SendCoinsDialog()
{
+ delete coinControl;
delete ui;
}
// Coin Control: button inputs -> show actual coin control dialog
void SendCoinsDialog::coinControlButtonClicked()
{
- CoinControlDialog dlg;
- dlg.setModel(model);
- dlg.exec();
- coinControlUpdateLabels();
+ coinControl->setModel(model);
+ coinControl->setWindowModality(Qt::ApplicationModal);
+ coinControl->show();
}
// Coin Control: checkbox custom change address
class WalletModel;
class SendCoinsEntry;
class SendCoinsRecipient;
+class CoinControlDialog;
QT_BEGIN_NAMESPACE
class QUrl;
Ui::SendCoinsDialog *ui;
WalletModel *model;
bool fNewRecipientAllowed;
+ CoinControlDialog *coinControl;
private slots:
void on_sendButton_clicked();