summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-09-27 18:49:29 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-09-27 18:49:29 -0500
commit3e7ad37f5617f7f571fbd7b4aeba1d492271af33 (patch)
treeb09247fdf9ddd567790acc34471ae6c0d35852e8
parent485ab965cd717c5b94bf2d941e4efa6293b57642 (diff)
downloadtdebase-3e7ad37f5617f7f571fbd7b4aeba1d492271af33.tar.gz
tdebase-3e7ad37f5617f7f571fbd7b4aeba1d492271af33.zip
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
-rw-r--r--konqueror/iconview/konq_iconview.cc6
-rw-r--r--konqueror/listview/konq_infolistviewitem.cc11
-rw-r--r--konqueror/listview/konq_infolistviewitem.h1
-rw-r--r--konqueror/listview/konq_infolistviewwidget.cc3
-rw-r--r--konqueror/listview/konq_listview.cc4
-rw-r--r--konqueror/listview/konq_listviewitems.cc8
-rw-r--r--konqueror/listview/konq_listviewitems.h2
-rw-r--r--konqueror/listview/konq_listviewwidget.cc4
-rw-r--r--konqueror/listview/konq_textviewitem.cc30
-rw-r--r--konqueror/listview/konq_textviewitem.h1
-rw-r--r--konqueror/listview/konq_textviewwidget.cc3
-rw-r--r--libkonq/tdefileivi.cc11
12 files changed, 58 insertions, 26 deletions
diff --git a/konqueror/iconview/konq_iconview.cc b/konqueror/iconview/konq_iconview.cc
index 04b2bfb51..0e754b848 100644
--- a/konqueror/iconview/konq_iconview.cc
+++ b/konqueror/iconview/konq_iconview.cc
@@ -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 {
diff --git a/konqueror/listview/konq_infolistviewitem.cc b/konqueror/listview/konq_infolistviewitem.cc
index 5f4a0f636..18efb3f8f 100644
--- a/konqueror/listview/konq_infolistviewitem.cc
+++ b/konqueror/listview/konq_infolistviewitem.cc
@@ -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
+}
diff --git a/konqueror/listview/konq_infolistviewitem.h b/konqueror/listview/konq_infolistviewitem.h
index e81928118..f4ee2d32a 100644
--- a/konqueror/listview/konq_infolistviewitem.h
+++ b/konqueror/listview/konq_infolistviewitem.h
@@ -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 );
diff --git a/konqueror/listview/konq_infolistviewwidget.cc b/konqueror/listview/konq_infolistviewwidget.cc
index fab798906..e835f1cb3 100644
--- a/konqueror/listview/konq_infolistviewwidget.cc
+++ b/konqueror/listview/konq_infolistviewwidget.cc
@@ -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 );
diff --git a/konqueror/listview/konq_listview.cc b/konqueror/listview/konq_listview.cc
index 0e329f7e7..8c9369a4c 100644
--- a/konqueror/listview/konq_listview.cc
+++ b/konqueror/listview/konq_listview.cc
@@ -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();
}
diff --git a/konqueror/listview/konq_listviewitems.cc b/konqueror/listview/konq_listviewitems.cc
index e9a14a871..d5665313f 100644
--- a/konqueror/listview/konq_listviewitems.cc
+++ b/konqueror/listview/konq_listviewitems.cc
@@ -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());
diff --git a/konqueror/listview/konq_listviewitems.h b/konqueror/listview/konq_listviewitems.h
index 6a744321c..f374daf1b 100644
--- a/konqueror/listview/konq_listviewitems.h
+++ b/konqueror/listview/konq_listviewitems.h
@@ -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; }
diff --git a/konqueror/listview/konq_listviewwidget.cc b/konqueror/listview/konq_listviewwidget.cc
index 858d7c9da..1fdb86e74 100644
--- a/konqueror/listview/konq_listviewwidget.cc
+++ b/konqueror/listview/konq_listviewwidget.cc
@@ -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;
diff --git a/konqueror/listview/konq_textviewitem.cc b/konqueror/listview/konq_textviewitem.cc
index 3919d6c82..1076e10af 100644
--- a/konqueror/listview/konq_textviewitem.cc
+++ b/konqueror/listview/konq_textviewitem.cc
@@ -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++;
+ }
+ }
+} \ No newline at end of file
diff --git a/konqueror/listview/konq_textviewitem.h b/konqueror/listview/konq_textviewitem.h
index 506c1b592..57be5a7c3 100644
--- a/konqueror/listview/konq_textviewitem.h
+++ b/konqueror/listview/konq_textviewitem.h
@@ -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:
diff --git a/konqueror/listview/konq_textviewwidget.cc b/konqueror/listview/konq_textviewwidget.cc
index 32de25351..ab227899a 100644
--- a/konqueror/listview/konq_textviewwidget.cc
+++ b/konqueror/listview/konq_textviewwidget.cc
@@ -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 );
diff --git a/libkonq/tdefileivi.cc b/libkonq/tdefileivi.cc
index 629d9a27d..08bd240ba 100644
--- a/libkonq/tdefileivi.cc
+++ b/libkonq/tdefileivi.cc
@@ -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 );
}
}