Repair all known Konqueror performance regressions caused by early calls to expensive mimetype operations

These accidental errors span most TDE releases and many KDE 3.x releases
This resolves Bug 699
pull/2/head
Timothy Pearson 10 years ago
parent 485ab965cd
commit 3e7ad37f56

@ -1008,7 +1008,7 @@ void KonqKfmIconView::slotNewItems( const KFileItemList& entries )
if ( fileItem->isDir() && m_pProps->isShowingDirectoryOverlays() ) {
showDirectoryOverlay(item);
}
if ( fileItem->mimetype().startsWith("media/") && fileItem->mimetype().contains("_mounted") && m_pProps->isShowingFreeSpaceOverlays() ) {
if ( fileItem->mimetypeFast().startsWith("media/") && fileItem->mimetypeFast().contains("_mounted") && m_pProps->isShowingFreeSpaceOverlays() ) {
showFreeSpaceOverlay(item);
}
@ -1207,8 +1207,8 @@ void KonqKfmIconView::slotRefreshItems( const KFileItemList& entries )
if ( !bNeedRepaint && oldSize != ivi->pixmap()->size() ) {
bNeedRepaint = true;
}
if ( (*rit)->mimetype().startsWith("media/") && m_pProps->isShowingFreeSpaceOverlays() ) {
if ((*rit)->mimetype().contains("_mounted")) {
if ( (*rit)->mimetypeFast().startsWith("media/") && m_pProps->isShowingFreeSpaceOverlays() ) {
if ((*rit)->mimetypeFast().contains("_mounted")) {
showFreeSpaceOverlay(ivi);
}
else {

@ -255,14 +255,14 @@ void KonqInfoListViewItem::paintFocus( TQPainter * _painter, const TQColorGroup
TQListViewItem::paintFocus( _painter, cg, r );
}
#if 0
void KonqBaseListViewItem::mimetypeFound()
void KonqInfoListViewItem::mimetypeFound()
{
#if 0
// Update icon
setDisabled( m_bDisabled );
uint done = 0;
KonqBaseListViewWidget * lv = static_cast<KonqBaseListViewWidget*>(listView());
for (unsigned int i=0; i<KonqBaseListViewWidget::NumberOfAtoms && done < 2; i++)
KonqBaseListViewWidget * lv = m_pListViewWidget;
for (unsigned int i=0; i<m_pListViewWidget->NumberOfAtoms && done < 2; i++)
{
ColumnInfo *tmpColumn=&lv->columnConfigInfo()[i];
if (lv->columnConfigInfo()[i].udsId==TDEIO::UDS_FILE_TYPE && tmpColumn->displayThisOne)
@ -276,6 +276,5 @@ void KonqBaseListViewItem::mimetypeFound()
done++;
}
}
}
#endif
}

@ -58,6 +58,7 @@ class KonqInfoListViewItem : public KonqBaseListViewItem
virtual void paintCell( TQPainter *_painter, const TQColorGroup & cg,
int column, int width, int alignment );
virtual void paintFocus( TQPainter * _painter, const TQColorGroup & cg, const TQRect & r );
virtual void mimetypeFound();
virtual void updateContents();
virtual void setDisabled( bool disabled );

@ -208,8 +208,9 @@ void KonqInfoListViewWidget::slotNewItems( const KFileItemList& list)
}
}
if ( !(*kit)->isMimeTypeKnown() )
if ( !(*kit)->isMimeTypeKnown() ) {
m_pBrowserView->lstPendingMimeIconItems().append( tmp );
}
}
m_pBrowserView->newItems( list );

@ -348,6 +348,10 @@ void KonqListView::determineIcon( KonqBaseListViewItem * item )
//if ( oldSerial != newIcon.serialNumber() )
// item->setPixmap( 0, newIcon );
if (item->item()->isMimeTypeKnown()) {
item->mimetypeFound();
}
// We also have columns to update, not only the icon
item->updateContents();
}

@ -106,10 +106,14 @@ void KonqListViewItem::updateContents()
setText(tmpColumn->displayInColumn,m_fileitem->group());
break;
case TDEIO::UDS_FILE_TYPE:
setText(tmpColumn->displayInColumn,m_fileitem->mimeComment());
if (m_fileitem->isMimeTypeKnown()) {
setText(tmpColumn->displayInColumn,m_fileitem->mimeComment());
}
break;
case TDEIO::UDS_MIME_TYPE:
setText(tmpColumn->displayInColumn,m_fileitem->mimetype());
if (m_fileitem->isMimeTypeKnown()) {
setText(tmpColumn->displayInColumn,m_fileitem->mimetype());
}
break;
case TDEIO::UDS_URL:
setText(tmpColumn->displayInColumn,m_fileitem->url().prettyURL());

@ -48,7 +48,7 @@ class KonqBaseListViewItem : public TDEListViewItem
/** @return the file item held by this instance */
KFileItem * item() { return m_fileitem; }
void mimetypeFound();
virtual void mimetypeFound();
virtual void updateContents() = 0;
virtual void setDisabled( bool disabled ) { m_bDisabled = disabled; }
virtual void setActive ( bool active ) { m_bActive = active; }

@ -236,9 +236,9 @@ void KonqBaseListViewWidget::readProtocolConfig( const KURL & url )
lstColumns << column;
const TQString type = (*extraFieldsIt).type; // ## TODO use when sorting
TQVariant::Type t = TQVariant::Invalid;
if ( type.lower() == "qstring" )
if ( type.lower() == TQString(TQSTRING_OBJECT_NAME_STRING).lower() )
t = TQVariant::String;
else if ( type.lower() == "qdatetime" )
else if ( type.lower() == TQString(TQDATETIME_OBJECT_NAME_STRING).lower() )
t = TQVariant::DateTime;
else
kdWarning() << "Unsupported ExtraType '" << type << "'" << endl;

@ -161,10 +161,14 @@ void KonqTextViewItem::updateContents()
setText(tmpColumn->displayInColumn,m_fileitem->linkDest());
break;
case TDEIO::UDS_FILE_TYPE:
setText(tmpColumn->displayInColumn,m_fileitem->mimeComment());
if (m_fileitem->isMimeTypeKnown()) {
setText(tmpColumn->displayInColumn,m_fileitem->mimeComment());
}
break;
case TDEIO::UDS_MIME_TYPE:
setText(tmpColumn->displayInColumn,m_fileitem->mimetype());
if (m_fileitem->isMimeTypeKnown()) {
setText(tmpColumn->displayInColumn,m_fileitem->mimetype());
}
break;
case TDEIO::UDS_URL:
setText(tmpColumn->displayInColumn,m_fileitem->url().prettyURL());
@ -230,3 +234,25 @@ void KonqTextViewItem::setup()
if ( h % 2 > 0 ) h++;
setHeight(h);
}
void KonqTextViewItem::mimetypeFound()
{
// Update icon
setDisabled( m_bDisabled );
uint done = 0;
KonqBaseListViewWidget * lv = m_pListViewWidget;
for (unsigned int i=0; i<m_pListViewWidget->NumberOfAtoms && done < 2; i++)
{
ColumnInfo *tmpColumn=&lv->columnConfigInfo()[i];
if (lv->columnConfigInfo()[i].udsId==TDEIO::UDS_FILE_TYPE && tmpColumn->displayThisOne)
{
setText(tmpColumn->displayInColumn, m_fileitem->mimeComment());
done++;
}
if (lv->columnConfigInfo()[i].udsId==TDEIO::UDS_MIME_TYPE && tmpColumn->displayThisOne)
{
setText(tmpColumn->displayInColumn, m_fileitem->mimetype());
done++;
}
}
}

@ -59,6 +59,7 @@ class KonqTextViewItem : public KonqBaseListViewItem
* on the view)*/
virtual void paintCell( TQPainter *_painter, const TQColorGroup & _cg, int _column, int _width, int _alignment );
// virtual void paintFocus( TQPainter *_painter, const TQColorGroup & _cg, const TQRect & r );
virtual void mimetypeFound();
virtual void updateContents();
protected:

@ -94,7 +94,8 @@ void KonqTextViewWidget::slotNewItems( const KFileItemList & entries )
setSelected( tmp, true );
}
}
if ( !(*kit)->isMimeTypeKnown() )
m_pBrowserView->lstPendingMimeIconItems().append( tmp );
}
m_pBrowserView->newItems( entries );

@ -570,14 +570,9 @@ void KFileIVI::updatePixmapSize()
KonqIconViewWidget* view = static_cast<KonqIconViewWidget*>( iconView() );
if ( view && view->canPreview( item() ) ) {
int previewSize = view->previewIconSize( size );
setPixmapSize( TQSize( previewSize, previewSize ) );
}
else {
TQSize pixSize = TQSize( size, size );
if ( pixSize != pixmapSize() )
setPixmapSize( pixSize );
TQSize pixSize = TQSize( size, size );
if ( pixSize != pixmapSize() ) {
setPixmapSize( pixSize );
}
}

Loading…
Cancel
Save