logsui/logsengine/src/logsdetailsmodel.cpp
changeset 16 c5af8598d22c
parent 6 41c0a814d878
child 19 e4c884866116
--- a/logsui/logsengine/src/logsdetailsmodel.cpp	Wed Aug 18 09:49:12 2010 +0300
+++ b/logsui/logsengine/src/logsdetailsmodel.cpp	Thu Sep 02 20:27:05 2010 +0300
@@ -78,9 +78,9 @@
 void LogsDetailsModel::clearEvent()
 {
     LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::clearEvent()" )
-    QList<int> eventIds;
-    eventIds.append(mEvent->logId());
-    mDbConnector->clearEvents(eventIds);    
+    QList<LogsEvent*> events;
+    events.append(mEvent);
+    mDbConnector->clearEvents(events);    
     LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::clearEvent()" )
 }
 
@@ -156,14 +156,25 @@
 //
 // -----------------------------------------------------------------------------
 //
+void LogsDetailsModel::updateModel()
+{
+    LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::updateModel()" )
+    initContent();
+    reset();
+    LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::updateModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void LogsDetailsModel::contactActionCompleted(bool modified)
 {
     if ( modified ){
         mEvent->prepareForContactMatching();
         if ( mEvent->updateRemotePartyFromContacts(
                 LogsCommonData::getInstance().contactManager() ).length() > 0 ) {
-            initContent();
-            reset();
+            updateModel();
         }
     }
 }
@@ -180,8 +191,7 @@
     mDuplicates.clear();
     mDuplicates = mDbConnector->takeDuplicates();
     
-    initContent();
-    reset();
+    updateModel();
     
     // Someone else might be reading duplicates as well, don't interfere with them.
     disconnect( mDbConnector, SIGNAL(duplicatesRead()), this, SLOT(duplicatesRead()) );
@@ -222,7 +232,7 @@
 {
     QString callerId("");
     if (event.remoteParty().length() > 0 && event.number().length() > 0){
-    	callerId = event.number();
+    	callerId = phoneNumString(event.number());
     }
     
     if (event.remoteParty().length() > 0 && getRemoteUri(event).length() > 0){
@@ -247,7 +257,7 @@
     }
     
     if ( headerdata.length() == 0 && event.number().length() > 0 ){
-        headerdata = event.number();
+        headerdata = phoneNumString(event.number());
     }
     
     if ( headerdata.length() == 0 ){
@@ -281,7 +291,15 @@
 {
     HbLineEdit *cliptmp = new HbLineEdit("");
  
-    QString num = mEvent->getNumberForCalling(); 
+    // Localize digits only if it is used only used in CS context (don't 
+    // localize any VoIP uri, not even if it would be tel uri).
+    QString num = mEvent->number();
+    if ( num.isEmpty() ){
+        num = mEvent->getNumberForCalling();
+    } else {
+        num = phoneNumString(num);
+    }
+    
     cliptmp->setText(num);
     cliptmp->setSelection(0, num.length());
     cliptmp->copy();
@@ -359,9 +377,7 @@
         remotePartyRow << getCallerId(*mEvent);
         mDetailTexts.append(remotePartyRow);
 	}
-	
-	// TODO: if more than one date and time rows, first row has text "Last call event"
-	// but there's no localization string for that yet
+
 	bool firstOfMultipleDates( mDuplicates.count() > 0 );
 	addDateAndTimeTextRow(*mEvent, firstOfMultipleDates);
     
@@ -380,7 +396,7 @@
         callDurationRow << hbTrId("txt_dialer_ui_dblist_call_duration");
         QTime n(0, 0, 0);
         QTime t = n.addSecs(mEvent->duration());                
-        callDurationRow << t.toString("hh:mm:ss");
+        callDurationRow << durationString(t);
         mDetailTexts.append(callDurationRow);
     }
     
@@ -435,6 +451,6 @@
     } else {
         dateAndTimeRow << hbTrId("txt_dialer_ui_dblist_date_and_time");
     }
-    dateAndTimeRow << event.time().toTimeSpec(Qt::LocalTime).toString();
+    dateAndTimeRow << dateAndTimeString( event.time().toTimeSpec(Qt::LocalTime) );
     mDetailTexts.append(dateAndTimeRow);
 }