Пример #1
0
bool KFileItemListWidgetInformant::itemIsLink(int index, const KItemListView* view) const
{
    Q_ASSERT(qobject_cast<KFileItemModel*>(view->model()));
    KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(view->model());

    const KFileItem item = fileItemModel->fileItem(index);
    return item.isLink();
}
Пример #2
0
void KFileItemListView::initializeItemListWidget(KItemListWidget* item)
{
    KStandardItemListView::initializeItemListWidget(item);

    // Make sure that the item has an icon.
    QHash<QByteArray, QVariant> data = item->data();
    if (!data.contains("iconName") && data["iconPixmap"].value<QPixmap>().isNull()) {
        Q_ASSERT(qobject_cast<KFileItemModel*>(model()));
        KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(model());

        const KFileItem fileItem = fileItemModel->fileItem(item->index());
        data.insert("iconName", fileItem.iconName());
        item->setData(data, QSet<QByteArray>() << "iconName");
    }
}