src/hbwidgets/editors/hbtextedit.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 6 c3690ec91ef8
--- a/src/hbwidgets/editors/hbtextedit.cpp	Mon Apr 19 14:02:13 2010 +0300
+++ b/src/hbwidgets/editors/hbtextedit.cpp	Mon May 03 12:48:33 2010 +0300
@@ -25,6 +25,7 @@
 
 #include "hbtextedit.h"
 #include "hbtextedit_p.h"
+#include "hbsmileyengine_p.h"
 
 #include <QTextCursor>
 
@@ -185,47 +186,75 @@
 {
     Q_D(HbTextEdit);
 
-    const QString KTextRowLinesColorCSSName   = "line-color";
-    const QString KTextRowLinesWidthCSSName   = "line-width";
-    const QString KTextRowLinesEnabledCSSName = "line-enabled";
+    if (isVisible()) {
+
+//        const QString KTextRowLinesColorCSSName   = "line-color";
+        const QString KTextRowLinesWidthCSSName   = "line-width";
+        const QString KSmileyScaleCSSName         = "smiley-scale";
+        const QString KTextRowLinesStyleCSSName   = "line-style";
+
+        // ------ adding css parameters ------
+//        params.addParameter(KTextRowLinesColorCSSName, Qt::black);
+        params.addParameter(KTextRowLinesWidthCSSName, 0.0);
+        params.addParameter(KSmileyScaleCSSName);
+        params.addParameter(KTextRowLinesStyleCSSName);
 
-    // ------ adding css parameters ------
-    params.addParameter(KTextRowLinesColorCSSName, Qt::magenta);
-    params.addParameter(KTextRowLinesWidthCSSName, 0.0);
-    params.addParameter(KTextRowLinesEnabledCSSName);
+        HbAbstractEdit::polish(params);
 
-    HbAbstractEdit::polish(params);
+        // ------ interpreting css parameters ------
+//        QVariant param = params.value(KTextRowLinesColorCSSName);
+//        if(param.canConvert(QVariant::Color)) {
+//            d->mTextBaseLinePen.setColor(param.value<QColor>());
+//        }
+
+        QVariant param = params.value(KTextRowLinesWidthCSSName);
+        if(param.canConvert(QVariant::Double)) {
+            d->mTextBaseLinePen.setWidthF(qMax(param.toDouble(), 0.0));
+        }
 
-    // ------ interpreting css parameters ------
-    QVariant param = params.value( KTextRowLinesEnabledCSSName );
-    d->mShowTextBaseLine = param.toBool();
+        param = params.value(KSmileyScaleCSSName);
+        if(param.canConvert(QVariant::Double)) {
+            d->smileyEngineInstance()->setSmileyScaleFactor(param.toDouble());
+        }
+
+        param = params.value(KTextRowLinesStyleCSSName);
+        if(param.canConvert(QVariant::String)) {
+            d->setBaseLineStyleFromString(param.toString());
+        }
+    } else {
+        HbAbstractEdit::polish(params);
+    }
+}
+
 
-    param = params.value(KTextRowLinesColorCSSName);
-    if(param.canConvert(QVariant::Color)) {
-        d->mTextBaseLinePen.setColor(param.value<QColor>());
-    }
+/*!
+    @proto
+
+    Sets if row lines to be visible or not.
 
-    param = params.value(KTextRowLinesWidthCSSName);
-    if(param.canConvert(QVariant::Double)) {
-        d->mTextBaseLinePen.setWidthF(qMax(param.toDouble(), 0.0));
+    \sa HbTextEdit::isLined() const
+ */
+void HbTextEdit::setLined(bool visible)
+{
+    Q_D(HbTextEdit);
+
+    if (d->mShowTextBaseLine!=visible) {
+        d->mShowTextBaseLine=visible;
+        d->mShowTextBaseLineApiProtectionFlag = true;
+        update();
     }
 }
 
 /*!
-    \reimp
- */
-void HbTextEdit::focusOutEvent(QFocusEvent * event)
-{
-    HbAbstractEdit::focusOutEvent(event);
-    setBackgroundItem(HbStyle::P_TextEdit_frame_normal);
-}
+    @proto
+
+    Returns true if row lines are visble.
 
-/*!
-    \reimp
+    \sa HbTextEdit::setLined(bool)
  */
-void HbTextEdit::focusInEvent(QFocusEvent * event)
+bool HbTextEdit::isLined() const
 {
-    HbAbstractEdit::focusInEvent(event);
-    setBackgroundItem(HbStyle::P_TextEdit_frame_highlight);
+    Q_D(const HbTextEdit);
+
+    return d->mShowTextBaseLine;
 }
-