diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /kmail/folderviewtooltip.h | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/folderviewtooltip.h')
-rw-r--r-- | kmail/folderviewtooltip.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/kmail/folderviewtooltip.h b/kmail/folderviewtooltip.h new file mode 100644 index 000000000..55afa1a0e --- /dev/null +++ b/kmail/folderviewtooltip.h @@ -0,0 +1,55 @@ +#ifndef __FOLDERVIEWTOOLTIP_H__ +#define __FOLDERVIEWTOOLTIP_H__ + +#include <kmfoldercachedimap.h> + +#include <qtooltip.h> + +namespace KMail { + +class FolderViewToolTip : public QToolTip +{ + public: + FolderViewToolTip( QListView* parent ) : + QToolTip( parent->viewport() ), + mListView( parent ) {} + + protected: + void maybeTip( const QPoint &point ) + { + KMFolderTreeItem *item = dynamic_cast<KMFolderTreeItem*>( mListView->itemAt( point ) ); + if ( !item ) + return; + const QRect itemRect = mListView->itemRect( item ); + if ( !itemRect.isValid() ) + return; + const QRect headerRect = mListView->header()->sectionRect( 0 ); + if ( !headerRect.isValid() ) + return; + + if ( !item->folder() || item->folder()->noContent() ) + return; + + item->updateCount(); + QString tipText = i18n("<qt><b>%1</b><br>Total: %2<br>Unread: %3<br>Size: %4" ) + .arg( item->folder()->prettyURL().replace( " ", " " ) ) + .arg( item->totalCount() < 0 ? "-" : QString::number( item->totalCount() ) ) + .arg( item->unreadCount() < 0 ? "-" : QString::number( item->unreadCount() ) ) + .arg( KIO::convertSize( item->folderSize() ) ); + + if ( KMFolderCachedImap* imap = dynamic_cast<KMFolderCachedImap*>( item->folder()->storage() ) ) { + QuotaInfo info = imap->quotaInfo(); + if ( info.isValid() && !info.isEmpty() ) + tipText += i18n("<br>Quota: %1").arg( info.toString() ); + } + + tip( QRect( headerRect.left(), itemRect.top(), headerRect.width(), itemRect.height() ), tipText ); + } + + private: + QListView *mListView; +}; + +} + +#endif /* __FOLDERVIEWTOOLTIP_H__ */ |