diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index ae310b6c8..5de746daa 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -122,27 +122,27 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const if (role == Qt::DisplayRole) { switch (index.column()) { - case 0: + case ParentGroup: if (entry->group()) { return entry->group()->name(); } break; - case 1: + case Title: return entry->title(); - case 2: + case Username: return entry->username(); - case 3: + case Url: return entry->url(); } } else if (role == Qt::DecorationRole) { switch (index.column()) { - case 0: + case ParentGroup: if (entry->group()) { return entry->group()->iconPixmap(); } break; - case 1: + case Title: if (entry->isExpired()) { return databaseIcons()->iconPixmap(DatabaseIcons::ExpiredIconIndex); } @@ -165,13 +165,13 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { switch (section) { - case 0: + case ParentGroup: return tr("Group"); - case 1: + case Title: return tr("Title"); - case 2: + case Username: return tr("Username"); - case 3: + case Url: return tr("URL"); } } diff --git a/src/gui/entry/EntryModel.h b/src/gui/entry/EntryModel.h index 8fd9c9616..94e48b450 100644 --- a/src/gui/entry/EntryModel.h +++ b/src/gui/entry/EntryModel.h @@ -30,6 +30,14 @@ class EntryModel : public QAbstractTableModel Q_OBJECT public: + enum ModelColumn + { + ParentGroup = 0, + Title = 1, + Username = 2, + Url = 3 + }; + explicit EntryModel(QObject* parent = Q_NULLPTR); Entry* entryFromIndex(const QModelIndex& index) const; QModelIndex indexFromEntry(Entry* entry) const; diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index c603bcad3..7dc74dfb9 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -70,7 +70,7 @@ void EntryView::emitEntryActivationSignal(const QModelIndex& index) { Entry* entry = entryFromIndex(index); - if (m_sortModel->mapToSource(index).column() == 3) { + if (m_sortModel->mapToSource(index).column() == EntryModel::Url) { Q_EMIT openUrl(entry); } else {