diff options
-rw-r--r-- | konqueror/iconview/konq_iconview.cc | 6 | ||||
-rw-r--r-- | libkonq/konq_iconviewwidget.cc | 12 | ||||
-rw-r--r-- | libkonq/tdefileivi.cc | 38 | ||||
-rw-r--r-- | libkonq/tdefileivi.h | 4 |
4 files changed, 50 insertions, 10 deletions
diff --git a/konqueror/iconview/konq_iconview.cc b/konqueror/iconview/konq_iconview.cc index 0e754b848..3b6432d1e 100644 --- a/konqueror/iconview/konq_iconview.cc +++ b/konqueror/iconview/konq_iconview.cc @@ -1108,8 +1108,6 @@ void KonqKfmIconView::showDirectoryOverlay(KFileIVI* item) void KonqKfmIconView::showFreeSpaceOverlay(KFileIVI* item) { - KFileItem* fileItem = item->item(); - m_paOutstandingFreeSpaceOverlays.append(item); if (m_paOutstandingFreeSpaceOverlays.count() == 1) { @@ -1296,6 +1294,10 @@ void KonqKfmIconView::determineIcon( KFileIVI * item ) (void) item->item()->determineMimeType(); + if (item->item()->isMimeTypeKnown()) { + item->mimeTypeAndIconDetermined(); + } + item->setIcon( iconSize(), item->state(), true, true ); item->setMouseOverAnimation( item->item()->iconName() ); } diff --git a/libkonq/konq_iconviewwidget.cc b/libkonq/konq_iconviewwidget.cc index 8cb222659..96e04df29 100644 --- a/libkonq/konq_iconviewwidget.cc +++ b/libkonq/konq_iconviewwidget.cc @@ -709,14 +709,16 @@ void KonqIconViewWidget::setItemTextPos( ItemTextPos pos ) // can't call gridXValue() because this already would need the new itemTextPos() int sz = m_size ? m_size : TDEGlobal::iconLoader()->currentSize( TDEIcon::Desktop ); - if ( m_bSetGridX ) - if ( pos == TQIconView::Bottom ) + if ( m_bSetGridX ) { + if ( pos == TQIconView::Bottom ) { setGridX( TQMAX( sz + 50, previewIconSize( sz ) + 13 ) ); + } else { setMaxItemWidth( TQMAX( sz, previewIconSize( sz ) ) + m_pSettings->iconTextWidth() ); setGridX( -1 ); } + } TDEIconView::setItemTextPos( pos ); } @@ -773,14 +775,16 @@ void KonqIconViewWidget::gridValues( int* x, int* y, int* dx, int* dy, void KonqIconViewWidget::calculateGridX() { - if ( m_bSetGridX ) - if ( itemTextPos() == TQIconView::Bottom ) + if ( m_bSetGridX ) { + if ( itemTextPos() == TQIconView::Bottom ) { setGridX( gridXValue() ); + } else { setMaxItemWidth( gridXValue() ); setGridX( -1 ); } + } } int KonqIconViewWidget::gridXValue() const diff --git a/libkonq/tdefileivi.cc b/libkonq/tdefileivi.cc index 08bd240ba..2e23cfbf7 100644 --- a/libkonq/tdefileivi.cc +++ b/libkonq/tdefileivi.cc @@ -570,10 +570,42 @@ void KFileIVI::updatePixmapSize() KonqIconViewWidget* view = static_cast<KonqIconViewWidget*>( iconView() ); - TQSize pixSize = TQSize( size, size ); - if ( pixSize != pixmapSize() ) { - setPixmapSize( pixSize ); + bool mimeDetermined = false; + if ( m_fileitem->isMimeTypeKnown() ) { + mimeDetermined = true; } + + if (mimeDetermined) { + bool changed = false; + if ( view && view->canPreview( item() ) ) { + int previewSize = view->previewIconSize( size ); + if (previewSize != size) { + setPixmapSize( TQSize( previewSize, previewSize ) ); + changed = true; + } + } + else { + TQSize pixSize = TQSize( size, size ); + if ( pixSize != pixmapSize() ) { + setPixmapSize( pixSize ); + changed = true; + } + } + if (changed) { + view->adjustItems(); + } + } + else { + TQSize pixSize = TQSize( size, size ); + if ( pixSize != pixmapSize() ) { + setPixmapSize( pixSize ); + } + } +} + +void KFileIVI::mimeTypeAndIconDetermined() +{ + updatePixmapSize(); } /* vim: set noet sw=4 ts=8 softtabstop=4: */ diff --git a/libkonq/tdefileivi.h b/libkonq/tdefileivi.h index 243688d43..4701fb9c1 100644 --- a/libkonq/tdefileivi.h +++ b/libkonq/tdefileivi.h @@ -208,6 +208,8 @@ public: virtual int compare( TQIconViewItem *i ) const; + void mimeTypeAndIconDetermined(); + protected: virtual void dropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ); @@ -240,7 +242,7 @@ private: /** Check if a thumbnail will be generated and calc the size of the icon */ void updatePixmapSize(); - + int m_size, m_state; bool m_bDisabled; bool m_bThumbnail; |