void KonqSidebarHistoryModule::slotNewWindow() { kdDebug(1201)<<"void KonqSidebarHistoryModule::slotNewWindow()"<<endl; QListViewItem *item = tree()->selectedItem(); KonqSidebarHistoryItem *hi = dynamic_cast<KonqSidebarHistoryItem*>( item ); if ( hi ) { kdDebug(1201)<<"void KonqSidebarHistoryModule::slotNewWindow(): emitting createNewWindow"<<endl; emit tree()->createNewWindow( hi->url() ); } }
// the group item itself will be removed automatically, // when the last child is removed void KonqSidebarHistoryGroupItem::remove() { KURL::List list; KonqSidebarHistoryItem *child = static_cast<KonqSidebarHistoryItem*>( firstChild() ); while( child ) { list.append( child->externalURL() ); child = static_cast<KonqSidebarHistoryItem*>( child->nextSibling() ); } if ( !list.isEmpty() ) KonqHistoryManager::kself()->emitRemoveFromHistory( list ); }
void KonqSidebarHistoryModule::slotRemoveEntry() { QListViewItem *item = tree()->selectedItem(); KonqSidebarHistoryItem *hi = dynamic_cast<KonqSidebarHistoryItem*>( item ); if ( hi ) // remove a single entry KonqHistoryManager::kself()->emitRemoveFromHistory( hi->externalURL()); else { // remove a group of entries KonqSidebarHistoryGroupItem *gi = dynamic_cast<KonqSidebarHistoryGroupItem*>( item ); if ( gi ) gi->remove(); } }
KonqSidebarHistoryItem * KonqSidebarHistoryGroupItem::findChild(const KonqHistoryEntry *entry) const { TQListViewItem *child = firstChild(); KonqSidebarHistoryItem *item = 0L; while ( child ) { item = static_cast<KonqSidebarHistoryItem *>( child ); if ( item->entry() == entry ) return item; child = child->nextSibling(); } return 0L; }
void KonqSidebarHistoryModule::slotEntryAdded( const KonqHistoryEntry *entry ) { if ( !m_initialized ) return; m_currentTime = QDateTime::currentDateTime(); KonqSidebarHistoryGroupItem *group = getGroupItem( entry->url ); KonqSidebarHistoryItem *item = group->findChild( entry ); if ( !item ) item = new KonqSidebarHistoryItem( entry, group, m_topLevelItem ); else item->update( entry ); // QListView scrolls when calling sort(), so we have to hack around that // (we don't want no scrolling every time an entry is added) KonqSidebarTree *t = tree(); t->lockScrolling( true ); group->sort(); m_topLevelItem->sort(); qApp->processOneEvent(); t->lockScrolling( false ); }