phonebookui/pbkcommonui/src/cntgroupmemberview.cpp
changeset 50 77bc263e1626
parent 47 7cbcb2896f0e
child 53 e6aff7b69165
equal deleted inserted replaced
49:74b30151afd6 50:77bc263e1626
   204     if (mArgs.value(ESelectedAction).toString() == CNT_SAVE_ACTION)
   204     if (mArgs.value(ESelectedAction).toString() == CNT_SAVE_ACTION)
   205     {
   205     {
   206         QString name = getContactManager()->synthesizedDisplayLabel(*mGroupContact);
   206         QString name = getContactManager()->synthesizedDisplayLabel(*mGroupContact);
   207         HbNotificationDialog::launchDialog(HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_new_group_1_created").arg(name)));
   207         HbNotificationDialog::launchDialog(HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_new_group_1_created").arg(name)));
   208     }
   208     }
   209     
       
   210     mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND ));
       
   211     connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleManageMembers()));
       
   212 }
   209 }
   213 
   210 
   214 void CntGroupMemberView::deactivate()
   211 void CntGroupMemberView::deactivate()
   215 {
   212 {
   216     
   213     
   244     membersFilter.setRelatedContactRole(QContactRelationship::First);
   241     membersFilter.setRelatedContactRole(QContactRelationship::First);
   245     membersFilter.setRelatedContactId(mGroupContact->id());   
   242     membersFilter.setRelatedContactId(mGroupContact->id());   
   246     mOriginalGroupMembers = getContactManager()->contactIds(membersFilter);
   243     mOriginalGroupMembers = getContactManager()->contactIds(membersFilter);
   247     
   244     
   248     QSet<QContactLocalId> contactsSet = mOriginalGroupMembers.toSet();
   245     QSet<QContactLocalId> contactsSet = mOriginalGroupMembers.toSet();
   249     QContactName groupContactName = mGroupContact->detail( QContactName::DefinitionName );
   246 
   250     QString groupName(groupContactName.value( QContactName::FieldCustomLabel ));
   247     QString groupName = mGroupContact->displayLabel();
       
   248     if (groupName.isEmpty())
       
   249     {
       
   250         groupName = hbTrId("txt_phob_list_unnamed");
       
   251     }
   251     
   252     
   252     if (!mFetchView) {
   253     if (!mFetchView) {
   253         mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND ));
   254         mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND ));
   254         connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleManageMembers()));
   255         connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleManageMembers()));
   255     }
   256     }
   284     }
   285     }
   285     
   286     
   286     if (!removedMemberships.isEmpty()) {
   287     if (!removedMemberships.isEmpty()) {
   287         getContactManager()->removeRelationships(removedMemberships, &errors);
   288         getContactManager()->removeRelationships(removedMemberships, &errors);
   288     }
   289     }
       
   290     
       
   291     delete mFetchView;
       
   292     mFetchView = 0;
   289 }
   293 }
   290 
   294 
   291 void CntGroupMemberView::createModel()
   295 void CntGroupMemberView::createModel()
   292 {
   296 {
   293     QContactRelationshipFilter rFilter;
   297     QContactRelationshipFilter rFilter;
   309 }
   313 }
   310 
   314 
   311 void CntGroupMemberView::deleteGroup()
   315 void CntGroupMemberView::deleteGroup()
   312 {
   316 {
   313     QString groupName = mGroupContact->displayLabel();
   317     QString groupName = mGroupContact->displayLabel();
       
   318     if (groupName.isNull())
       
   319     {
       
   320         groupName = hbTrId("txt_phob_list_unnamed");
       
   321     }
       
   322     
   314     HbLabel *headingLabel = new HbLabel();
   323     HbLabel *headingLabel = new HbLabel();
   315     headingLabel->setPlainText(HbParameterLengthLimiter(hbTrId("txt_phob_dialog_delete_1_group")).arg(groupName));
   324     headingLabel->setPlainText(HbParameterLengthLimiter(hbTrId("txt_phob_dialog_delete_1_group")).arg(groupName));
   316     
   325     
   317     HbMessageBox::question(hbTrId("txt_phob_dialog_only_group_will_be_removed_contac"), this, SLOT(handleDeleteGroup(HbAction*)),
   326     HbMessageBox::question(hbTrId("txt_phob_dialog_only_group_will_be_removed_contac"), this, SLOT(handleDeleteGroup(int)),
   318             hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel"), headingLabel);
   327             HbMessageBox::Delete | HbMessageBox::Cancel, headingLabel);
   319 }
   328 }
   320 
   329 
   321 void CntGroupMemberView::handleDeleteGroup(HbAction *action)
   330 void CntGroupMemberView::handleDeleteGroup(int action)
   322 {
   331 {
   323     HbDialog *popup = static_cast<HbDialog*>(sender());
   332     if (action == HbMessageBox::Delete)
   324     
       
   325     if (popup && action == popup->actions().first())
       
   326     {
   333     {
   327         getContactManager()->removeContact(mGroupContact->localId());
   334         getContactManager()->removeContact(mGroupContact->localId());
   328         showPreviousView();
   335         showPreviousView();
   329     }
   336     }
   330 }
   337 }