kmail

folderviewtooltip.h
1 #ifndef __FOLDERVIEWTOOLTIP_H__
2 #define __FOLDERVIEWTOOLTIP_H__
3 
4 #include <kmfoldercachedimap.h>
5 
6 #include <tqtooltip.h>
7 
8 namespace KMail {
9 
10 class FolderViewToolTip : public TQToolTip
11 {
12  public:
13  FolderViewToolTip( TQListView* parent ) :
14  TQToolTip( parent->viewport() ),
15  mListView( parent ) {}
16 
17  protected:
18  void maybeTip( const TQPoint &point )
19  {
20  KMFolderTreeItem *item = dynamic_cast<KMFolderTreeItem*>( mListView->itemAt( point ) );
21  if ( !item )
22  return;
23  const TQRect itemRect = mListView->itemRect( item );
24  if ( !itemRect.isValid() )
25  return;
26  const TQRect headerRect = mListView->header()->sectionRect( 0 );
27  if ( !headerRect.isValid() )
28  return;
29 
30  if ( !item->folder() || item->folder()->noContent() )
31  return;
32 
33  item->updateCount();
34  TQString tipText = i18n("<qt><b>%1</b><br>Total: %2<br>Unread: %3<br>Size: %4" )
35  .arg( item->folder()->prettyURL().replace( " ", "&nbsp;" ) )
36  .arg( item->totalCount() < 0 ? "-" : TQString::number( item->totalCount() ) )
37  .arg( item->unreadCount() < 0 ? "-" : TQString::number( item->unreadCount() ) )
38  .arg( TDEIO::convertSize( item->folderSize() ) );
39 
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() );
44  }
45 
46  tip( TQRect( headerRect.left(), itemRect.top(), headerRect.width(), itemRect.height() ), tipText );
47  }
48 
49  private:
50  TQListView *mListView;
51 };
52 
53 }
54 
55 #endif /* __FOLDERVIEWTOOLTIP_H__ */
folderdiaquotatab.h
Definition: aboutdata.cpp:40