diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-10-02 08:41:28 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2015-12-23 02:22:49 +0100 |
commit | e25c6429ea1c1578452eb329a7a03457d57948f0 (patch) | |
tree | 214c54dc615999b7b0a2fc666d8bd7a7dbc72424 | |
parent | c6c2d982c0842c05051b4d2494f2ba3048a1e01a (diff) | |
download | tdelibs-e25c6429ea1c1578452eb329a7a03457d57948f0.tar.gz tdelibs-e25c6429ea1c1578452eb329a7a03457d57948f0.zip |
Add mimeTypePtrFast method to KFileItem
This relates to Bug 699
Clean up a couple of minor build warnings
Classify usbmisc devices
(cherry picked from commit 54578ce023227543f531a56fcc178b9e95e9ab5e)
-rw-r--r-- | kio/kfile/kfiledetailview.cpp | 6 | ||||
-rw-r--r-- | kio/kfile/kfileiconview.cpp | 6 | ||||
-rw-r--r-- | kio/kio/kfileitem.cpp | 37 | ||||
-rw-r--r-- | kio/kio/kfileitem.h | 8 |
4 files changed, 36 insertions, 21 deletions
diff --git a/kio/kfile/kfiledetailview.cpp b/kio/kfile/kfiledetailview.cpp index 823714396..e883b76bc 100644 --- a/kio/kfile/kfiledetailview.cpp +++ b/kio/kfile/kfiledetailview.cpp @@ -360,13 +360,13 @@ void KFileDetailView::slotSortingChanged( int col ) switch( col ) { case COL_NAME: - sortSpec = (sort & ~TQDir::SortByMask | TQDir::Name); + sortSpec = ((sort & ~TQDir::SortByMask) | TQDir::Name); break; case COL_SIZE: - sortSpec = (sort & ~TQDir::SortByMask | TQDir::Size); + sortSpec = ((sort & ~TQDir::SortByMask) | TQDir::Size); break; case COL_DATE: - sortSpec = (sort & ~TQDir::SortByMask | TQDir::Time); + sortSpec = ((sort & ~TQDir::SortByMask) | TQDir::Time); break; // the following columns have no equivalent in TQDir, so we set it diff --git a/kio/kfile/kfileiconview.cpp b/kio/kfile/kfileiconview.cpp index fec9158de..a762472cc 100644 --- a/kio/kfile/kfileiconview.cpp +++ b/kio/kfile/kfileiconview.cpp @@ -611,7 +611,7 @@ void KFileIconView::slotPreviewResult( KIO::Job *job ) void KFileIconView::gotPreview( const KFileItem *item, const TQPixmap& pix ) { KFileIconViewItem *it = viewItem( item ); - if ( it ) + if ( it ) { if( item->overlays() & KIcon::HiddenOverlay ) { TQPixmap p( pix ); @@ -619,8 +619,10 @@ void KFileIconView::gotPreview( const KFileItem *item, const TQPixmap& pix ) KIconEffect::semiTransparent( p ); it->setPixmap( p ); } - else + else { it->setPixmap( pix ); + } + } } bool KFileIconView::canPreview( const KFileItem *item ) const diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp index 256e47ac1..06c84d713 100644 --- a/kio/kio/kfileitem.cpp +++ b/kio/kio/kfileitem.cpp @@ -523,27 +523,32 @@ TQString KFileItem::mimetype() const TQString KFileItem::mimetypeFast() const { - if (isMimeTypeKnown()) { - return mimetype(); - } - else { - return m_pMimeType->name(); - } + if (isMimeTypeKnown()) { + return mimetype(); + } + else { + return m_pMimeType->name(); + } } -KMimeType::Ptr KFileItem::determineMimeType() +KMimeType::Ptr KFileItem::mimeTypePtrFast() { - if ( !m_pMimeType || !m_bMimeTypeKnown ) - { - bool isLocalURL; - KURL url = mostLocalURL(isLocalURL); + return m_pMimeType; +} - m_pMimeType = KMimeType::findByURL( url, m_fileMode, isLocalURL ); - //kdDebug() << "finding mimetype for " << url.url() << " : " << m_pMimeType->name() << endl; - m_bMimeTypeKnown = true; - } +KMimeType::Ptr KFileItem::determineMimeType() +{ + if ( !m_pMimeType || !m_bMimeTypeKnown ) + { + bool isLocalURL; + KURL url = mostLocalURL(isLocalURL); + + m_pMimeType = KMimeType::findByURL( url, m_fileMode, isLocalURL ); + //kdDebug() << "finding mimetype for " << url.url() << " : " << m_pMimeType->name() << endl; + m_bMimeTypeKnown = true; + } - return m_pMimeType; + return m_pMimeType; } bool KFileItem::isMimeTypeKnown() const diff --git a/kio/kio/kfileitem.h b/kio/kio/kfileitem.h index 2fdcd77ee..7c933fff7 100644 --- a/kio/kio/kfileitem.h +++ b/kio/kio/kfileitem.h @@ -322,6 +322,14 @@ public: /** * 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. * If _determineMimeTypeOnDemand was used in the constructor, this will determine * the mimetype first. * @return the mime type |