[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/declarative-applets/replacements/dictionary/package/contents/ui
From:       Sebastian Kügler <sebas () kde ! org>
Date:       2011-04-24 14:22:30
Message-ID: 20110424142230.9B012AC85D () svn ! kde ! org
[Download RAW message or body]

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("<b>This is a list of Dictionaries. You can \
type 'dictionaryname:' in front of your search term to pick from a certain \
one.</b><br><br>")  for (var line in data) {
                             temp = temp + line + ": " + data[line] + "<br><br>"
                         }
-                        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 += "<html><head><style type=\"text/css\">";
+                        styledHtml += theme.styleSheet + "</style></head>";
+                        styledHtml += "<body>" + dictText;
+                        styledHtml += "</body></html>";
+                    } else {
+                        styledHtml += "<html><head><style type=\"text/css\">";
+                        styledHtml += theme.styleSheet + "</style></head>";
+                        styledHtml += "<body>" + i18n("This is the dictionary app. \
Type a word in the search field above to get a definition."); +                       \
styledHtml += "</body></html>";  }
+                    return styledHtml;
             }
         }
     }
+    }
     Timer {
        id: timer
        running: false


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic