Commit 439307b9 authored by Rolf Eike Beer's avatar Rolf Eike Beer
Browse files

implement column headers in main model

svn path=/branches/work/kgpg2/; revision=753050
parent ca9bf375
......@@ -9,7 +9,7 @@
using namespace KgpgCore;
GroupEditProxyModel::GroupEditProxyModel(QObject *parent, const bool &invert, QList<KGpgNode *> *ids)
: QSortFilterProxyModel(parent), m_invert(invert), m_ids(ids)
: QSortFilterProxyModel(parent), m_invert(invert), m_ids(ids), m_model(NULL)
{
}
......@@ -76,10 +76,13 @@ GroupEditProxyModel::headerData(int section, Qt::Orientation orientation, int ro
if (orientation != Qt::Horizontal)
return QVariant();
if (m_model == NULL)
return QVariant();
switch (section) {
case 0: return QString(i18n("Name"));
case 1: return QString(i18n("Email"));
case 2: return QString(i18n("ID"));
default: return QVariant();
case 0: return m_model->headerData(KEYCOLUMN_NAME, orientation, role);
case 1: return m_model->headerData(KEYCOLUMN_EMAIL, orientation, role);
case 2: return m_model->headerData(KEYCOLUMN_ID, orientation, role);
default: return QVariant();
}
}
......@@ -207,3 +207,24 @@ KGpgItemModel::changeGroup(KGpgGroupNode *node, const QList<KGpgNode *> &keys)
}
emit layoutChanged();
}
QVariant
KGpgItemModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation != Qt::Horizontal)
return QVariant();
switch (section) {
case KEYCOLUMN_NAME: return QString(i18n("Name"));
case KEYCOLUMN_EMAIL: return QString(i18n("Email"));
case KEYCOLUMN_TRUST: return QString(i18n("Trust"));
case KEYCOLUMN_SIZE: return QString(i18n("Size"));
case KEYCOLUMN_EXPIR: return QString(i18n("Expiration"));
case KEYCOLUMN_CREAT: return QString(i18n("Creation"));
case KEYCOLUMN_ID: return QString(i18n("ID"));
default: return QVariant();
}
}
......@@ -38,6 +38,7 @@ public:
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual bool hasChildren(const QModelIndex &parent) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
void setPreviewSize(const unsigned int &n)
{ m_previewsize = n; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment