diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /libkdepim/kfoldertree.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdepim/kfoldertree.cpp')
-rw-r--r-- | libkdepim/kfoldertree.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/libkdepim/kfoldertree.cpp b/libkdepim/kfoldertree.cpp index 64c4457dc..5e2636738 100644 --- a/libkdepim/kfoldertree.cpp +++ b/libkdepim/kfoldertree.cpp @@ -6,13 +6,13 @@ #include <kiconloader.h> #include <kdebug.h> #include <kstringhandler.h> -#include <qpainter.h> -#include <qapplication.h> -#include <qheader.h> -#include <qstyle.h> +#include <tqpainter.h> +#include <tqapplication.h> +#include <tqheader.h> +#include <tqstyle.h> //----------------------------------------------------------------------------- -KFolderTreeItem::KFolderTreeItem( KFolderTree *parent, const QString & label, +KFolderTreeItem::KFolderTreeItem( KFolderTree *parent, const TQString & label, Protocol protocol, Type type ) : KListViewItem( parent, label ), mProtocol( protocol ), mType( type ), mUnread(-1), mTotal(0), mSize(0), mFolderIsCloseToQuota( false ) @@ -21,7 +21,7 @@ KFolderTreeItem::KFolderTreeItem( KFolderTree *parent, const QString & label, //----------------------------------------------------------------------------- KFolderTreeItem::KFolderTreeItem( KFolderTreeItem *parent, - const QString & label, Protocol protocol, Type type, + const TQString & label, Protocol protocol, Type type, int unread, int total ) : KListViewItem( parent, label ), mProtocol( protocol ), mType( type ), mUnread( unread ), mTotal( total ), mSize(0), mFolderIsCloseToQuota( false ) @@ -82,7 +82,7 @@ int KFolderTreeItem::typeSortingKey() const } //----------------------------------------------------------------------------- -int KFolderTreeItem::compare( QListViewItem * i, int col, bool ) const +int KFolderTreeItem::compare( TQListViewItem * i, int col, bool ) const { KFolderTreeItem* other = static_cast<KFolderTreeItem*>( i ); @@ -149,7 +149,7 @@ void KFolderTreeItem::setUnreadCount( int aUnread ) mUnread = aUnread; - QString unread = QString::null; + TQString unread = TQString::null; if (mUnread == 0) unread = "- "; else { @@ -168,7 +168,7 @@ void KFolderTreeItem::setTotalCount( int aTotal ) mTotal = aTotal; - QString total = QString::null; + TQString total = TQString::null; if (mTotal == 0) total = "- "; else { @@ -187,7 +187,7 @@ void KFolderTreeItem::setFolderSize( Q_INT64 aSize ) mSize = aSize; - QString size; + TQString size; if (mType != Root) { if (mSize == 0 && (childCount() == 0 || isOpen() ) ) size = "- "; @@ -198,7 +198,7 @@ void KFolderTreeItem::setFolderSize( Q_INT64 aSize ) Q_INT64 recursiveSize = recursiveFolderSize(); if ( recursiveSize != mSize ) { if ( mType != Root ) - size += QString::fromLatin1(" + %1").arg( KIO::convertSize( recursiveSize - mSize ) ); + size += TQString::fromLatin1(" + %1").arg( KIO::convertSize( recursiveSize - mSize ) ); else size = KIO::convertSize( recursiveSize ); } @@ -213,7 +213,7 @@ Q_INT64 KFolderTreeItem::recursiveFolderSize() const { Q_INT64 size = mSize; - for ( QListViewItem *item = firstChild() ; + for ( TQListViewItem *item = firstChild() ; item ; item = item->nextSibling() ) { size += static_cast<KFolderTreeItem*>(item)->recursiveFolderSize(); @@ -228,7 +228,7 @@ int KFolderTreeItem::countUnreadRecursive() { int count = (mUnread > 0) ? mUnread : 0; - for ( QListViewItem *item = firstChild() ; + for ( TQListViewItem *item = firstChild() ; item ; item = item->nextSibling() ) { count += static_cast<KFolderTreeItem*>(item)->countUnreadRecursive(); @@ -238,7 +238,7 @@ int KFolderTreeItem::countUnreadRecursive() } //----------------------------------------------------------------------------- -void KFolderTreeItem::paintCell( QPainter * p, const QColorGroup & cg, +void KFolderTreeItem::paintCell( TQPainter * p, const TQColorGroup & cg, int column, int width, int align ) { KFolderTree *ft = static_cast<KFolderTree*>(listView()); @@ -248,10 +248,10 @@ void KFolderTreeItem::paintCell( QPainter * p, const QColorGroup & cg, // use a special color for folders which are close to their quota - QColorGroup mycg = cg; + TQColorGroup mycg = cg; if ( ( column == 0 || column == ft->sizeIndex() ) && folderIsCloseToQuota() ) { - mycg.setColor( QColorGroup::Text, ft->paintInfo().colCloseToQuota ); + mycg.setColor( TQColorGroup::Text, ft->paintInfo().colCloseToQuota ); } // use a bold-font for the folder- and the unread-columns @@ -259,8 +259,8 @@ void KFolderTreeItem::paintCell( QPainter * p, const QColorGroup & cg, && ( unreadCount > 0 || ( !isOpen() && unreadRecursiveCount > 0 ) ) ) { - QFont f = p->font(); - f.setWeight(QFont::Bold); + TQFont f = p->font(); + f.setWeight(TQFont::Bold); p->setFont(f); } @@ -276,8 +276,8 @@ void KFolderTreeItem::paintCell( QPainter * p, const QColorGroup & cg, if ( ft->isUnreadActive() || column != 0 ) { KListViewItem::paintCell( p, mycg, column, width, align ); } else { - QListView *lv = listView(); - QString oldText = text(column); + TQListView *lv = listView(); + TQString oldText = text(column); // set an empty text so that we can have our own implementation (see further down) // but still benefit from KListView::paintCell @@ -285,7 +285,7 @@ void KFolderTreeItem::paintCell( QPainter * p, const QColorGroup & cg, KListViewItem::paintCell( p, mycg, column, width, align ); - const QPixmap *icon = pixmap( column ); + const TQPixmap *icon = pixmap( column ); int marg = lv ? lv->itemMargin() : 1; int r = marg; @@ -293,35 +293,35 @@ void KFolderTreeItem::paintCell( QPainter * p, const QColorGroup & cg, if ( isSelected() ) p->setPen( mycg.highlightedText() ); else - p->setPen( mycg.color( QColorGroup::Text ) ); + p->setPen( mycg.color( TQColorGroup::Text ) ); if ( icon ) { r += icon->width() + marg; } - QString t = text( column ); + TQString t = text( column ); if (t.isEmpty()) return; // draw the unread-count if the unread-column is not active - QString unread; + TQString unread; if ( unreadCount > 0 || ( !isOpen() && unreadRecursiveCount > 0 ) ) { if ( isOpen() ) - unread = " (" + QString::number( unreadCount ) + ")"; + unread = " (" + TQString::number( unreadCount ) + ")"; else if ( unreadRecursiveCount == unreadCount || mType == Root ) - unread = " (" + QString::number( unreadRecursiveCount ) + ")"; + unread = " (" + TQString::number( unreadRecursiveCount ) + ")"; else - unread = " (" + QString::number( unreadCount ) + " + " + - QString::number( unreadRecursiveCount-unreadCount ) + ")"; + unread = " (" + TQString::number( unreadCount ) + " + " + + TQString::number( unreadRecursiveCount-unreadCount ) + ")"; } // check if the text needs to be squeezed - QFontMetrics fm( p->fontMetrics() ); + TQFontMetrics fm( p->fontMetrics() ); int unreadWidth = fm.width( unread ); if ( fm.width( t ) + marg + r + unreadWidth > width ) t = squeezeFolderName( t, fm, width - marg - r - unreadWidth ); - QRect br; + TQRect br; p->drawText( r, 0, width-marg-r, height(), align | AlignVCenter, t, -1, &br ); @@ -335,8 +335,8 @@ void KFolderTreeItem::paintCell( QPainter * p, const QColorGroup & cg, } -QString KFolderTreeItem::squeezeFolderName( const QString &text, - const QFontMetrics &fm, +TQString KFolderTreeItem::squeezeFolderName( const TQString &text, + const TQFontMetrics &fm, uint width ) const { return KStringHandler::rPixelSqueeze( text, fm, width ); @@ -359,7 +359,7 @@ void KFolderTreeItem::setFolderIsCloseToQuota( bool v ) //============================================================================= -KFolderTree::KFolderTree( QWidget *parent, const char* name ) +KFolderTree::KFolderTree( TQWidget *parent, const char* name ) : KListView( parent, name ), mUnreadIndex(-1), mTotalIndex(-1), mSizeIndex(-1) { // GUI-options @@ -372,7 +372,7 @@ KFolderTree::KFolderTree( QWidget *parent, const char* name ) setItemsRenameable(false); setRootIsDecorated(true); setSelectionModeExt(Extended); - setAlternateBackground(QColor()); + setAlternateBackground(TQColor()); #if KDE_IS_VERSION( 3, 3, 90 ) setShadeSortColumn ( false ); #endif @@ -380,9 +380,9 @@ KFolderTree::KFolderTree( QWidget *parent, const char* name ) disableAutoSelection(); setColumnWidth( 0, 120 ); //reasonable default size - disconnect( header(), SIGNAL( sizeChange( int, int, int ) ) ); - connect( header(), SIGNAL( sizeChange( int, int, int ) ), - SLOT( slotSizeChanged( int, int, int ) ) ); + disconnect( header(), TQT_SIGNAL( sizeChange( int, int, int ) ) ); + connect( header(), TQT_SIGNAL( sizeChange( int, int, int ) ), + TQT_SLOT( slotSizeChanged( int, int, int ) ) ); } //----------------------------------------------------------------------------- @@ -391,9 +391,9 @@ void KFolderTree::setStyleDependantFrameWidth() // set the width of the frame to a reasonable value for the current GUI style int frameWidth; if( style().isA("KeramikStyle") ) - frameWidth = style().pixelMetric( QStyle::PM_DefaultFrameWidth ) - 1; + frameWidth = style().pixelMetric( TQStyle::PM_DefaultFrameWidth ) - 1; else - frameWidth = style().pixelMetric( QStyle::PM_DefaultFrameWidth ); + frameWidth = style().pixelMetric( TQStyle::PM_DefaultFrameWidth ); if ( frameWidth < 0 ) frameWidth = 0; if ( frameWidth != lineWidth() ) @@ -401,14 +401,14 @@ void KFolderTree::setStyleDependantFrameWidth() } //----------------------------------------------------------------------------- -void KFolderTree::styleChange( QStyle& oldStyle ) +void KFolderTree::styleChange( TQStyle& oldStyle ) { setStyleDependantFrameWidth(); KListView::styleChange( oldStyle ); } //----------------------------------------------------------------------------- -void KFolderTree::drawContentsOffset( QPainter * p, int ox, int oy, +void KFolderTree::drawContentsOffset( TQPainter * p, int ox, int oy, int cx, int cy, int cw, int ch ) { bool oldUpdatesEnabled = isUpdatesEnabled(); @@ -418,14 +418,14 @@ void KFolderTree::drawContentsOffset( QPainter * p, int ox, int oy, } //----------------------------------------------------------------------------- -void KFolderTree::contentsMousePressEvent( QMouseEvent *e ) +void KFolderTree::contentsMousePressEvent( TQMouseEvent *e ) { setSelectionModeExt(Single); KListView::contentsMousePressEvent(e); } //----------------------------------------------------------------------------- -void KFolderTree::contentsMouseReleaseEvent( QMouseEvent *e ) +void KFolderTree::contentsMouseReleaseEvent( TQMouseEvent *e ) { KListView::contentsMouseReleaseEvent(e); setSelectionModeExt(Extended); @@ -443,9 +443,9 @@ void KFolderTree::addAcceptableDropMimetype( const char *mimeType, bool outsideO } //----------------------------------------------------------------------------- -bool KFolderTree::acceptDrag( QDropEvent* event ) const +bool KFolderTree::acceptDrag( TQDropEvent* event ) const { - QListViewItem* item = itemAt(contentsToViewport(event->pos())); + TQListViewItem* item = itemAt(contentsToViewport(event->pos())); for (uint i = 0; i < mAcceptableDropMimetypes.size(); i++) { @@ -461,7 +461,7 @@ bool KFolderTree::acceptDrag( QDropEvent* event ) const } //----------------------------------------------------------------------------- -void KFolderTree::addUnreadColumn( const QString & name, int width ) +void KFolderTree::addUnreadColumn( const TQString & name, int width ) { mUnreadIndex = addColumn( name, width ); setColumnAlignment( mUnreadIndex, qApp->reverseLayout() ? Qt::AlignLeft : Qt::AlignRight ); @@ -469,7 +469,7 @@ void KFolderTree::addUnreadColumn( const QString & name, int width ) } //----------------------------------------------------------------------------- -void KFolderTree::addTotalColumn( const QString & name, int width ) +void KFolderTree::addTotalColumn( const TQString & name, int width ) { mTotalIndex = addColumn( name, width ); setColumnAlignment( mTotalIndex, qApp->reverseLayout() ? Qt::AlignLeft : Qt::AlignRight ); @@ -504,7 +504,7 @@ void KFolderTree::removeTotalColumn() } //----------------------------------------------------------------------------- -void KFolderTree::addSizeColumn( const QString & name, int width ) +void KFolderTree::addSizeColumn( const TQString & name, int width ) { mSizeIndex = addColumn( name, width ); setColumnAlignment( mSizeIndex, qApp->reverseLayout() ? Qt::AlignLeft : Qt::AlignRight ); |