1
FalkonTutorials/qml/extensions/qml_tutorial_6/main.qml

45 lines
1.2 KiB
QML
Raw Normal View History

import org.kde.falkon 1.0 as Falkon
import QtQuick 2.3
Falkon.PluginInterface {
init: function(state, settingsPath){
console.log(i18n('"Tutorial6" plugin loaded'))
tutorial3Object.clickCount = 0;
}
testPlugin: function() {
return true
}
unload: function() {
console.log(i18n('"Tutorial6" plugin unloaded'))
}
populateWebViewMenu: function(menu, webHitTestResult) {
/* Directly add actions to the menu */
var action_always = menu.addAction({
text: 'Copy something to the clipboard',
icon: 'falkon'
})
action_always.triggered.connect(function() {
Falkon.Clipboard.copy('Something from Falkon extension')
console.log(i18n('"Tutorial6" Something was copied to the clipboard'))
})
if (webHitTestResult.isImage()) {
var action_image = menu.addAction({
text: 'Image, copy URL',
icon: 'falkon'
})
action_image.triggered.connect(function() {
Falkon.Clipboard.copy(webHitTestResult.imageUrl)
console.log(i18n('"Tutorial6" Surprise, this is an image with url: ' + webHitTestResult.imageUrl))
})
}
}
}