emailuis/nmailuiwidgets/src/nmeditortextedit.cpp
changeset 48 10eaf342f539
parent 47 f83bd4ae1fe3
child 51 d845db10c0d4
--- a/emailuis/nmailuiwidgets/src/nmeditortextedit.cpp	Thu Jun 24 14:32:18 2010 +0300
+++ b/emailuis/nmailuiwidgets/src/nmeditortextedit.cpp	Tue Jun 29 17:12:28 2010 +0300
@@ -33,9 +33,9 @@
 
     mCustomTextColor = QPair<bool, QColor>(false, Qt::black);
     
-    // Enable scrolling using cursor
-    setScrollable(true);
-    scrollArea()->setScrollDirections(Qt::Horizontal);
+    // Disable HbTextEdit scrolling. Background scroll area will handle scrolling.
+    setScrollable(false);
+    scrollArea()->setScrollDirections(0);
 
     // set background colour to plain white
     QPixmap whitePixmap(10,10);
@@ -46,6 +46,22 @@
     // disables highlight frame for now - new api to set the frame item should be release somewhere wk26
     setFocusHighlight(HbStyle::P_TextEdit_frame_highlight, HbWidget::FocusHighlightNone);
     
+    // Create custom palette based on the current one
+    QPalette testPalette = QApplication::palette();
+
+    // Sets the selection background colour
+    testPalette.setColor(QPalette::Active, QPalette::Highlight, Qt::cyan);
+    testPalette.setColor(QPalette::Inactive, QPalette::Highlight, Qt::cyan);
+
+    // Sets the link and visited link colours
+    testPalette.setColor(QPalette::Active, QPalette::Link, Qt::darkBlue);
+    testPalette.setColor(QPalette::Inactive, QPalette::Link, Qt::darkBlue);
+    testPalette.setColor(QPalette::Active, QPalette::LinkVisited, Qt::darkMagenta);
+    testPalette.setColor(QPalette::Inactive, QPalette::LinkVisited, Qt::darkMagenta);
+
+    // Update custom palette for this widget
+    setPalette(testPalette);
+
     connect(this, SIGNAL(contentsChanged()), this, SLOT(updateCustomTextColor()));
 }
 
@@ -135,10 +151,12 @@
 }
 
 /*!
- *  Returns the calculated rect in item coordinates of the editor for the the given \a position inside a document.
+ *  Returns the rectangle for the cursor.
  */
-QRectF NmEditorTextEdit::rectForPosition(int position)
+QRectF NmEditorTextEdit::rectForCursorPosition() const
 {
-    return HbTextEdit::rectForPosition(position);
+    NM_FUNCTION;
+    
+    return HbTextEdit::rectForPosition(cursorPosition());
 }