2022-04-04 23:04:36 +02:00
|
|
|
import org.kde.falkon 1.0 as Falkon
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick 2.3
|
|
|
|
|
|
|
|
Falkon.PluginInterface {
|
|
|
|
|
|
|
|
Falkon.Settings {
|
|
|
|
id: settings
|
|
|
|
name: 'Tutorial8_settings'
|
|
|
|
}
|
|
|
|
|
|
|
|
init: function(state, settingsPath) {
|
|
|
|
console.log(i18n('"Tutorial8" plugin loaded'))
|
|
|
|
}
|
|
|
|
|
|
|
|
testPlugin: function() {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
unload: function() {
|
|
|
|
console.log(i18n('"Tutorial8" plugin unloaded'))
|
|
|
|
}
|
|
|
|
|
|
|
|
Falkon.BrowserAction {
|
|
|
|
name: 'QML Tutorial 8'
|
|
|
|
identity: 'qml-tutorial-8-id'
|
|
|
|
title: i18n('Qml Tutorial 8')
|
|
|
|
toolTip: i18n('My little button')
|
|
|
|
icon: 'falkon'
|
|
|
|
location: Falkon.BrowserAction.NavigationToolBar | (settings.value({key: 'statusbar', defaultValue: 1}) == 1 ? Falkon.BrowserAction.StatusBar : 0)
|
2022-07-14 10:33:45 +02:00
|
|
|
popup: Pane {
|
2022-04-04 23:04:36 +02:00
|
|
|
width: 100;
|
|
|
|
height: 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-14 10:33:45 +02:00
|
|
|
settingsWindow: Pane {
|
2022-04-04 23:04:36 +02:00
|
|
|
id: window
|
|
|
|
width: 256
|
|
|
|
height: 200
|
2022-07-14 10:33:45 +02:00
|
|
|
|
2022-04-04 23:04:36 +02:00
|
|
|
Image {
|
|
|
|
id: image
|
|
|
|
source: 'qrc:/icons/other/about.svg'
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: checkStatusbar
|
|
|
|
checked: settings.value({key: 'statusbar', defaultValue: 1}) == 1
|
2022-07-14 10:33:45 +02:00
|
|
|
text: i18n('Show in statusbar')
|
2022-04-04 23:04:36 +02:00
|
|
|
anchors.top: image.bottom
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
id: button
|
|
|
|
text: i18n('Save')
|
|
|
|
height: 50
|
2022-07-14 10:33:45 +02:00
|
|
|
|
2022-04-04 23:04:36 +02:00
|
|
|
anchors.top: checkStatusbar.bottom
|
2022-07-14 10:33:45 +02:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
2022-04-04 23:04:36 +02:00
|
|
|
onClicked: function() {
|
|
|
|
var res = settings.setValue({
|
|
|
|
key: 'statusbar',
|
|
|
|
value: checkStatusbar.checked ? 1 : 0
|
|
|
|
})
|
|
|
|
var sync = settings.sync()
|
|
|
|
if (res && sync) {
|
|
|
|
button.text = i18n('Saved!')
|
|
|
|
} else {
|
|
|
|
button.text = i18n('Error occurred, try again!')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|