diff options
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/forms/receivecoinsdialog.ui | 6 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 23 | ||||
-rw-r--r-- | src/qt/optionsmodel.h | 3 | ||||
-rw-r--r-- | src/qt/receivecoinsdialog.cpp | 15 | ||||
-rw-r--r-- | src/qt/receivecoinsdialog.h | 2 | ||||
-rw-r--r-- | src/qt/sendcoinsentry.cpp | 6 |
6 files changed, 44 insertions, 11 deletions
diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui index 3e1a8bccc7..e1a0a28f81 100644 --- a/src/qt/forms/receivecoinsdialog.ui +++ b/src/qt/forms/receivecoinsdialog.ui @@ -263,6 +263,9 @@ <property name="text"> <string>Show</string> </property> + <property name="enabled"> + <bool>false</bool> + </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/edit</normaloff>:/icons/edit</iconset> @@ -277,6 +280,9 @@ <property name="text"> <string>Remove</string> </property> + <property name="enabled"> + <bool>false</bool> + </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 3b83a5ff62..b61fdd2301 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -30,6 +30,11 @@ OptionsModel::OptionsModel(QObject *parent) : Init(); } +void OptionsModel::addOverriddenOption(const std::string &option) +{ + strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(mapArgs[option]) + " "; +} + // Writes all missing QSettings with their default values void OptionsModel::Init() { @@ -76,23 +81,23 @@ void OptionsModel::Init() settings.setValue("nTransactionFee", 0); nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp if (mapArgs.count("-paytxfee")) - strOverriddenByCommandLine += "-paytxfee "; + addOverriddenOption("-paytxfee"); if (!settings.contains("bSpendZeroConfChange")) settings.setValue("bSpendZeroConfChange", true); if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool())) - strOverriddenByCommandLine += "-spendzeroconfchange "; + addOverriddenOption("-spendzeroconfchange"); #endif if (!settings.contains("nDatabaseCache")) settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache); if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString())) - strOverriddenByCommandLine += "-dbcache "; + addOverriddenOption("-dbcache"); if (!settings.contains("nThreadsScriptVerif")) settings.setValue("nThreadsScriptVerif", 0); if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString())) - strOverriddenByCommandLine += "-par "; + addOverriddenOption("-par"); // Network if (!settings.contains("fUseUPnP")) @@ -100,9 +105,9 @@ void OptionsModel::Init() settings.setValue("fUseUPnP", true); #else settings.setValue("fUseUPnP", false); -#endif +#endif if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) - strOverriddenByCommandLine += "-upnp "; + addOverriddenOption("-upnp"); if (!settings.contains("fUseProxy")) settings.setValue("fUseProxy", false); @@ -110,18 +115,18 @@ void OptionsModel::Init() settings.setValue("addrProxy", "127.0.0.1:9050"); // Only try to set -proxy, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString())) - strOverriddenByCommandLine += "-proxy "; + addOverriddenOption("-proxy"); if (!settings.contains("nSocksVersion")) settings.setValue("nSocksVersion", 5); // Only try to set -socks, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString())) - strOverriddenByCommandLine += "-socks "; + addOverriddenOption("-socks"); // Display if (!settings.contains("language")) settings.setValue("language", ""); if (!SoftSetArg("-lang", settings.value("language").toString().toStdString())) - strOverriddenByCommandLine += "-lang"; + addOverriddenOption("-lang"); language = settings.value("language").toString(); } diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index a3487ddd2e..ece5ef78a4 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -75,6 +75,9 @@ private: /* settings that were overriden by command-line */ QString strOverriddenByCommandLine; + /// Add option to list of GUI options overridden through command line/config file + void addOverriddenOption(const std::string &option); + signals: void displayUnitChanged(int unit); void transactionFeeChanged(qint64); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 7539645b47..2af3949ae4 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -19,6 +19,7 @@ #include <QMessageBox> #include <QTextDocument> #include <QScrollBar> +#include <QItemSelection> ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) : QDialog(parent), @@ -77,6 +78,11 @@ void ReceiveCoinsDialog::setModel(WalletModel *model) ui->recentRequestsView->horizontalHeader()->resizeSection(RecentRequestsTableModel::Amount, 100); model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder); + + connect(ui->recentRequestsView->selectionModel(), + SIGNAL(selectionChanged(QItemSelection, QItemSelection)), + this, + SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection))); } } @@ -161,6 +167,15 @@ void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex & dialog->show(); } +void ReceiveCoinsDialog::on_recentRequestsView_selectionChanged(const QItemSelection &selected, + const QItemSelection &deselected) +{ + // Enable Show/Remove buttons only if anything is selected. + bool enable = !ui->recentRequestsView->selectionModel()->selectedRows().isEmpty(); + ui->showRequestButton->setEnabled(enable); + ui->removeRequestButton->setEnabled(enable); +} + void ReceiveCoinsDialog::on_showRequestButton_clicked() { if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel()) diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index 12d2235782..bfe8b3401f 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -10,6 +10,7 @@ #include <QMenu> #include <QPoint> #include <QVariant> +#include <QItemSelection> namespace Ui { class ReceiveCoinsDialog; @@ -51,6 +52,7 @@ private slots: void on_showRequestButton_clicked(); void on_removeRequestButton_clicked(); void on_recentRequestsView_doubleClicked(const QModelIndex &index); + void on_recentRequestsView_selectionChanged(const QItemSelection &, const QItemSelection &); void updateDisplayUnit(); void showMenu(const QPoint &); void copyLabel(); diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index ad8dd7b732..e0f56f8cd2 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -195,8 +195,10 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value) ui->messageTextLabel->setVisible(!recipient.message.isEmpty()); ui->messageLabel->setVisible(!recipient.message.isEmpty()); - ui->payTo->setText(recipient.address); - ui->addAsLabel->setText(recipient.label); + ui->addAsLabel->clear(); + ui->payTo->setText(recipient.address); // this may set a label from addressbook + if (!recipient.label.isEmpty()) // if a label had been set from the addressbook, dont overwrite with an empty label + ui->addAsLabel->setText(recipient.label); ui->payAmount->setValue(recipient.amount); } } |