emailuis/nmailui/src/nmviewerheader.cpp
changeset 56 15bc1d5d6267
parent 47 f83bd4ae1fe3
child 66 084b5b1f02a7
--- a/emailuis/nmailui/src/nmviewerheader.cpp	Fri Jul 09 12:17:13 2010 +0300
+++ b/emailuis/nmailui/src/nmviewerheader.cpp	Fri Jul 23 19:09:50 2010 +0300
@@ -19,6 +19,7 @@
 #include "nmuiheaders.h"
 
 static const qreal NmHeaderLineOpacity = 0.4;
+static const int NmTextWrapWordOrAnywhere = 4;
 
 /*!
     \class NmViewerHeader
@@ -256,19 +257,12 @@
     
     if (mHeaderBox) {        // Initialize recipient box
         if (!mRecipientsBox){
-            mRecipientsBox = new HbTextEdit();
+            mRecipientsBox = new HbLabel();
             HbStyle::setItemName(mRecipientsBox, "recipients");
-            mRecipientsBox->setContextMenuFlags(0);
-            mRecipientsBox->setReadOnly(true);
             mRecipientsBox->setFontSpec(HbFontSpec(HbFontSpec::Secondary)); 
-            // Set text wrapping for from/to/cc address fields using text document
-            QTextOption textOption = mRecipientsBox->document()->defaultTextOption();
-            textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
-            mRecipientsBox->document()->setDefaultTextOption(textOption);
+            mRecipientsBox->setTextWrapping((Hb::TextWrapping)NmTextWrapWordOrAnywhere);
         }
-        connect(mRecipientsBox, SIGNAL(cursorPositionChanged(int, int)),
-                this, SLOT(cursorPositionChanged(int, int)));
-                
+               
         // Set recipients to text edit field as html 
         NmAddress sender = mMessage->envelope().sender();               
         if (mMessage) {
@@ -276,7 +270,6 @@
                                     mMessage->envelope().toRecipients(), 
                                     mMessage->envelope().ccRecipients()));
         }
-        mRecipientsBox->setCursorVisibility(Hb::TextCursorHidden);
         mHeaderBox->setContentWidget(mRecipientsBox);
         // Set box collapsed as default
         mHeaderBox->setCollapsed(true);
@@ -295,7 +288,7 @@
     QString result;
     result.append("<html><body link=\"blue\" topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\"");
     result.append("marginwidth=\"0\">");    
-    result.append("<font face=\"");
+    result.append("<font color=\"black\" face=\"");
     result.append("Nokia Sans");
     result.append("\"size=\"3\">"); 
     // Set text in HTML format based on layout direction
@@ -310,7 +303,9 @@
         int reciCount = to.count();
         for (int i=0; i < reciCount; i++) { 
             result.append(addressToDisplay(to[i]));
-            result.append(" ");
+            if (i!=reciCount-1) {
+                result.append(" ");
+            }
         } 
         reciCount = cc.count();
         if (reciCount) {
@@ -319,7 +314,9 @@
             result.append(" </b>");
             for (int i=0; i < reciCount; i++) {
                 result.append(addressToDisplay(cc[i]));
-                result.append(" "); 
+                if (i!=reciCount-1) {
+                    result.append(" ");
+                }                
             }
         }   
     }
@@ -334,7 +331,9 @@
         int reciCount = to.count();
         for (int i=0; i < reciCount; i++) { 
             result.append(addressToDisplay(to[i]));
-            result.append("; ");
+            if (i!=reciCount-1) {
+                result.append("; ");
+            }
         }
         reciCount = cc.count();
         if (reciCount) {
@@ -343,7 +342,9 @@
             result.append(" </b>");
             for (int i=0; i < reciCount; i++) {
                 result.append(addressToDisplay(cc[i]));
-                result.append("; ");
+                if (i!=reciCount-1) {
+                    result.append("; ");
+                }
             }
         }   
     } 
@@ -374,19 +375,3 @@
     return ret;
 }
 
-/*!
-    Function handles cursor position changes in header group box.
-    E.g link handler.
-*/
-void NmViewerHeader::cursorPositionChanged(int oldPos, int newPos)
-{
-    NM_FUNCTION;
-    
-    Q_UNUSED(oldPos);
-    QString string = mRecipientsBox->anchorAt(newPos); 
-    if (mViewerView&&string.contains("mailto:",Qt::CaseSensitive)){
-        QUrl url(string);     
-        mViewerView->linkClicked(url);
-    }
-}
-