phonebookui/pbkcommonui/src/cnthistoryview.cpp
changeset 50 77bc263e1626
parent 47 7cbcb2896f0e
child 53 e6aff7b69165
equal deleted inserted replaced
49:74b30151afd6 50:77bc263e1626
   110     mArgs = aArgs;
   110     mArgs = aArgs;
   111     mContact = new QContact(mArgs.value(ESelectedContact).value<QContact>());
   111     mContact = new QContact(mArgs.value(ESelectedContact).value<QContact>());
   112     
   112     
   113     // Set history view heading
   113     // Set history view heading
   114     HbGroupBox* groupBox = static_cast<HbGroupBox*>(docLoader()->findWidget(QString("groupBox")));
   114     HbGroupBox* groupBox = static_cast<HbGroupBox*>(docLoader()->findWidget(QString("groupBox")));
   115     groupBox->setHeading(hbTrId("txt_phob_subtitle_history_with_1").arg(mContact->displayLabel()));
   115     QString name = mContact->displayLabel();
       
   116     if (name.isEmpty())
       
   117     {
       
   118         name = hbTrId("txt_phob_list_unnamed");
       
   119     }
       
   120     groupBox->setHeading(hbTrId("txt_phob_subtitle_history_with_1").arg(name));
   116     
   121     
   117     //construct listview
   122     //construct listview
   118     mHistoryListView = static_cast<HbListView*>(docLoader()->findWidget(QString("listView")));
   123     mHistoryListView = static_cast<HbListView*>(docLoader()->findWidget(QString("listView")));
   119     mHistoryListView->setLayoutName("history");
   124     mHistoryListView->setLayoutName("history");
   120     CntHistoryViewItem *item = new CntHistoryViewItem;
   125     CntHistoryViewItem *item = new CntHistoryViewItem;
   169 */
   174 */
   170 void CntHistoryView::clearHistory()
   175 void CntHistoryView::clearHistory()
   171 {
   176 {
   172     // Ask the use if they want to clear the history
   177     // Ask the use if they want to clear the history
   173     QString name = mContact->displayLabel();
   178     QString name = mContact->displayLabel();
       
   179     if (name.isEmpty())
       
   180     {
       
   181         name = hbTrId("txt_phob_list_unnamed");
       
   182     }
   174     
   183     
   175     HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_clear_communications_history_with_1")).arg(name), this, 
   184     HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_clear_communications_history_with_1")).arg(name), this, 
   176             SLOT(handleClearHistory(HbAction*)), hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel"));
   185             SLOT(handleClearHistory(int)), HbMessageBox::Delete | HbMessageBox::Cancel);
   177 }
   186 }
   178 
   187 
   179 /*
   188 /*
   180 Handle the selected action for clearing history
   189 Handle the selected action for clearing history
   181 */
   190 */
   182 void CntHistoryView::handleClearHistory(HbAction *action)
   191 void CntHistoryView::handleClearHistory(int action)
   183 {
   192 {
   184     HbMessageBox *note = static_cast<HbMessageBox*>(sender());
   193     if (action == HbMessageBox::Delete)
   185     
       
   186     if (note && action == note->actions().first())
       
   187     {
   194     {
   188         mHistoryModel->clearHistory();
   195         mHistoryModel->clearHistory();
   189     }
   196     }
   190 }
   197 }
   191 
   198