diff options
author | Felix Geyer <debfx@fobos.de> | 2010-09-22 01:01:56 +0400 |
---|---|---|
committer | Felix Geyer <debfx@fobos.de> | 2010-09-22 01:01:56 +0400 |
commit | eb6eec616c45707099b41e777467d4d11b041d9b (patch) | |
tree | 7f1ca252608b2e7422a6774be2a08faad68e016a /src | |
parent | 89e778d324add52fd358bbb54f6f76f4382c5714 (diff) |
Add username and URL columns.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/EntryModel.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/gui/EntryModel.cpp b/src/gui/EntryModel.cpp index 04f33f405..2308dd97e 100644 --- a/src/gui/EntryModel.cpp +++ b/src/gui/EntryModel.cpp @@ -63,7 +63,7 @@ int EntryModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent); - return 1; + return 3; } QVariant EntryModel::data(const QModelIndex& index, int role) const @@ -74,23 +74,33 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const Entry* entry = entryFromIndex(index); - // TODO implement other columns if (role == Qt::DisplayRole) { - return entry->title(); + switch (index.column()) { + case 0: + return entry->title(); + case 1: + return entry->username(); + case 2: + return entry->url(); + } } - else if (role == Qt::DecorationRole) { + else if ((role == Qt::DecorationRole) && (index.column() == 0)) { return entry->icon(); } - else { - return QVariant(); - } + + return QVariant(); } QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int role) const { - Q_UNUSED(section); - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { - return tr("Title"); + switch (section) { + case 0: + return tr("Title"); + case 1: + return tr("Username"); + case 2: + return tr("URL"); + } } return QVariant(); |