--- a/emailuis/nmhswidget/src/nmhswidgetlistviewitem.cpp Wed Sep 15 17:47:19 2010 +0300
+++ b/emailuis/nmhswidget/src/nmhswidgetlistviewitem.cpp Thu Sep 30 11:43:07 2010 +0300
@@ -15,6 +15,7 @@
*
*/
+#include <qregexp.h>
#include <hbtextitem.h>
#include <hbiconitem.h>
#include <hbframeitem.h>
@@ -23,6 +24,7 @@
#include <hbcolorscheme.h>
#include <nmmessageenvelope.h>
#include <nmicons.h>
+#include <hbstringutil.h>
#include "nmhswidgetlistviewitem.h"
/*!
@@ -148,7 +150,7 @@
// Sender.
QString senderDisplayName = envelope.sender().displayName();
if (!senderDisplayName.isNull() && !senderDisplayName.isEmpty()) {
- mSender->setText(senderDisplayName);
+ mSender->setText(cleanupDisplayName(senderDisplayName));
}
else {
mSender->setText(envelope.sender().address());
@@ -162,10 +164,10 @@
if (sentLocalDate == currentdate) {
QString shortTimeSpec = r_qtn_time_usual;
QTime time = localTime.time();
- mTime->setText(locale.format(time, shortTimeSpec));
+ mTime->setText(HbStringUtil::convertDigits(locale.format(time, shortTimeSpec)));
} else {
QString shortDateSpec = r_qtn_date_without_year;
- mTime->setText(locale.format(sentLocalDate, shortDateSpec));
+ mTime->setText(HbStringUtil::convertDigits(locale.format(sentLocalDate, shortDateSpec)));
}
// Subject.
QString subjectText = envelope.subject();
@@ -310,3 +312,22 @@
mTime->setTextColor(colorRole);
}
}
+
+/*!
+ Cleans up display name by stripping extra characters from the beginning and end of the string.
+*/
+QString NmHsWidgetListViewItem::cleanupDisplayName( const QString &displayName )
+{
+ NM_FUNCTION;
+
+ // find the first and last position that is NOT one of the characters below
+ QRegExp rx("[^\\s\"<>]");
+ int firstPos = std::max(rx.indexIn(displayName), 0);
+ int lastPos = rx.lastIndexIn(displayName);
+
+ if (lastPos < 0) {
+ lastPos = displayName.length() - 1;
+ }
+
+ return displayName.mid(firstPos, lastPos - firstPos + 1);
+}