rem: QString sortArrival = QString( "%1" ) .arg( kmkernel->msgDict()->getMsgSerNum(headers->folder(), id), 0, 36 );
add: QString sortArrival = QString( "%1" ).arg( msg->getMsgSerNum(), 0, 36 );
context:   static QString generate_key( int id, 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    // readSortOrder()    if (!msg) return QString::null;    int column = sortOrder & ((1 << 5) - 1);    QString ret = QChar( (char)sortOrder );    QString sortArrival = QString( "%1" )      .arg( kmkernel->msgDict()->getMsgSerNum(headers->folder(), id), 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());        while (d.length() <= 10) d = '0' + d;        return ret + d + sortArrival;      }    } else if (column == paintInfo->senderCol) {      QString tmp;      if (headers->folder()->whoField().lower() == "to")        tmp = msg->toStrip();      else        tmp = msg->fromStrip();      return ret + tmp.lower() + ' ' + sortArrival;    } else if (column == paintInfo->subCol) {      QString tmp;      tmp = ret;      if (paintInfo->status) {        tmp += msg->statusToSortRank() + ' ';      }      tmp += KMMessage::stripOffPrefixes( msg->subject().lower() ) + ' ' + sortArrival;      return tmp;    }    else if (column == paintInfo->sizeCol) {      QString len;      if ( msg->parent()->folderType() == KMFolderTypeImap )      {        len = QString::number( msg->msgSizeServer() );      } else {        len = QString::number( msg->msgSize() );      }      while (len.length() < 9) len = '0' + len;      return ret + len + sortArrival;    }    return ret + "missing key"; //you forgot something!!  }