Skip to content

Commit 666ef48

Browse files
author
Alexandre Van de Sande
committed
SideIcons work. Copy paste still doesn't.
1 parent 3068e26 commit 666ef48

File tree

3 files changed

+55
-13
lines changed

3 files changed

+55
-13
lines changed

cmd/mist/assets/ext/mist.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (c) 2015, ETHDEV. All rights reserved.
2+
//
3+
// This library is free software; you can redistribute it and/or
4+
// modify it under the terms of the GNU General Public
5+
// License as published by the Free Software Foundation; either
6+
// version 2.1 of the License, or (at your option) any later version.
7+
//
8+
// This library is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
// General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with this library; if not, write to the Free Software
15+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16+
// MA 02110-1301 USA
17+
18+
// this function is included locally, but you can also include separately via a header definition
19+
20+
console.log("loaded?");
21+
22+
document.onkeydown = function(evt) {
23+
evt = evt || window.event;
24+
if (evt.ctrlKey && evt.keyCode == 67) {
25+
window.document.execCommand("copy");
26+
console.log("Ctrl-C");
27+
} else if (evt.ctrlKey && evt.keyCode == 88) {
28+
window.document.execCommand("cut");
29+
console.log("Ctrl-X");
30+
} if (evt.ctrlKey && evt.keyCode == 86) {
31+
console.log("Ctrl-V");
32+
} if (evt.ctrlKey && evt.keyCode == 90) {
33+
console.log("Ctrl-Z");
34+
}
35+
};

cmd/mist/assets/qml/views/browser.qml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import QtQuick.Controls 1.0;
33
import QtQuick.Controls.Styles 1.0
44
import QtQuick.Layouts 1.0;
55
import QtWebEngine 1.0
6-
import QtWebEngine.experimental 1.0
6+
//import QtWebEngine.experimental 1.0
77
import QtQuick.Window 2.0;
88

99
Rectangle {
@@ -340,8 +340,8 @@ Rectangle {
340340
WebEngineView {
341341
objectName: "webView"
342342
id: webview
343-
experimental.settings.javascriptCanAccessClipboard: true
344-
experimental.settings.localContentCanAccessRemoteUrls: true
343+
//experimental.settings.javascriptCanAccessClipboard: true
344+
//experimental.settings.localContentCanAccessRemoteUrls: true
345345
anchors {
346346
left: parent.left
347347
right: parent.right
@@ -367,7 +367,12 @@ Rectangle {
367367
menuItem.title = pageTitle;
368368
});
369369

370-
370+
webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){
371+
if(sideIcon){
372+
menuItem.icon = "http://localhost:3000/[email protected]"
373+
};
374+
});
375+
371376
webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){
372377
if (!topBarStyle) {
373378
showFullUrlBar(true);
@@ -397,15 +402,9 @@ Rectangle {
397402
};
398403
});
399404

400-
// webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){
401-
// if(sideIcon){
402-
// window.iconSource = "http://localhost:3000/[email protected]" //webview.url + sideIcon
403-
// console.log(iconSource)
404-
// };
405-
// });
406-
405+
407406
webview.runJavaScript(eth.readFile("bignumber.min.js"));
408-
webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js"));
407+
webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js"));
409408

410409
var cleanTitle = webview.url.toString()
411410
var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);

cmd/mist/assets/qml/views/catalog.qml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Rectangle {
8585
property var domain: "ethereum-dapp-catalog.meteor.com"
8686
url: protocol + domain
8787

88-
88+
//experimental.settings.javascriptCanAccessClipboard: true
8989

9090

9191
onJavaScriptConsoleMessage: {
@@ -112,10 +112,18 @@ Rectangle {
112112

113113
}
114114
}
115+
// onLoadingChanged: {
116+
// if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
117+
// webview.runJavaScript(eth.readFile("mist.js"));
118+
// }
119+
// }
115120
}
116121

117122

118123

124+
125+
126+
119127
WebEngineView {
120128
id: inspector
121129
visible: false

0 commit comments

Comments
 (0)