rem: KMHeaders *headers =  static_cast<KMHeaders*>(listView()); const KMPaintInfo *paintInfo = headers->paintInfo(); KMMsgBase *mMsgBase = headers->folder()->getMsgBase( mMsgId ); QString sortArrival = QString( "%1" ).arg( mMsgId, 8, 36 ); if (column == paintInfo->dateCol) { time_t mDate = mMsgBase->date(); const int dateLength = 30; char cDate[dateLength + 1]; strftime( cDate, dateLength, "%Y:%j:%H:%M:%S", gmtime( &mDate )); QString sortDate = cDate + sortArrival; if (paintInfo->orderOfArrival) return sortArrival; else return sortDate; } else if (column == paintInfo->senderCol) return text(paintInfo->senderCol).lower() + " " + sortArrival; else if (column == paintInfo->subCol) { if (paintInfo->status) return QString( QChar( (uint)mMsgBase->status() )); else return KMMsgBase::skipKeyword( text(paintInfo->subCol).lower() ) + " " + sortArrival; } else if (column == paintInfo->sizeCol) { if(mMsgBase==NULL) return text(column); return QString( "%1" ).arg( mMsgBase->msgSize(), 9 ); } else return text(column);
add: const char req_col = (char)column; if(mKey.isEmpty() || mKey.left(1) != &req_col) { KMHeaders *headers = static_cast<KMHeaders*>(listView()); return ((KMHeaderItem *)this)->mKey = generate_key(mMsgId, headers->folder()->getMsgBase( mMsgId ), headers->paintInfo(), column); } return mKey;
context:   virtual QString key( int column, bool /*ascending*/ ) const  {    KMHeaders *headers =  static_cast<KMHeaders*>(listView());    const KMPaintInfo *paintInfo = headers->paintInfo();    KMMsgBase *mMsgBase = headers->folder()->getMsgBase( mMsgId );    QString sortArrival = QString( "%1" ).arg( mMsgId, 8, 36 );    if (column == paintInfo->dateCol) {        time_t mDate = mMsgBase->date();        const int dateLength = 30;        char cDate[dateLength + 1];        strftime( cDate, dateLength, "%Y:%j:%H:%M:%S", gmtime( &mDate ));        QString sortDate = cDate + sortArrival;        if (paintInfo->orderOfArrival)            return sortArrival;        else            return sortDate;    }    else if (column == paintInfo->senderCol)      return text(paintInfo->senderCol).lower() + " " + sortArrival;    else if (column == paintInfo->subCol) {      if (paintInfo->status)	return QString( QChar( (uint)mMsgBase->status() ));      else	return KMMsgBase::skipKeyword( text(paintInfo->subCol).lower() )	  + " " + sortArrival;    }    else if (column == paintInfo->sizeCol) {      if(mMsgBase==NULL)	return text(column);      return QString( "%1" ).arg( mMsgBase->msgSize(), 9 );    }    else      return text(column);  }