コード例 #1
0
void FavoriteFolderView::folderTreeSelectionChanged(KMFolder *folder)
{
    blockSignals(true);
    bool found = false;
    for(QListViewItemIterator it(this); it.current(); ++it)
    {
        KMFolderTreeItem *fti = static_cast<KMFolderTreeItem *>(it.current());
        if(fti->folder() == folder && !fti->isSelected())
        {
            fti->setSelected(true);
            setCurrentItem(fti);
            ensureItemVisible(fti);
            fti->repaint();
            found = true;
        }
        else if(fti->folder() != folder && fti->isSelected())
        {
            fti->setSelected(false);
            fti->repaint();
        }
    }
    blockSignals(false);
    if(!found)
    {
        clearSelection();
        setSelectionModeExt(KListView::NoSelection);
        setSelectionModeExt(KListView::Single);
    }
}
コード例 #2
0
void FavoriteFolderView::refresh()
{
  for ( QListViewItemIterator it( this ) ; it.current() ; ++it ) {
    KMFolderTreeItem* fti = static_cast<KMFolderTreeItem*>(it.current());
    if (!fti || !fti->folder())
      continue;
    fti->repaint();
  }
  update();
}