| 51 | } |
| 52 | |
| 53 | QVariant VcsBasicEventModel::data(const QModelIndex& idx, int role) const |
| 54 | { |
| 55 | Q_D(const VcsBasicEventModel); |
| 56 | |
| 57 | if( !idx.isValid() || role != Qt::DisplayRole ) |
| 58 | return QVariant(); |
| 59 | |
| 60 | if( idx.row() < 0 || idx.row() >= rowCount() || idx.column() < 0 || idx.column() >= columnCount() ) |
| 61 | return QVariant(); |
| 62 | |
| 63 | KDevelop::VcsEvent ev = d->m_events.at( idx.row() ); |
| 64 | switch( idx.column() ) |
| 65 | { |
| 66 | case RevisionColumn: |
| 67 | return QVariant( ev.revision().revisionValue() ); |
| 68 | case SummaryColumn: |
| 69 | // show the first line only |
| 70 | return QVariant( ev.message().section(QLatin1Char('\n'), 0, 0) ); |
| 71 | case AuthorColumn: |
| 72 | return QVariant( ev.author() ); |
| 73 | case DateColumn: |
| 74 | return QVariant( QLocale().toString( ev.date() ) ); |
| 75 | default: |
| 76 | break; |
| 77 | } |
| 78 | return QVariant(); |
| 79 | } |
| 80 | |
| 81 | QVariant VcsBasicEventModel::headerData(int section, Qt::Orientation orientation, int role) const |
| 82 | { |