mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 00:41:23 +00:00
Fixed disabling of a given preview, like image or text (it was disabling them all)
Fixed a few compiler warnings. svn path=/trunk/kdebase/libkonq/; revision=73156
This commit is contained in:
parent
73f4ec0d8f
commit
7be39bb92a
|
@ -48,10 +48,10 @@ static QPixmap *get_konqiv_buffer_pixmap( const QSize &s )
|
|||
new QPixmap( s ));
|
||||
return konqiv_buffer_pixmap;
|
||||
}
|
||||
|
||||
|
||||
konqiv_buffer_pixmap->resize( s );
|
||||
return konqiv_buffer_pixmap;
|
||||
}
|
||||
}
|
||||
|
||||
KFileIVI::KFileIVI( KonqIconViewWidget *iconview, KonqFileItem* fileitem, int size )
|
||||
: QIconViewItem( iconview, fileitem->text(),
|
||||
|
@ -154,7 +154,7 @@ void KFileIVI::paintItem( QPainter *p, const QColorGroup &c )
|
|||
f.setItalic( TRUE );
|
||||
p->setFont( f );
|
||||
}
|
||||
|
||||
|
||||
if (!KGlobal::iconLoader()->alphaBlending())
|
||||
{
|
||||
// default fallback if we're not using alphablending
|
||||
|
@ -178,9 +178,9 @@ void KFileIVI::paintItem( QPainter *p, const QColorGroup &c )
|
|||
static_cast<KonqIconViewWidget *>(iconView())->drawBackground(pbg,
|
||||
r , QPoint(0,0));
|
||||
delete pbg;
|
||||
|
||||
|
||||
QImage bgImg(background.convertToImage());
|
||||
|
||||
|
||||
// This is done to handle overlapped icons. There are no overlapped
|
||||
// icons in 98% of the cases, so I don't think it's a bad solution.
|
||||
// The right solution would be using QIconView's ItemContainer,
|
||||
|
@ -193,7 +193,7 @@ void KFileIVI::paintItem( QPainter *p, const QColorGroup &c )
|
|||
{
|
||||
if ( r.intersects( it->rect() ) &&
|
||||
( r.intersects(it->pixmapRect(false)) || r.intersects(it->textRect(false)) ) )
|
||||
static_cast<KFileIVI *>(it)->paintAlphaItem(p, cg, bgImg,
|
||||
static_cast<KFileIVI *>(it)->paintAlphaItem(p, cg, bgImg,
|
||||
unknown_icon, true, r.x(), r.y());
|
||||
it=it->nextItem();
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ void KFileIVI::paintItem( QPainter *p, const QColorGroup &c )
|
|||
{
|
||||
if ( r.intersects( it->rect() ) &&
|
||||
( r.intersects(it->pixmapRect(false)) || r.intersects(it->textRect(false)) ) )
|
||||
static_cast<KFileIVI *>(it)->paintAlphaItem(p, cg, bgImg,
|
||||
static_cast<KFileIVI *>(it)->paintAlphaItem(p, cg, bgImg,
|
||||
unknown_icon, true, r.x(), r.y());
|
||||
it=it->nextItem();
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void KFileIVI::paintAlphaItem( QPainter *p, const QColorGroup &cg,
|
|||
QPixmap *txtPixmap=0L;
|
||||
QRect txtRect=textRect(false);
|
||||
if (onBg)
|
||||
{
|
||||
{
|
||||
txtRect.moveTopLeft(QPoint(0,0));
|
||||
txtPixmap=new QPixmap(txtRect.size());
|
||||
p=new QPainter(txtPixmap);
|
||||
|
@ -228,7 +228,7 @@ void KFileIVI::paintAlphaItem( QPainter *p, const QColorGroup &cg,
|
|||
p->save();
|
||||
}
|
||||
|
||||
// antonio: The next lines have been copied from Qt and are
|
||||
// antonio: The next lines have been copied from Qt and are
|
||||
// copyrighted by Trolltech AS (1992-2000) . They also include
|
||||
// many changes by me.
|
||||
|
||||
|
@ -258,15 +258,15 @@ void KFileIVI::paintAlphaItem( QPainter *p, const QColorGroup &cg,
|
|||
p2.fillRect( pix->rect(), QBrush( cg.highlight(),
|
||||
QBrush::Dense4Pattern) );
|
||||
p2.end();
|
||||
QRect cr = pix->rect();
|
||||
//QRect cr = pix->rect();
|
||||
KAlphaPainter::draw(((onBg)? 0L : p) , *buffer, background,
|
||||
x() + ( width() - w ) / 2, y(), onBg, bgx, bgy);
|
||||
}
|
||||
} else
|
||||
KAlphaPainter::draw( ((onBg)? 0L : p),
|
||||
} else
|
||||
KAlphaPainter::draw( ((onBg)? 0L : p),
|
||||
*( pixmap() ? pixmap() : &unknown_icon), background,
|
||||
x() + ( width() - w ) / 2, y(), onBg, bgx, bgy);
|
||||
|
||||
|
||||
|
||||
p->save();
|
||||
if ( isSelected() ) {
|
||||
|
@ -298,7 +298,7 @@ void KFileIVI::paintAlphaItem( QPainter *p, const QColorGroup &cg,
|
|||
p2.begin( buffer );
|
||||
p2.fillRect( pix->rect(), QBrush( cg.highlight(), QBrush::Dense4Pattern) );
|
||||
p2.end();
|
||||
QRect cr = pix->rect();
|
||||
//QRect cr = pix->rect();
|
||||
KAlphaPainter::draw(((onBg)? 0L : p), *buffer, background,
|
||||
x(), y() + ( height() - h ) / 2 , onBg, bgx, bgy);
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ void KFileIVI::paintAlphaItem( QPainter *p, const QColorGroup &cg,
|
|||
p->restore();
|
||||
}
|
||||
|
||||
if (onBg) {
|
||||
if (onBg) {
|
||||
delete p;
|
||||
KImageEffect::paint(textRect(false).x()-bgx, textRect(false).y()-bgy, background,
|
||||
txtPixmap->convertToImage());
|
||||
|
|
|
@ -204,24 +204,25 @@ void KonqIconViewWidget::initConfig()
|
|||
setWordWrapIconText( m_pSettings->wordWrapText() );
|
||||
}
|
||||
|
||||
void KonqIconViewWidget::setIcons( int size, bool stopImagePreview )
|
||||
void KonqIconViewWidget::setIcons( int size, const char * stopImagePreviewFor )
|
||||
{
|
||||
//kdDebug(1203) << "KonqIconViewWidget::setIcons( " << size << " , " << stopImagePreview << ")" << endl;
|
||||
//kdDebug(1203) << "KonqIconViewWidget::setIcons( " << size << " , " << stopImagePreviewFor << ")" << endl;
|
||||
bool sizeChanged = (m_size != size);
|
||||
int oldGridX = gridX();
|
||||
m_size = size;
|
||||
if ( sizeChanged || stopImagePreview )
|
||||
if ( sizeChanged || stopImagePreviewFor )
|
||||
{
|
||||
calculateGridX();
|
||||
}
|
||||
// Do this even if size didn't change, since this is used by refreshMimeTypes...
|
||||
for ( QIconViewItem *it = firstItem(); it; it = it->nextItem() ) {
|
||||
KFileIVI * ivi = static_cast<KFileIVI *>( it );
|
||||
if ( stopImagePreview || !ivi->isThumbnail() )
|
||||
if ( !ivi->isThumbnail() ||
|
||||
( stopImagePreviewFor && ivi->item()->mimetype().startsWith(stopImagePreviewFor) ) )
|
||||
ivi->setIcon( size, ivi->state(),
|
||||
true, true /* perhaps we should do one big redraw instead ? */);
|
||||
}
|
||||
if ( oldGridX != gridX() || stopImagePreview )
|
||||
if ( oldGridX != gridX() || stopImagePreviewFor )
|
||||
{
|
||||
arrangeItemsInGrid( true ); // take new grid into account
|
||||
}
|
||||
|
|
|
@ -93,8 +93,9 @@ public:
|
|||
* Sets the icons of all items, and stores the @p size
|
||||
* This doesn't touch thumbnails, except @p stopImagePreview is set to true
|
||||
* Takes care of the grid, when changing the size
|
||||
* @param stopImagePreviewFor set to "image/" to make images normal again, etc.
|
||||
*/
|
||||
void setIcons( int size, bool stopImagePreview = false );
|
||||
void setIcons( int size, const char * stopImagePreviewFor = 0 );
|
||||
|
||||
/**
|
||||
* Called on databaseChanged
|
||||
|
|
|
@ -328,10 +328,9 @@ void KonqOperations::asyncDrop( const KFileItem * destItem )
|
|||
QString protocol = lst.first().protocol(); // we'll assume it's the same for all URLs (hack)
|
||||
bool sReading = KProtocolInfo::supportsReading( protocol );
|
||||
bool sDeleting = KProtocolInfo::supportsDeleting( protocol );
|
||||
bool sMoving = KProtocolInfo::supportsMoving( protocol );
|
||||
bool sMoving = KProtocolInfo::supportsMoving( protocol );
|
||||
// Check what the destination can do
|
||||
protocol = dest.protocol();
|
||||
bool dReading = KProtocolInfo::supportsReading( protocol );
|
||||
bool dWriting = KProtocolInfo::supportsWriting( protocol );
|
||||
if ( !dWriting )
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue