Hi! I've written a QML plasmoid to test the translator dataengine (plasma/farhad_hf/translator branch of kdeplasma-addons), but I can't get it to work, code:
import Qt 4.7 import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.graphicslayouts 4.7 as GraphicsLayouts Item { id: mainwindow // property string provider // property string from // property string to Component.onCompleted: { plasmoid.addEventListener('ConfigChanged', configChanged); } // function configChanged() // { // provider = plasmoid.readConfig("provider"); // from = plasmoid.readConfig("fromLanguage"); // to = plasmoid.readConfig("toLanguage"); // } function printData() { for ( i in source.data.keys ) { print ("K: "+i); } } PlasmaCore.DataSource { id: source engine: "translator" onDataChanged: { plasmoid.busy = false printData() } } PlasmaCore.DataModel { id: dataModel dataSource: source } PlasmaCore.Theme { id: theme } Column { width: mainwindow.width height: mainwindow.height Row { id: searchWidget width: parent.width PlasmaWidgets.LineEdit { id: searchBox clearButtonShown: true width: parent.width onTextEdited: timer.running = true } } Flickable { clip: true Text { id: translation wrapMode: Text.Wrap width: parent.parent.width text: source.data["googletranslate" + ":" + "en" + ":" + "fa" + ":" + searchBox.text]["text"] } } } Timer { id: timer running: false repeat: false interval: 500 onTriggered: { plasmoid.busy = true source.connectedSources = ["googletranslate" + ":" + "en" + ":" + "fa" + ":" + searchBox.text] } } } I get this error in the console output: TypeError: Result of expression 'source.data["googletranslate" + ":" + "en" + ":" + "fa" + ":" + searchBox.text]' [undefined] is not an object. If I remove the `["text"]' from line 89, I get this error: Unable to assign [undefined] to QString text and the plasmoid remains in the busy mode even after the dataengine returns the data (according to the console output!)... you can download the googletranslate provider plugin from http://www.digidesk.ir/ggt.tgz and the plasmoid: http://www.digidesk.ir/translator.plasmoid Thanks in advance :) Farhad Hedayati Fard _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel