69 lines
1.9 KiB
QML
69 lines
1.9 KiB
QML
import org.kde.falkon 1.0 as Falkon
|
|
import QtQuick 2.3
|
|
|
|
Falkon.PluginInterface {
|
|
|
|
QtObject {
|
|
id: tutorial3Object
|
|
property int clickCount
|
|
}
|
|
|
|
init: function(state, settingsPath){
|
|
console.log(i18n('"Tutorial4" plugin loaded'))
|
|
tutorial3Object.clickCount = 0;
|
|
}
|
|
|
|
testPlugin: function() {
|
|
return true
|
|
}
|
|
|
|
unload: function() {
|
|
console.log(i18n('"Tutorial4" plugin unloaded'))
|
|
}
|
|
|
|
function buttonClicked() {
|
|
tutorial3Object.clickCount++;
|
|
console.log(i18n('"Tutorial4" clickCount increased to ' + tutorial3Object.clickCount))
|
|
}
|
|
|
|
Falkon.BrowserAction {
|
|
name: 'QML Tutorial 3'
|
|
identity: 'qml-tutorial-3-id'
|
|
title: i18n('Qml Tutorial 3')
|
|
toolTip: i18n('My little button')
|
|
icon: 'falkon'
|
|
badgeText: tutorial3Object.clickCount
|
|
location: Falkon.BrowserAction.NavigationToolBar | Falkon.BrowserAction.StatusBar
|
|
popup: Rectangle {
|
|
width: 100;
|
|
height: 100;
|
|
}
|
|
}
|
|
|
|
populateWebViewMenu: function(menu, webHitTestResult) {
|
|
var action_always = menu.addAction({
|
|
text: 'Increment counter by one',
|
|
icon: 'falkon'
|
|
})
|
|
|
|
action_always.triggered.connect(function() {
|
|
tutorial3Object.clickCount++;
|
|
console.log(i18n('"Tutorial4" clickCount increased to ' + tutorial3Object.clickCount))
|
|
})
|
|
|
|
if (webHitTestResult.isImage()) {
|
|
var action_image = menu.addAction({
|
|
text: 'Image, increment by two',
|
|
icon: 'falkon'
|
|
})
|
|
|
|
action_image.triggered.connect(function() {
|
|
tutorial3Object.clickCount += 2;
|
|
console.log(i18n('"Tutorial4" Surprise, this is an image with url: ' + webHitTestResult.imageUrl))
|
|
console.log(i18n('"Tutorial4" clickCount increased to ' + tutorial3Object.clickCount))
|
|
})
|
|
}
|
|
}
|
|
|
|
}
|