Changeset 506:ea3d99defee6 in qutecom-2.2


Ignore:
Timestamp:
Feb 23, 2010 1:50:22 PM (3 years ago)
Author:
laurent@…
Branch:
default
Message:

don't display group with no contact

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wengophone/src/presentation/qt/contactlist/QtContactList.cpp

    r492 r506  
    3636 
    3737#include <model/contactlist/Contact.h> 
     38#include <model/contactlist/ContactList.h> 
    3839#include <model/contactlist/ContactGroup.h> 
    3940 
     
    202203 
    203204        list = _ui->treeWidget->findItems(contactGroupId, Qt::MatchExactly); 
    204         if (list.isEmpty()) { 
    205                 QTreeWidgetItem * group = new QTreeWidgetItem(_ui->treeWidget); 
    206                 group->setText(0, contactGroupId); 
    207                 _ui->treeWidget->setItemExpanded(group, true); 
     205        if (list.isEmpty())  
     206        { 
     207                bool group_has_contact = false; 
     208                std::list<Contact> contacts = _cContactList.getContactList().getContacts(); 
     209                for (std::list<Contact>::iterator it = contacts.begin();it != contacts.end() ; it++ ) 
     210                { 
     211                        if ( (*it).getGroupId() ==  contactGroupId.toStdString())  
     212                        { 
     213                                group_has_contact = true; 
     214                                break; 
     215                        } 
     216                } 
     217 
     218                if(group_has_contact) 
     219                { 
     220                        QTreeWidgetItem * group = new QTreeWidgetItem(_ui->treeWidget); 
     221                        group->setText(0, contactGroupId); 
     222                        _ui->treeWidget->setItemExpanded(group, true); 
     223                } 
    208224        } 
    209225} 
Note: See TracChangeset for help on using the changeset viewer.