Fixed fill of the items in PeersDialog

- First fill is made again by showEvent and not from the timer. I overloaded showEvent in one of my last commit and forgot to call the base class.
- Add the items directly after the "new" to the tree, because for "setHidden" the item must be added.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3465 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-10 20:43:11 +00:00
parent cbdb717e51
commit d85ec3acf2

View File

@ -327,6 +327,8 @@ void PeersDialog::showEvent(QShowEvent *event)
QScrollBar *scrollbar = ui.msgText->verticalScrollBar();
scrollbar->setValue(scrollbar->maximum());
}
RsAutoUpdatePage::showEvent(event);
}
void PeersDialog::pasteLink()
@ -566,11 +568,13 @@ void PeersDialog::insertPeers()
continue;
}
bool bNew = false;
if (gpg_item == NULL) {
gpg_item = new MyPeerTreeWidgetItem(peertreeWidget, 0); //set type to 0 for custom popup menu
/* Add gpg item to the list. Add here, because for setHidden the item must be added */
peertreeWidget->addTopLevelItem(gpg_item);
gpg_item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
bNew = true;
}
gpg_item -> setText(COLUMN_NAME, QString::fromStdString(detail.name));
@ -630,6 +634,14 @@ void PeersDialog::insertPeers()
if (newChild) {
sslItem = new MyPeerTreeWidgetItem(peertreeWidget, 1); //set type to 1 for custom popup menu
#ifdef PEERS_DEBUG
std::cerr << "PeersDialog::insertPeers() inserting sslItem." << std::endl;
#endif
/* Add ssl child to the list. Add here, because for setHidden the item must be added */
gpg_item->addChild(sslItem);
// gpg_item->setExpanded(true);
}
/* not displayed, used to find back the item */
@ -694,15 +706,6 @@ void PeersDialog::insertPeers()
sslItem -> setTextColor(i, sslColor);
sslItem -> setFont(i, sslFont);
}
#ifdef PEERS_DEBUG
std::cerr << "PeersDialog::insertPeers() inserting sslItem." << std::endl;
#endif
/* add ssl child to the list. If item is already in the list, it won't be duplicated thanks to Qt */
if (newChild) {
gpg_item->addChild(sslItem);
gpg_item->setExpanded(true);
}
}
int i = 0;
@ -847,11 +850,6 @@ void PeersDialog::insertPeers()
}
gpg_item -> setIcon(COLUMN_NAME, gpgIcon);
if (bNew) {
/* add gpg item to the list */
peertreeWidget->addTopLevelItem(gpg_item);
}
}
QTreeWidgetItem *c = getCurrentPeer();