Add mimeTypePtrFast method to KFileItem

This relates to Bug 699
Clean up a couple of minor build warnings
Classify usbmisc devices
pull/16/head
Timothy Pearson 10 years ago
parent 09a4688659
commit 54578ce023

@ -2243,6 +2243,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
// Last ditch attempt at classification // Last ditch attempt at classification
// Likely inaccurate and sweeping // Likely inaccurate and sweeping
if ((devicesubsystem == "usb") if ((devicesubsystem == "usb")
|| (devicesubsystem == "usbmisc")
|| (devicesubsystem == "usb_device") || (devicesubsystem == "usb_device")
|| (devicesubsystem == "usbmon")) { || (devicesubsystem == "usbmon")) {
// Get USB interface class for further classification // Get USB interface class for further classification

@ -360,13 +360,13 @@ void KFileDetailView::slotSortingChanged( int col )
switch( col ) { switch( col ) {
case COL_NAME: case COL_NAME:
sortSpec = (sort & ~TQDir::SortByMask | TQDir::Name); sortSpec = ((sort & ~TQDir::SortByMask) | TQDir::Name);
break; break;
case COL_SIZE: case COL_SIZE:
sortSpec = (sort & ~TQDir::SortByMask | TQDir::Size); sortSpec = ((sort & ~TQDir::SortByMask) | TQDir::Size);
break; break;
case COL_DATE: case COL_DATE:
sortSpec = (sort & ~TQDir::SortByMask | TQDir::Time); sortSpec = ((sort & ~TQDir::SortByMask) | TQDir::Time);
break; break;
// the following columns have no equivalent in TQDir, so we set it // the following columns have no equivalent in TQDir, so we set it

@ -611,7 +611,7 @@ void KFileIconView::slotPreviewResult( TDEIO::Job *job )
void KFileIconView::gotPreview( const KFileItem *item, const TQPixmap& pix ) void KFileIconView::gotPreview( const KFileItem *item, const TQPixmap& pix )
{ {
KFileIconViewItem *it = viewItem( item ); KFileIconViewItem *it = viewItem( item );
if ( it ) if ( it ) {
if( item->overlays() & TDEIcon::HiddenOverlay ) if( item->overlays() & TDEIcon::HiddenOverlay )
{ {
TQPixmap p( pix ); TQPixmap p( pix );
@ -619,8 +619,10 @@ void KFileIconView::gotPreview( const KFileItem *item, const TQPixmap& pix )
TDEIconEffect::semiTransparent( p ); TDEIconEffect::semiTransparent( p );
it->setPixmap( p ); it->setPixmap( p );
} }
else else {
it->setPixmap( pix ); it->setPixmap( pix );
}
}
} }
bool KFileIconView::canPreview( const KFileItem *item ) const bool KFileIconView::canPreview( const KFileItem *item ) const

@ -556,27 +556,32 @@ TQString KFileItem::mimetype() const
TQString KFileItem::mimetypeFast() const TQString KFileItem::mimetypeFast() const
{ {
if (isMimeTypeKnown()) { if (isMimeTypeKnown()) {
return mimetype(); return mimetype();
} }
else { else {
return m_pMimeType->name(); return m_pMimeType->name();
} }
}
KMimeType::Ptr KFileItem::mimeTypePtrFast()
{
return m_pMimeType;
} }
KMimeType::Ptr KFileItem::determineMimeType() KMimeType::Ptr KFileItem::determineMimeType()
{ {
if ( !m_pMimeType || !m_bMimeTypeKnown ) if ( !m_pMimeType || !m_bMimeTypeKnown )
{ {
bool isLocalURL; bool isLocalURL;
KURL url = mostLocalURL(isLocalURL); KURL url = mostLocalURL(isLocalURL);
m_pMimeType = KMimeType::findByURL( url, m_fileMode, isLocalURL ); m_pMimeType = KMimeType::findByURL( url, m_fileMode, isLocalURL );
//kdDebug() << "finding mimetype for " << url.url() << " : " << m_pMimeType->name() << endl; //kdDebug() << "finding mimetype for " << url.url() << " : " << m_pMimeType->name() << endl;
m_bMimeTypeKnown = true; m_bMimeTypeKnown = true;
} }
return m_pMimeType; return m_pMimeType;
} }
bool KFileItem::isMimeTypeKnown() const bool KFileItem::isMimeTypeKnown() const

@ -334,6 +334,14 @@ public:
*/ */
TQString mimetypeFast() const; TQString mimetypeFast() const;
/**
* Returns the mimetype of the file item.
* If @p _determineMimeTypeOnDemand was used in the constructor, this will return
* the mimetype as fast as possible at the expense of accuracy.
* @return the fast mime type
*/
KMimeType::Ptr mimeTypePtrFast();
/** /**
* Returns the mimetype of the file item. * Returns the mimetype of the file item.
* If _determineMimeTypeOnDemand was used in the constructor, this will determine * If _determineMimeTypeOnDemand was used in the constructor, this will determine

Loading…
Cancel
Save