1 #ifndef __FOLDERVIEWTOOLTIP_H__ 2 #define __FOLDERVIEWTOOLTIP_H__ 4 #include <kmfoldercachedimap.h> 10 class FolderViewToolTip : public TQToolTip 13 FolderViewToolTip( TQListView* parent ) : 14 TQToolTip( parent->viewport() ), 15 mListView( parent ) {} 18 void maybeTip( const TQPoint &point ) 20 KMFolderTreeItem *item = dynamic_cast<KMFolderTreeItem* >( mListView->itemAt( point ) ); 23 const TQRect itemRect = mListView->itemRect( item ); 24 if ( !itemRect.isValid() ) 26 const TQRect headerRect = mListView->header()->sectionRect( 0 ); 27 if ( !headerRect.isValid() ) 30 if ( !item->folder() || item->folder()->noContent() ) 34 TQString tipText = i18n( "<qt><b>%1</b><br>Total: %2<br>Unread: %3<br>Size: %4" ) 35 .arg( item->folder()->prettyURL().replace( " ", " " ) ) 36 .arg( item->totalCount() < 0 ? "-" : TQString::number( item->totalCount() ) ) 37 .arg( item->unreadCount() < 0 ? "-" : TQString::number( item->unreadCount() ) ) 38 .arg( TDEIO::convertSize( item->folderSize() ) ); 40 if ( KMFolderCachedImap* imap = dynamic_cast<KMFolderCachedImap*>( item->folder()->storage() ) ) { 41 QuotaInfo info = imap->quotaInfo(); 42 if ( info.isValid() && !info.isEmpty() ) 43 tipText += i18n( "<br>Quota: %1").arg( info.toString() ); 46 tip( TQRect( headerRect.left(), itemRect.top(), headerRect.width(), itemRect.height() ), tipText ); 50 TQListView *mListView;
|