- updateTimersInterval();
-}
-
-QSizeF KFileItemListView::visibleRoleSizeHint(int index, const QByteArray& role) const
-{
- const KItemListStyleOption& option = styleOption();
-
- qreal width = m_minimumRolesWidths.value(role, 0);
- const qreal height = option.padding * 2 + option.fontMetrics.height();
-
- const QHash<QByteArray, QVariant> values = model()->data(index);
- const QString text = KFileItemListWidget::roleText(role, values);
- if (!text.isEmpty()) {
- const qreal columnPadding = option.padding * 3;
- width = qMax(width, qreal(2 * columnPadding + option.fontMetrics.width(text)));
- }
-
- if (role == "name") {
- // Increase the width by the expansion-toggle and the current expansion level
- const int expandedParentsCount = values.value("expandedParentsCount", 0).toInt();
- width += option.padding + expandedParentsCount * itemSize().height() + KIconLoader::SizeSmall;
-
- // Increase the width by the required space for the icon
- width += option.padding * 2 + option.iconSize;
- }
-
- return QSizeF(width, height);
-}
-
-void KFileItemListView::updateLayoutOfVisibleItems()
-{
- if (!model()) {
- return;
- }
-
- foreach (KItemListWidget* widget, visibleItemListWidgets()) {
- initializeItemListWidget(widget);
- }
- triggerVisibleIndexRangeUpdate();
-}
-
-void KFileItemListView::updateTimersInterval()
-{
- if (!model()) {
- return;
- }
-
- // The ShortInterval is used for cases like switching the directory: If the
- // model is empty and filled later the creation of the previews should be done
- // as soon as possible. The LongInterval is used when the model already contains
- // items and assures that operations like zooming don't result in too many temporary
- // recreations of the previews.
-
- const int interval = (model()->count() <= 0) ? ShortInterval : LongInterval;
- m_updateVisibleIndexRangeTimer->setInterval(interval);
- m_updateIconSizeTimer->setInterval(interval);
-}
-
-void KFileItemListView::updateMinimumRolesWidths()
-{
- m_minimumRolesWidths.clear();
-
- const KItemListStyleOption& option = styleOption();
- const QString sizeText = QLatin1String("888888") + i18nc("@item:intable", "items");
- m_minimumRolesWidths.insert("size", option.fontMetrics.width(sizeText));