184
184
void updateInfo(const DiscoItem &);
185
185
void updateItemsFinished(const DiscoList &);
186
186
void autoItemsChildren() const; // automatically call disco#items for children :-)
187
QString hash() { return computeHash( item().jid().full(), item().node() ); }
188
QString computeHash( QString jid, QString node );
188
190
// helper functions
189
191
void init(DiscoItem it, DiscoData *dd);
529
531
alreadyItems = true;
534
QString DiscoListItem::computeHash( QString jid, QString node )
536
QString ret = jid.replace( '@', "\\@" );
538
ret += node.replace( '@', "\\@" );
532
542
void DiscoListItem::updateItemsFinished(const DiscoList &list)
544
QDict<DiscoListItem> children;
545
DiscoListItem *child = (DiscoListItem *)firstChild();
547
children.insert( child->hash(), child );
549
child = (DiscoListItem *)child->nextSibling();
534
552
// add/update items
535
553
for(DiscoList::ConstIterator it = list.begin(); it != list.end(); ++it) {
536
554
const DiscoItem a = *it;
539
DiscoListItem *child = (DiscoListItem *)firstChild();
541
if ( child->item().jid().full() == a.jid().full() &&
542
child->item().node() == a.node() )
544
child->copyItem ( a );
549
child = (DiscoListItem *)child->nextSibling();
556
QString key = computeHash(a.jid().full(), a.node());
557
DiscoListItem *child = children[ key ];
560
child->copyItem ( a );
561
children.remove( key );
553
564
new DiscoListItem (a, d, this);
556
// check for removed items
557
QPtrList<DiscoListItem> removeList;
558
removeList.setAutoDelete (true);
559
DiscoListItem *child = (DiscoListItem *)firstChild();
563
for(DiscoList::ConstIterator it = list.begin(); it != list.end(); ++it) {
564
const DiscoItem a = *it;
566
if ( child->item().jid().full() == a.jid().full() &&
567
child->item().node() == a.node() )
575
removeList.append ( child ); // items will be deleted later
577
child = (DiscoListItem *)child->nextSibling();
568
// remove all items that are not on new DiscoList
569
children.setAutoDelete( true );
581
572
if ( autoItems && isOpen() )
582
573
autoItemsChildren();
799
790
IconAction *actBrowse, *actBack, *actForward, *actRefresh, *actStop;
801
792
// custom actions, that will be added to toolbar and context menu
915
906
sm->setMapping(actAdd, Features::FID_Add);
917
908
// create toolbar
918
toolBar = new QToolBar(dlg);
909
toolBar = new PsiToolBar(dlg);
910
toolBar->setCustomizeable( false );
920
912
actBack->addTo(toolBar);
921
913
actBrowse->addTo(toolBar);