1import org.kde.falkon 1.0 as Falkon
2import QtQuick.Controls 2.3
5Falkon.PluginInterface {
9 property int clickCount: 0
10 signal clicked(
int count)
14 id: testingHelloQmlUserScript
15 name:
'testing-hello-qml'
16 runsOnSubFrames:
false
17 sourceCode: Falkon.FileUtils.readAllFileContents(
'script.js')
18 injectionPoint: Falkon.UserScript.DocumentReady
19 worldId: Falkon.UserScript.ApplicationWorld
22 init: function(
state, settingsPath){
23 console.log(
i18n(
'"Hello QML" plugin loaded'))
24 Falkon.ExternalJsObject.registerExtraObject({
26 object: helloQmlObject
30 testPlugin: function() {
35 console.log(
i18n(
'Bye!'))
39 Falkon.ExtensionScheme {
43 contentType:
'text/html',
44 content:
'<h1>Hello World</h1>'
49 Falkon.BrowserAction {
50 name:
'helloqml-button'
51 identity:
'helloqml-id'
52 title:
i18n(
'Testing QML Title')
53 toolTip:
i18n(
'Testing QML Tooltip')
54 icon:
'extensions.svg'
55 location: Falkon.BrowserAction.NavigationToolBar | Falkon.BrowserAction.StatusBar
57 property var borderMargin: 1
58 property var imageWidth: 256
59 property var imageHeight: 200
60 property var buttonHeight: 40
62 width: imageWidth + 2 * borderMargin
63 height: imageHeight + buttonHeight + 2 * borderMargin
67 anchors.leftMargin: borderMargin
68 anchors.rightMargin: borderMargin
69 anchors.topMargin: borderMargin
70 anchors.bottomMargin: borderMargin
74 source:
'qrc:/icons/other/startpage.svg'
75 anchors.left: parent.left
76 anchors.right: parent.right
77 anchors.top: parent.top
81 text:
i18n(
'Click Me!')
83 anchors.top: image.bottom
84 anchors.left: parent.left
85 anchors.right: parent.right
87 helloQmlObject.clickCount += 1
88 helloQmlObject.clicked(helloQmlObject.clickCount)
96 name:
'helloqml-sidebar'
97 title:
i18n(
'Testing QML SideBar')
98 icon:
'extensions.svg'
102 source:
'qrc:/icons/other/startpage.svg'
103 anchors.verticalCenter: parent.verticalCenter
104 anchors.left: parent.left
105 anchors.right: parent.right
109 text:
i18n(
'Hello Qml Plugin')
110 anchors.left: parent.left
111 anchors.right: parent.right
112 anchors.bottom: parent.bottom
117 populateWebViewMenu: function(menu, webHitTestResult) {
118 var text =
'My first qml plugin action'
119 var action = menu.addAction({
121 icon:
'extensions.svg'
124 action.triggered.connect(function() {
125 Falkon.Notifications.create({
126 heading:
i18n(
'Hello QML'),
127 message:
i18n(
'First qml plugin action works :-)'),
128 icon:
'extensions.svg'
138 settingsWindow: Rectangle {
144 source:
'qrc:/icons/other/about.svg'
145 anchors.top: parent.top
146 anchors.left: parent.left
147 anchors.right: parent.right
151 text: settings.value({key:
'text'})
152 placeholderText:
i18n(
'Enter text to save')
155 anchors.top: image.bottom
156 onTextChanged: function() {
157 button.text =
i18n(
'Save')
165 anchors.top: textField.bottom
166 onClicked: function() {
167 var res = settings.setValue({
169 value: textField.text
172 button.text =
i18n(
'Saved!')
174 button.text =
i18n(
'Error occurred, try again!')
int value(const QColor &c)