From bbaae925bf169967c028d555556254e399322e4a Mon Sep 17 00:00:00 2001 From: "littletux89@gmail.com" <littletux89@gmail.com> Date: Mon, 8 Jul 2019 21:24:21 +0300 Subject: [PATCH] [*] Fixed deleting wallet. --- KelvinDashboardGUI/DapChainWalletsModel.cpp | 2 +- KelvinDashboardGUI/DapServiceController.cpp | 1 + .../DapUiQmlScreenDialogRemoveWallet.qml | 24 +------------------ .../DapUiQmlWidgetChainWallet.qml | 1 - 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/KelvinDashboardGUI/DapChainWalletsModel.cpp b/KelvinDashboardGUI/DapChainWalletsModel.cpp index 8c348c790..ad72f4ef7 100755 --- a/KelvinDashboardGUI/DapChainWalletsModel.cpp +++ b/KelvinDashboardGUI/DapChainWalletsModel.cpp @@ -49,7 +49,7 @@ QHash<int, QByteArray> DapChainWalletsModel::roleNames() const QVariantMap DapChainWalletsModel::get(int row) const { - if (m_dapChainWallets.count() == 0) { + if (m_dapChainWallets.count() == 0 || m_dapChainWallets.count() == row) { return { {"iconPath", ""}, {"name", ""}, {"address", ""}, {"balance", ""}, {"tokens", QStringList()}, {"count", 0} }; } const DapChainWallet *wallet = m_dapChainWallets.value(row); diff --git a/KelvinDashboardGUI/DapServiceController.cpp b/KelvinDashboardGUI/DapServiceController.cpp index 3d2d94ab7..2dfa49881 100755 --- a/KelvinDashboardGUI/DapServiceController.cpp +++ b/KelvinDashboardGUI/DapServiceController.cpp @@ -125,6 +125,7 @@ void DapServiceController::removeWallet(int index, const QString &asWalletName) qInfo() << QString("removeWallet(%1)").arg(index); qInfo() << QString("removeWallet(%1)").arg(asWalletName); m_pDapCommandController->removeWallet(asWalletName.trimmed()); + DapChainWalletsModel::getInstance().remove(index); } void DapServiceController::sendToken(const QString &asSendWallet, const QString &asAddressReceiver, const QString &asToken, const QString &aAmount) diff --git a/KelvinDashboardGUI/DapUiQmlScreenDialogRemoveWallet.qml b/KelvinDashboardGUI/DapUiQmlScreenDialogRemoveWallet.qml index 4c9e477b8..34bdebe22 100644 --- a/KelvinDashboardGUI/DapUiQmlScreenDialogRemoveWallet.qml +++ b/KelvinDashboardGUI/DapUiQmlScreenDialogRemoveWallet.qml @@ -26,23 +26,6 @@ Dialog { { anchors.fill: parent -// Text { -// id: textWalletName -// text: qsTr(listViewWallet.model.get(listViewWallet.currentIndex < 0 ? 0 : listViewWallet.currentIndex).name) -// verticalAlignment: Text.AlignVCenter -// horizontalAlignment: Text.AlignHCenter - -// height: 35 -// anchors.bottom: textQuery.top -// anchors.bottomMargin: 20 -// anchors.right: parent.right -// anchors.rightMargin: 10 -// anchors.left: parent.left -// anchors.leftMargin: 10 -// font.pixelSize: 20 -// clip: true -// } - TextEdit { @@ -124,12 +107,7 @@ Dialog { onClicked: { - console.log("COUNT " + listViewWallet.model.count) - console.log("INDEX " + dapQmlWidgetChainWallet.indexWallet + " " + dapQmlWidgetChainWallet.nameWallet) - -// listViewWallet.model.remove(dapQmlWidgetChainWallet.indexWallet) -// dapServiceController.removeWallet(dapQmlWidgetChainWallet.indexWallet, dapQmlWidgetChainWallet.nameWallet) -// console.log("INDEX " + dapQmlWidgetChainWallet.indexWallet + " " + dapQmlWidgetChainWallet.nameWallet) + dapServiceController.removeWallet(dapQmlWidgetChainWallet.indexWallet, dapQmlWidgetChainWallet.nameWallet) close() } } diff --git a/KelvinDashboardGUI/DapUiQmlWidgetChainWallet.qml b/KelvinDashboardGUI/DapUiQmlWidgetChainWallet.qml index fc8a26317..ed93ce869 100755 --- a/KelvinDashboardGUI/DapUiQmlWidgetChainWallet.qml +++ b/KelvinDashboardGUI/DapUiQmlWidgetChainWallet.qml @@ -41,7 +41,6 @@ DapUiQmlWidgetChainWalletForm { { indexWallet = listViewWallet.currentIndex nameWallet = listViewWallet.model.get(listViewWallet.currentIndex).name - console.log("++++++" + indexWallet) } else { -- GitLab