mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-24 03:25:55 +00:00
Ask for password in wallet is password protected. closes #26
This commit is contained in:
parent
6f1343aaa0
commit
c1269301f7
7 changed files with 138 additions and 29 deletions
|
@ -27,6 +27,7 @@
|
||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
import "components"
|
import "components"
|
||||||
import "pages"
|
import "pages"
|
||||||
|
|
||||||
|
@ -167,5 +168,12 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// indicate disabled state
|
||||||
|
Desaturate {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: parent
|
||||||
|
desaturation: root.enabled ? 0.0 : 1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
import "components"
|
import "components"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -355,4 +356,12 @@ Rectangle {
|
||||||
connected: false
|
connected: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// indicate disabled state
|
||||||
|
Desaturate {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: parent
|
||||||
|
desaturation: panel.enabled ? 0.0 : 1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,10 @@
|
||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: root
|
||||||
color: "#F0EEEE"
|
color: "#F0EEEE"
|
||||||
signal paymentClicked(string address, string paymentId, double amount, int mixinCount, int priority)
|
signal paymentClicked(string address, string paymentId, double amount, int mixinCount, int priority)
|
||||||
signal generatePaymentIdInvoked()
|
signal generatePaymentIdInvoked()
|
||||||
|
@ -116,4 +118,11 @@ Rectangle {
|
||||||
height: 1
|
height: 1
|
||||||
color: "#DBDBDB"
|
color: "#DBDBDB"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// indicate disabled state
|
||||||
|
Desaturate {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: parent
|
||||||
|
desaturation: root.enabled ? 0.0 : 1.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,13 @@
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.2
|
||||||
import QtQuick.Controls.Styles 1.2
|
import QtQuick.Controls.Styles 1.2
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
import "tabs"
|
import "tabs"
|
||||||
import "components"
|
import "components"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: root
|
||||||
width: 330
|
width: 330
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
|
|
||||||
|
@ -145,4 +148,11 @@ Rectangle {
|
||||||
width: 1
|
width: 1
|
||||||
color: "#DBDBDB"
|
color: "#DBDBDB"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// indicate disabled state
|
||||||
|
Desaturate {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: parent
|
||||||
|
desaturation: root.enabled ? 0.0 : 1.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,40 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
Item {
|
// import "../components"
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
id: root
|
||||||
|
readonly property alias password: passwordInput.text
|
||||||
|
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
||||||
|
ColumnLayout {
|
||||||
|
id: column
|
||||||
|
height: 40
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr("Please enter wallet password")
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id : passwordInput
|
||||||
|
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
focus: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 24
|
||||||
|
style: TextFieldStyle {
|
||||||
|
passwordCharacter: "•"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
81
main.qml
81
main.qml
|
@ -41,7 +41,8 @@ import "wizard"
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: appWindow
|
id: appWindow
|
||||||
objectName: "appWindow"
|
|
||||||
|
|
||||||
property var currentItem
|
property var currentItem
|
||||||
property bool whatIsEnable: false
|
property bool whatIsEnable: false
|
||||||
property bool ctrlPressed: false
|
property bool ctrlPressed: false
|
||||||
|
@ -50,6 +51,8 @@ ApplicationWindow {
|
||||||
property alias persistentSettings : persistentSettings
|
property alias persistentSettings : persistentSettings
|
||||||
property var wallet;
|
property var wallet;
|
||||||
property var transaction;
|
property var transaction;
|
||||||
|
property alias password : passwordDialog.password
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function altKeyReleased() { ctrlPressed = false; }
|
function altKeyReleased() { ctrlPressed = false; }
|
||||||
|
@ -98,24 +101,24 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mousePressed(obj, mouseX, mouseY) {
|
function mousePressed(obj, mouseX, mouseY) {
|
||||||
if(obj.objectName === "appWindow")
|
// if(obj.objectName === "appWindow")
|
||||||
obj = rootItem
|
// obj = rootItem
|
||||||
|
|
||||||
var tmp = rootItem.mapFromItem(obj, mouseX, mouseY)
|
// var tmp = rootItem.mapFromItem(obj, mouseX, mouseY)
|
||||||
if(tmp !== undefined) {
|
// if(tmp !== undefined) {
|
||||||
mouseX = tmp.x
|
// mouseX = tmp.x
|
||||||
mouseY = tmp.y
|
// mouseY = tmp.y
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(currentItem !== undefined) {
|
// if(currentItem !== undefined) {
|
||||||
var tmp_x = rootItem.mapToItem(currentItem, mouseX, mouseY).x
|
// var tmp_x = rootItem.mapToItem(currentItem, mouseX, mouseY).x
|
||||||
var tmp_y = rootItem.mapToItem(currentItem, mouseX, mouseY).y
|
// var tmp_y = rootItem.mapToItem(currentItem, mouseX, mouseY).y
|
||||||
|
|
||||||
if(!currentItem.containsPoint(tmp_x, tmp_y)) {
|
// if(!currentItem.containsPoint(tmp_x, tmp_y)) {
|
||||||
currentItem.hide()
|
// currentItem.hide()
|
||||||
currentItem = undefined
|
// currentItem = undefined
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseReleased(obj, mouseX, mouseY) {
|
function mouseReleased(obj, mouseX, mouseY) {
|
||||||
|
@ -142,17 +145,18 @@ ApplicationWindow {
|
||||||
var wallet_path = walletPath();
|
var wallet_path = walletPath();
|
||||||
|
|
||||||
console.log("opening wallet at: ", wallet_path);
|
console.log("opening wallet at: ", wallet_path);
|
||||||
// TODO: wallet password dialog
|
wallet = walletManager.openWallet(wallet_path, appWindow.password,
|
||||||
wallet = walletManager.openWallet(wallet_path, "", persistentSettings.testnet);
|
persistentSettings.testnet);
|
||||||
|
|
||||||
|
|
||||||
if (wallet.status !== Wallet.Status_Ok) {
|
if (wallet.status !== Wallet.Status_Ok) {
|
||||||
console.error("Error opening wallet with empty password: ", wallet.errorString);
|
console.error("Error opening wallet with empty password: ", wallet.errorString);
|
||||||
|
console.log("closing wallet...")
|
||||||
|
walletManager.closeWallet(wallet)
|
||||||
|
console.log("wallet closed")
|
||||||
// try to open wallet with password;
|
// try to open wallet with password;
|
||||||
passwordDialog.open();
|
passwordDialog.open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Wallet opened successfully: ", wallet.errorString);
|
console.log("Wallet opened successfully: ", wallet.errorString);
|
||||||
}
|
}
|
||||||
// subscribing for wallet updates
|
// subscribing for wallet updates
|
||||||
|
@ -195,6 +199,8 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// called on "transfer"
|
// called on "transfer"
|
||||||
function handlePayment(address, paymentId, amount, mixinCount, priority) {
|
function handlePayment(address, paymentId, amount, mixinCount, priority) {
|
||||||
console.log("Creating transaction: ")
|
console.log("Creating transaction: ")
|
||||||
|
@ -213,6 +219,7 @@ ApplicationWindow {
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||||
informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString
|
informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString
|
||||||
informationPopup.icon = StandardIcon.Critical
|
informationPopup.icon = StandardIcon.Critical
|
||||||
|
informationPopup.onCloseCallback = null
|
||||||
informationPopup.open();
|
informationPopup.open();
|
||||||
// deleting transaction object, we don't want memleaks
|
// deleting transaction object, we don't want memleaks
|
||||||
wallet.disposeTransaction(transaction);
|
wallet.disposeTransaction(transaction);
|
||||||
|
@ -248,13 +255,22 @@ ApplicationWindow {
|
||||||
informationPopup.text = qsTr("Money sent successfully") + translationManager.emptyString
|
informationPopup.text = qsTr("Money sent successfully") + translationManager.emptyString
|
||||||
informationPopup.icon = StandardIcon.Information
|
informationPopup.icon = StandardIcon.Information
|
||||||
}
|
}
|
||||||
|
informationPopup.onCloseCallback = null
|
||||||
informationPopup.open()
|
informationPopup.open()
|
||||||
wallet.refresh()
|
wallet.refresh()
|
||||||
wallet.disposeTransaction(transaction)
|
wallet.disposeTransaction(transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// blocks UI if wallet can't be opened or no connection to the daemon
|
||||||
|
function enableUI(enable) {
|
||||||
|
middlePanel.enabled = enable;
|
||||||
|
leftPanel.enabled = enable;
|
||||||
|
rightPanel.enabled = enable;
|
||||||
|
basicPanel.enabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
objectName: "appWindow"
|
||||||
visible: true
|
visible: true
|
||||||
width: rightPanelExpanded ? 1269 : 1269 - 300
|
width: rightPanelExpanded ? 1269 : 1269 - 300
|
||||||
height: 800
|
height: 800
|
||||||
|
@ -262,6 +278,7 @@ ApplicationWindow {
|
||||||
flags: Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint
|
flags: Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint
|
||||||
onWidthChanged: x -= 0
|
onWidthChanged: x -= 0
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
x = (Screen.width - width) / 2
|
x = (Screen.width - width) / 2
|
||||||
y = (Screen.height - height) / 2
|
y = (Screen.height - height) / 2
|
||||||
|
@ -278,6 +295,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
id: persistentSettings
|
id: persistentSettings
|
||||||
property string language
|
property string language
|
||||||
|
@ -296,9 +314,15 @@ ApplicationWindow {
|
||||||
|
|
||||||
// Information dialog
|
// Information dialog
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
|
// dynamically change onclose handler
|
||||||
|
property var onCloseCallback
|
||||||
id: informationPopup
|
id: informationPopup
|
||||||
|
|
||||||
standardButtons: StandardButton.Ok
|
standardButtons: StandardButton.Ok
|
||||||
|
onAccepted: {
|
||||||
|
if (onCloseCallback) {
|
||||||
|
onCloseCallback()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confrirmation aka question dialog
|
// Confrirmation aka question dialog
|
||||||
|
@ -317,6 +341,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
var wallet_path = walletPath();
|
var wallet_path = walletPath();
|
||||||
console.log("opening wallet with password: ", wallet_path);
|
console.log("opening wallet with password: ", wallet_path);
|
||||||
|
|
||||||
wallet = walletManager.openWallet(wallet_path, password, persistentSettings.testnet);
|
wallet = walletManager.openWallet(wallet_path, password, persistentSettings.testnet);
|
||||||
if (wallet.status !== Wallet.Status_Ok) {
|
if (wallet.status !== Wallet.Status_Ok) {
|
||||||
console.error("Error opening wallet with password: ", wallet.errorString);
|
console.error("Error opening wallet with password: ", wallet.errorString);
|
||||||
|
@ -324,9 +349,16 @@ ApplicationWindow {
|
||||||
informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
|
informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
|
||||||
informationPopup.icon = StandardIcon.Critical
|
informationPopup.icon = StandardIcon.Critical
|
||||||
informationPopup.open()
|
informationPopup.open()
|
||||||
|
informationPopup.onCloseCallback = appWindow.initialize
|
||||||
|
walletManager.closeWallet(wallet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onRejected: {
|
||||||
|
appWindow.enableUI(false)
|
||||||
|
}
|
||||||
|
onDiscard: {
|
||||||
|
appWindow.enableUI(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
|
@ -339,7 +371,6 @@ ApplicationWindow {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
text: qsTr("Initializing Wallet...");
|
text: qsTr("Initializing Wallet...");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,8 @@ isEmpty(QMAKE_LRELEASE) {
|
||||||
langupd.command = \
|
langupd.command = \
|
||||||
$$LANGUPD $$LANGUPD_OPTIONS $$shell_path($$_PRO_FILE) -ts $$_PRO_FILE_PWD/$$TRANSLATIONS
|
$$LANGUPD $$LANGUPD_OPTIONS $$shell_path($$_PRO_FILE) -ts $$_PRO_FILE_PWD/$$TRANSLATIONS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
langrel.depends = langupd
|
langrel.depends = langupd
|
||||||
langrel.input = TRANSLATIONS
|
langrel.input = TRANSLATIONS
|
||||||
langrel.output = $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm
|
langrel.output = $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm
|
||||||
|
@ -157,7 +159,12 @@ QMAKE_EXTRA_TARGETS += langupd deploy deploy_win
|
||||||
QMAKE_EXTRA_COMPILERS += langrel
|
QMAKE_EXTRA_COMPILERS += langrel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# temporary: do not update/release translations for "Debug" build,
|
||||||
|
# as we have an issue with linking
|
||||||
|
CONFIG(release, debug|release) {
|
||||||
PRE_TARGETDEPS += langupd compiler_langrel_make_all
|
PRE_TARGETDEPS += langupd compiler_langrel_make_all
|
||||||
|
}
|
||||||
|
|
||||||
RESOURCES += qml.qrc
|
RESOURCES += qml.qrc
|
||||||
|
|
||||||
|
@ -182,8 +189,8 @@ OTHER_FILES += \
|
||||||
$$TRANSLATIONS
|
$$TRANSLATIONS
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
notes.txt \
|
notes.txt
|
||||||
components/PasswordDialog.qml
|
|
||||||
|
|
||||||
# windows application icon
|
# windows application icon
|
||||||
RC_FILE = monero-core.rc
|
RC_FILE = monero-core.rc
|
||||||
|
|
Loading…
Reference in a new issue