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 /kmail/headeritem.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 'kmail/headeritem.cpp')
-rw-r--r-- | kmail/headeritem.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/kmail/headeritem.cpp b/kmail/headeritem.cpp index ab9b8329f..f950d35c7 100644 --- a/kmail/headeritem.cpp +++ b/kmail/headeritem.cpp @@ -27,10 +27,10 @@ ** *******************************************************************************/ #include <klocale.h> -#include <qapplication.h> -#include <qregexp.h> -#include <qbitmap.h> -#include <qpainter.h> +#include <tqapplication.h> +#include <tqregexp.h> +#include <tqbitmap.h> +#include <tqpainter.h> #include <kio/netaccess.h> @@ -42,7 +42,7 @@ using namespace KMail; // Constuction a new list view item with the given colors and pixmap -HeaderItem::HeaderItem( QListView* parent, int msgId, const QString& key ) +HeaderItem::HeaderItem( TQListView* parent, int msgId, const TQString& key ) : KListViewItem( parent ), mMsgId( msgId ), mKey( key ), @@ -53,7 +53,7 @@ HeaderItem::HeaderItem( QListView* parent, int msgId, const QString& key ) } // Constuction a new list view item with the given parent, colors, & pixmap -HeaderItem::HeaderItem( QListViewItem* parent, int msgId, const QString& key ) +HeaderItem::HeaderItem( TQListViewItem* parent, int msgId, const TQString& key ) : KListViewItem( parent ), mMsgId( msgId ), mKey( key ), @@ -76,14 +76,14 @@ void HeaderItem::setMsgId( int aMsgId ) // Profiling note: About 30% of the time taken to initialize the // listview is spent in this function. About 60% is spent in operator -// new and QListViewItem::QListViewItem. +// new and TQListViewItem::TQListViewItem. void HeaderItem::irefresh() { KMHeaders *headers = static_cast<KMHeaders*>(listView()); NestingPolicy threadingPolicy = headers->getNestingPolicy(); if ((threadingPolicy == AlwaysOpen) || (threadingPolicy == DefaultOpen)) { - //Avoid opening items as QListView is currently slow to do so. + //Avoid opening items as TQListView is currently slow to do so. setOpen(true); return; @@ -127,7 +127,7 @@ Q_UINT32 HeaderItem::msgSerNum() const void HeaderItem::setOpenRecursive( bool open ) { if (open){ - QListViewItem * lvchild; + TQListViewItem * lvchild; lvchild = firstChild(); while (lvchild){ ((HeaderItem*)lvchild)->setOpenRecursive( true ); @@ -139,14 +139,14 @@ void HeaderItem::setOpenRecursive( bool open ) } } -QString HeaderItem::text( int col) const +TQString HeaderItem::text( int col) const { KMHeaders *headers = static_cast<KMHeaders*>(listView()); KMMsgBase *mMsgBase = headers->folder()->getMsgBase( mMsgId ); - QString tmp; + TQString tmp; if ( !mMsgBase ) - return QString(); + return TQString(); if ( col == headers->paintInfo()->senderCol ) { if ( (headers->folder()->whoField().lower() == "to") && !headers->paintInfo()->showReceiver ) @@ -170,7 +170,7 @@ QString HeaderItem::text( int col) const if (tmp.isEmpty()) tmp = i18n("No Subject"); else - tmp.remove(QRegExp("[\r\n]")); + tmp.remove(TQRegExp("[\r\n]")); } else if(col == headers->paintInfo()->dateCol) { tmp = headers->mDate.dateString( mMsgBase->date() ); @@ -189,17 +189,17 @@ void HeaderItem::setup() { widthChanged(); const int ph = KMHeaders::pixNew->height(); - QListView *v = listView(); + TQListView *v = listView(); int h = QMAX( v->fontMetrics().height(), ph ) + 2*v->itemMargin(); - h = QMAX( h, QApplication::globalStrut().height()); + h = QMAX( h, TQApplication::globalStrut().height()); if ( h % 2 > 0 ) h++; setHeight( h ); } -typedef QValueList<QPixmap> PixmapList; +typedef TQValueList<TQPixmap> PixmapList; -QPixmap HeaderItem::pixmapMerge( PixmapList pixmaps ) const +TQPixmap HeaderItem::pixmapMerge( PixmapList pixmaps ) const { int width = 0; int height = 0; @@ -209,8 +209,8 @@ QPixmap HeaderItem::pixmapMerge( PixmapList pixmaps ) const height = QMAX( height, (*it).height() ); } - QPixmap res( width, height ); - QBitmap mask( width, height, true ); + TQPixmap res( width, height ); + TQBitmap mask( width, height, true ); int x = 0; for ( PixmapList::ConstIterator it = pixmaps.begin(); @@ -224,7 +224,7 @@ QPixmap HeaderItem::pixmapMerge( PixmapList pixmaps ) const return res; } -const QPixmap *HeaderItem::cryptoIcon(KMMsgBase *msgBase) const +const TQPixmap *HeaderItem::cryptoIcon(KMMsgBase *msgBase) const { switch ( msgBase->encryptionState() ) { @@ -236,7 +236,7 @@ const QPixmap *HeaderItem::cryptoIcon(KMMsgBase *msgBase) const } } -const QPixmap *HeaderItem::signatureIcon(KMMsgBase *msgBase) const +const TQPixmap *HeaderItem::signatureIcon(KMMsgBase *msgBase) const { switch ( msgBase->signatureState() ) { @@ -248,7 +248,7 @@ const QPixmap *HeaderItem::signatureIcon(KMMsgBase *msgBase) const } } -const QPixmap *HeaderItem::statusIcon(KMMsgBase *msgBase) const +const TQPixmap *HeaderItem::statusIcon(KMMsgBase *msgBase) const { // forwarded, replied have precedence over the other states if ( msgBase->isForwarded() && !msgBase->isReplied() ) return KMHeaders::pixReadFwd; @@ -267,7 +267,7 @@ const QPixmap *HeaderItem::statusIcon(KMMsgBase *msgBase) const return 0; } -const QPixmap *HeaderItem::pixmap(int col) const +const TQPixmap *HeaderItem::pixmap(int col) const { KMHeaders *headers = static_cast<KMHeaders*>(listView()); KMMsgBase *msgBase = headers->folder()->getMsgBase( mMsgId ); @@ -288,7 +288,7 @@ const QPixmap *HeaderItem::pixmap(int col) const } if ( !headers->mPaintInfo.showStatus ) { - const QPixmap *pix = statusIcon(msgBase); + const TQPixmap *pix = statusIcon(msgBase); if ( pix ) pixmaps << *pix; } @@ -300,7 +300,7 @@ const QPixmap *HeaderItem::pixmap(int col) const // Only merge the crypto icons in if that is configured. if ( headers->paintInfo()->showCryptoIcons ) { - const QPixmap *pix; + const TQPixmap *pix; if ( !headers->paintInfo()->showCrypto ) if ( (pix = cryptoIcon(msgBase)) ) pixmaps << *pix; @@ -315,7 +315,7 @@ const QPixmap *HeaderItem::pixmap(int col) const if ( !headers->mPaintInfo.showTodo ) if ( msgBase->isTodo() ) pixmaps << *KMHeaders::pixTodo; - static QPixmap mergedpix; + static TQPixmap mergedpix; mergedpix = pixmapMerge( pixmaps ); return &mergedpix; } @@ -351,7 +351,7 @@ const QPixmap *HeaderItem::pixmap(int col) const return 0; } -void HeaderItem::paintCell( QPainter * p, const QColorGroup & cg, +void HeaderItem::paintCell( TQPainter * p, const TQColorGroup & cg, int column, int width, int align ) { KMHeaders *headers = static_cast<KMHeaders*>(listView()); @@ -360,32 +360,32 @@ void HeaderItem::paintCell( QPainter * p, const QColorGroup & cg, KMMsgBase *mMsgBase = headers->folder()->getMsgBase( mMsgId ); if (!mMsgBase) return; - QColorGroup _cg( cg ); - QColor c = _cg.text(); - QColor *color = const_cast<QColor *>( &headers->paintInfo()->colFore ); - QFont font = p->font(); + TQColorGroup _cg( cg ); + TQColor c = _cg.text(); + TQColor *color = const_cast<TQColor *>( &headers->paintInfo()->colFore ); + TQFont font = p->font(); int weight = font.weight(); // for color and font family "important" overrides "new" overrides "unread" // overrides "todo" for the weight we use the maximal weight if ( mMsgBase->isTodo() ) { - color = const_cast<QColor*>( &headers->paintInfo()->colTodo ); + color = const_cast<TQColor*>( &headers->paintInfo()->colTodo ); font = headers->todoFont(); weight = QMAX( weight, font.weight() ); } if ( mMsgBase->isUnread() ) { - color = const_cast<QColor*>( &headers->paintInfo()->colUnread ); + color = const_cast<TQColor*>( &headers->paintInfo()->colUnread ); font = headers->unreadFont(); weight = QMAX( weight, font.weight() ); } if ( mMsgBase->isNew() ) { - color = const_cast<QColor*>( &headers->paintInfo()->colNew ); + color = const_cast<TQColor*>( &headers->paintInfo()->colNew ); font = headers->newFont(); weight = QMAX( weight, font.weight() ); } if ( mMsgBase->isImportant() ) { - color = const_cast<QColor*>( &headers->paintInfo()->colFlag ); + color = const_cast<TQColor*>( &headers->paintInfo()->colFlag ); font = headers->importantFont(); weight = QMAX( weight, font.weight() ); } @@ -393,14 +393,14 @@ void HeaderItem::paintCell( QPainter * p, const QColorGroup & cg, font = headers->dateFont(); } - QColor cdisabled = KGlobalSettings::inactiveTextColor(); + TQColor cdisabled = KGlobalSettings::inactiveTextColor(); if ( headers->isMessageCut( msgSerNum() ) ) { font.setItalic( true ); color = &cdisabled; } // set color and font - _cg.setColor( QColorGroup::Text, *color ); + _cg.setColor( TQColorGroup::Text, *color ); font.setWeight( weight ); p->setFont( font ); @@ -412,44 +412,44 @@ void HeaderItem::paintCell( QPainter * p, const QColorGroup & cg, } // reset color - _cg.setColor( QColorGroup::Text, c ); + _cg.setColor( TQColorGroup::Text, c ); } -QString HeaderItem::generate_key( KMHeaders *headers, +TQString HeaderItem::generate_key( KMHeaders *headers, KMMsgBase *msg, const KPaintInfo *paintInfo, int sortOrder ) { - // It appears, that QListView in Qt-3.0 asks for the key - // in QListView::clear(), which is called from + // It appears, that TQListView in Qt-3.0 asks for the key + // in TQListView::clear(), which is called from // readSortOrder() - if (!msg) return QString::null; + if (!msg) return TQString::null; int column = sortOrder & ((1 << 5) - 1); - QString ret = QChar( (char)sortOrder ); - QString sortArrival = QString( "%1" ).arg( msg->getMsgSerNum(), 0, 36 ); + TQString ret = TQChar( (char)sortOrder ); + TQString sortArrival = TQString( "%1" ).arg( msg->getMsgSerNum(), 0, 36 ); while (sortArrival.length() < 7) sortArrival = '0' + sortArrival; if (column == paintInfo->dateCol) { if (paintInfo->orderOfArrival) return ret + sortArrival; else { - QString d = QString::number(msg->date()); + TQString d = TQString::number(msg->date()); while (d.length() <= 10) d = '0' + d; return ret + d + sortArrival; } } else if (column == paintInfo->senderCol) { - QString tmp; + TQString tmp; if ( (headers->folder()->whoField().lower() == "to") && !headers->paintInfo()->showReceiver ) tmp = msg->toStrip(); else tmp = msg->fromStrip(); return ret + tmp.lower() + ' ' + sortArrival; } else if (column == paintInfo->receiverCol) { - QString tmp = msg->toStrip(); + TQString tmp = msg->toStrip(); return ret + tmp.lower() + ' ' + sortArrival; } else if (column == paintInfo->subCol) { - QString tmp; + TQString tmp; tmp = ret; if (paintInfo->status) { tmp += msg->statusToSortRank() + ' '; @@ -458,18 +458,18 @@ QString HeaderItem::generate_key( KMHeaders *headers, return tmp; } else if (column == paintInfo->sizeCol) { - QString len; + TQString len; if ( msg->parent()->folderType() == KMFolderTypeImap ) { - len = QString::number( msg->msgSizeServer() ); + len = TQString::number( msg->msgSizeServer() ); } else { - len = QString::number( msg->msgSize() ); + len = TQString::number( msg->msgSize() ); } while (len.length() < 9) len = '0' + len; return ret + len + sortArrival; } else if (column == paintInfo->statusCol) { - QString s; + TQString s; if ( msg->isNew() ) s = "1"; else if ( msg->isUnread() ) s = "2"; else if (!msg->isForwarded() && msg->isReplied() ) s = "3"; @@ -482,27 +482,27 @@ QString HeaderItem::generate_key( KMHeaders *headers, return ret + s + sortArrival; } else if (column == paintInfo->attachmentCol) { - QString s(msg->attachmentState() == KMMsgHasAttachment ? "1" : "0"); + TQString s(msg->attachmentState() == KMMsgHasAttachment ? "1" : "0"); return ret + s + sortArrival; } else if (column == paintInfo->importantCol) { - QString s(msg->isImportant() ? "1" : "0"); + TQString s(msg->isImportant() ? "1" : "0"); return ret + s + sortArrival; } else if ( column == paintInfo->todoCol ) { - QString s( msg->isTodo() ? "1": "0" ); + TQString s( msg->isTodo() ? "1": "0" ); return ret + s + sortArrival; } else if (column == paintInfo->spamHamCol) { - QString s((msg->isSpam() || msg->isHam()) ? "1" : "0"); + TQString s((msg->isSpam() || msg->isHam()) ? "1" : "0"); return ret + s + sortArrival; } else if (column == paintInfo->watchedIgnoredCol) { - QString s((msg->isWatched() || msg->isIgnored()) ? "1" : "0"); + TQString s((msg->isWatched() || msg->isIgnored()) ? "1" : "0"); return ret + s + sortArrival; } else if (column == paintInfo->signedCol) { - QString s; + TQString s; switch ( msg->signatureState() ) { case KMMsgFullySigned : s = "1"; break; @@ -514,7 +514,7 @@ QString HeaderItem::generate_key( KMHeaders *headers, return ret + s + sortArrival; } else if (column == paintInfo->cryptoCol) { - QString s; + TQString s; switch ( msg->encryptionState() ) { case KMMsgFullyEncrypted : s = "1"; break; @@ -528,7 +528,7 @@ QString HeaderItem::generate_key( KMHeaders *headers, return ret + "missing key"; //you forgot something!! } -QString HeaderItem::key( int column, bool /*ascending*/ ) const +TQString HeaderItem::key( int column, bool /*ascending*/ ) const { KMHeaders *headers = static_cast<KMHeaders*>(listView()); int sortOrder = column; @@ -547,11 +547,11 @@ QString HeaderItem::key( int column, bool /*ascending*/ ) const return mKey; } -void HeaderItem::setTempKey( QString key ) { +void HeaderItem::setTempKey( TQString key ) { mKey = key; } -int HeaderItem::compare( QListViewItem *i, int col, bool ascending ) const +int HeaderItem::compare( TQListViewItem *i, int col, bool ascending ) const { int res = 0; KMHeaders *headers = static_cast<KMHeaders*>(listView()); @@ -577,9 +577,9 @@ int HeaderItem::compare( QListViewItem *i, int col, bool ascending ) const return res; } -QListViewItem* HeaderItem::firstChildNonConst() /* Non const! */ +TQListViewItem* HeaderItem::firstChildNonConst() /* Non const! */ { - enforceSortOrder(); // Try not to rely on QListView implementation details + enforceSortOrder(); // Try not to rely on TQListView implementation details return firstChild(); } |