diff --git a/qml/extensions/qml_tutorial_9/main.qml b/qml/extensions/qml_tutorial_9/main.qml new file mode 100644 index 0000000..115ae41 --- /dev/null +++ b/qml/extensions/qml_tutorial_9/main.qml @@ -0,0 +1,109 @@ +import org.kde.falkon 1.0 as Falkon +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.0 +import QtQuick 2.3 + +Falkon.PluginInterface { + + QtObject { + id: objectTutorial9 + property ListModel windows: ListModel {} + } + + init: function(state, settingsPath) { + console.log(i18n('"Tutorial9" plugin loaded')) + + Falkon.Windows.created.connect(function(window) { + objectTutorial9.windows.append({ + "id": window.id.toString() + }) + }) + + console.log(Falkon.PluginInterface.LateInitState) + + if (state == 1) { + var windowsAll = Falkon.Windows.getAll() + console.log("Creating windows") + + for (var i = 0; i < windowsAll.length; ++i) { + objectTutorial9.windows.append({ + "id": windowsAll[i].id.toString() + }) + } + } + } + + testPlugin: function() { + return true + } + + unload: function() { + console.log(i18n('"Tutorial9" plugin unloaded')) + } + + Falkon.SideBar { + name: 'qml-tutorial9-sidebar' + title: i18n('Tutorial 9 - QML SideBar') + icon: 'falkon' + checkable: true + shortcut: 'Ctrl+Shift+Alt+W' + Rectangle { + ScrollView { + id: scroll_windows + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: button_add.top + + ScrollBar.horizontal.policy: ScrollBar.AlwaysOn + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + ListView { + Component { + id: contactsDelegate + + ColumnLayout { + id: wrapper + spacing: 2 + + CheckBox { + id: checkSelected + text: "Window " + id + } + } + } + + model: objectTutorial9.windows + delegate: contactsDelegate + focus: true + } + } + Button { + id: button_add + text: i18n('Add Window') + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: button_remove.top + + onClicked: function() { + ; + } + } + Button { + id: button_remove + text: i18n('Remove Selected Windows') + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + onClicked: function() { + ; + } + } + } + } + +} diff --git a/qml/extensions/qml_tutorial_9/metadata.desktop b/qml/extensions/qml_tutorial_9/metadata.desktop new file mode 100644 index 0000000..84c7780 --- /dev/null +++ b/qml/extensions/qml_tutorial_9/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Tutorial9 QML +Comment=Example QML extension with windows example is sidebar +Icon= +Type=Service +X-Falkon-Type=Extension/Qml + +X-Falkon-Author=Juraj Oravec +X-Falkon-Email=jurajoravec@mailo.com +X-Falkon-Version=1.0.0 +X-Falkon-Settings=false