SVN commit 1229011 by sebas: drag to scroll, clickmessage, result styling scrolling needs eff7a1c5d1 styling needs e4be3534acf and e6054a73 M +22 -15 main.qml --- trunk/playground/base/plasma/declarative-applets/replacements/dictionary/package/contents/ui/main.qml #1229010:1229011 @@ -73,6 +73,7 @@ } PlasmaWidgets.LineEdit { id: searchBox + clickMessage: i18n("Type a word..."); clearButtonShown: true width: parent.width - icon.width - parent.spacing onTextChanged: { @@ -81,35 +82,41 @@ } } } - Flickable { - width: parent.width - parent.spacing - height: parent.height - searchRow.height - parent.spacing - contentWidth: childrenRect.width - contentHeight: textBrowser.height - clip: true - Text { + PlasmaWidgets.WebView { id: textBrowser - wrapMode: Text.Wrap width: parent.parent.width - clip: true - text: { + height: parent.height - searchRow.height - parent.spacing + dragToScroll: true + html: { if (mainWindow.listdictionaries) { var data = feedSource.data["list-dictionaries"] var temp = i18n("This is a list of Dictionaries. You can type 'dictionaryname:' in front of your search term to pick from a certain one.

") for (var line in data) { temp = temp + line + ": " + data[line] + "

" } - temp + return temp; } else { - if (feedSource.data[searchBox.text]) - feedSource.data[searchBox.text]["text"] - else - i18n("This is the dictionary plasmoid") + var styledHtml = ""; + if (feedSource.data[searchBox.text]) { + var dictText = feedSource.data[searchBox.text]["text"]; + if (typeof feedSource.data[searchBox.text] == "undefined" || typeof dictText == "undefined") { + dictText = i18n("Loading..."); } + styledHtml += ""; + styledHtml += "" + dictText; + styledHtml += ""; + } else { + styledHtml += ""; + styledHtml += "" + i18n("This is the dictionary app. Type a word in the search field above to get a definition."); + styledHtml += ""; } + return styledHtml; } } } + } Timer { id: timer running: false