diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-02-20 05:36:35 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-02-20 05:36:35 +0800 |
commit | 07c34751da96e3daa023b028494ef1c86cf6d1fc (patch) | |
tree | 9ae6e648b6f24d402205fb80f81026fa826e61e7 /cmd | |
parent | 4322632c5924ef9aaaad1cdcdfa2f796c493cf69 (diff) | |
parent | acd93c29711f18787ec3392751f57ffe08b5df28 (diff) | |
download | dexon-07c34751da96e3daa023b028494ef1c86cf6d1fc.tar dexon-07c34751da96e3daa023b028494ef1c86cf6d1fc.tar.gz dexon-07c34751da96e3daa023b028494ef1c86cf6d1fc.tar.bz2 dexon-07c34751da96e3daa023b028494ef1c86cf6d1fc.tar.lz dexon-07c34751da96e3daa023b028494ef1c86cf6d1fc.tar.xz dexon-07c34751da96e3daa023b028494ef1c86cf6d1fc.tar.zst dexon-07c34751da96e3daa023b028494ef1c86cf6d1fc.zip |
Merge pull request #335 from alexvandesande/ui
Cut, Copy, Undo and Redo working in webview
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/mist/assets/ext/mist.js | 14 | ||||
-rw-r--r-- | cmd/mist/assets/qml/main.qml | 6 | ||||
-rw-r--r-- | cmd/mist/assets/qml/views/browser.qml | 10 | ||||
-rw-r--r-- | cmd/mist/assets/qml/views/catalog.qml | 19 |
4 files changed, 26 insertions, 23 deletions
diff --git a/cmd/mist/assets/ext/mist.js b/cmd/mist/assets/ext/mist.js index 8734f8dc7..2fc38cdfa 100644 --- a/cmd/mist/assets/ext/mist.js +++ b/cmd/mist/assets/ext/mist.js @@ -20,16 +20,18 @@ console.log("loaded?"); document.onkeydown = function(evt) { + // This functions keeps track of keyboard inputs in order to allow copy, paste and other features + evt = evt || window.event; if (evt.ctrlKey && evt.keyCode == 67) { window.document.execCommand("copy"); - console.log("Ctrl-C"); } else if (evt.ctrlKey && evt.keyCode == 88) { window.document.execCommand("cut"); - console.log("Ctrl-X"); - } if (evt.ctrlKey && evt.keyCode == 86) { - console.log("Ctrl-V"); - } if (evt.ctrlKey && evt.keyCode == 90) { - console.log("Ctrl-Z"); + } else if (evt.ctrlKey && evt.keyCode == 86) { + window.document.execCommand("paste"); + } else if (evt.ctrlKey && evt.keyCode == 90) { + window.document.execCommand("undo"); + } else if (evt.ctrlKey && evt.shiftKey && evt.keyCode == 90) { + window.document.execCommand("redo"); } };
\ No newline at end of file diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index f9bfd9b8d..65f38f8bd 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -131,7 +131,11 @@ ApplicationWindow { var existingDomain = matches && matches[1]; if (requestedDomain == existingDomain) { domainAlreadyOpen = true; - mainSplit.views[i].view.url = url; + + if (mainSplit.views[i].view.url != url){ + mainSplit.views[i].view.url = url; + } + activeView(mainSplit.views[i].view, mainSplit.views[i].menuItem); } } diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 54f5d755e..edecc8696 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 1.0; import QtQuick.Controls.Styles 1.0 import QtQuick.Layouts 1.0; import QtWebEngine 1.0 -//import QtWebEngine.experimental 1.0 +import QtWebEngine.experimental 1.0 import QtQuick.Window 2.0; Rectangle { @@ -340,7 +340,7 @@ Rectangle { WebEngineView { objectName: "webView" id: webview - //experimental.settings.javascriptCanAccessClipboard: true + experimental.settings.javascriptCanAccessClipboard: true //experimental.settings.localContentCanAccessRemoteUrls: true anchors { left: parent.left @@ -399,7 +399,8 @@ Rectangle { onLoadingChanged: { if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - webview.runJavaScript("document.title", function(pageTitle) { + + webview.runJavaScript("document.title", function(pageTitle) { menuItem.title = pageTitle; }); @@ -441,7 +442,8 @@ Rectangle { webview.runJavaScript(eth.readFile("bignumber.min.js")); webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); - + webview.runJavaScript(eth.readFile("mist.js")); + var cleanTitle = webview.url.toString() var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var domain = matches && matches[1]; diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index 497d69ed1..29e133074 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 1.0; import QtQuick.Controls.Styles 1.0 import QtQuick.Layouts 1.0; import QtWebEngine 1.0 -//import QtWebEngine.experimental 1.0 +import QtWebEngine.experimental 1.0 import QtQuick.Window 2.0; @@ -21,8 +21,6 @@ Rectangle { property alias windowTitle: webview.title property alias webView: webview - - property var cleanPath: false property var open: function(url) { if(!window.cleanPath) { @@ -66,9 +64,6 @@ Rectangle { } } - Component.onCompleted: { - } - Item { objectName: "root" id: root @@ -85,7 +80,7 @@ Rectangle { property var domain: "ethereum-dapp-catalog.meteor.com" url: protocol + domain - //experimental.settings.javascriptCanAccessClipboard: true + experimental.settings.javascriptCanAccessClipboard: true onJavaScriptConsoleMessage: { @@ -112,11 +107,11 @@ Rectangle { } } - // onLoadingChanged: { - // if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - // webview.runJavaScript(eth.readFile("mist.js")); - // } - // } + onLoadingChanged: { + if (loadRequest.status == WebEngineView.LoadSucceededStatus) { + webview.runJavaScript(eth.readFile("mist.js")); + } + } } |