source/MainGUI.cpp
/**
 * Slot which is emiited when a new friend information was received.
 *
 * @param f The friend.
 */
Slot which is emiited when a new friend information was received.
@param f The friend.
Slot which is emiited when a new friend information was received . @param f The friend .
void MainGUI::updateFriend(Friend* f)
{
    for (int i = 0; i < widget.friendList->count(); ++i)
    {
        Friend* storedFriend = VariantUtil<Friend>::toPointer(widget.friendList->item(i)->data(ROLE_FRIEND));
        if (storedFriend->getEntryNumber() == f->getEntryNumber())
        {
            storedFriend->setLocation(f->getLocation());
            storedFriend->setStatus(f->getStatus());
            storedFriend->setProduct(f->getProduct());
            storedFriend->setLocationName(f->getLocationName());
            delete widget.friendList->takeItem(i);
            addFriend(storedFriend);
            break;
        }
    }
    delete f;
}
void MainGUI :: updateFriend ( Friend * f ) { for ( int i = 0 ; i < widget . friendList -> count ( ) ; ++ i ) { Friend * storedFriend = VariantUtil < Friend > :: toPointer ( widget . friendList -> item ( i ) -> data ( ROLE_FRIEND ) ) ; if ( storedFriend -> getEntryNumber ( ) == f -> getEntryNumber ( ) ) { storedFriend -> setLocation ( f -> getLocation ( ) ) ; storedFriend -> setStatus ( f -> getStatus ( ) ) ; storedFriend -> setProduct ( f -> getProduct ( ) ) ; storedFriend -> setLocationName ( f -> getLocationName ( ) ) ; delete widget . friendList -> takeItem ( i ) ; addFriend ( storedFriend ) ; break ; } } delete f ; }
Slot which is emiited when a new friend information was received.
Slot which is emiited when a new friend information was received .
// Readd the friend to display the updates.