mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add enum for EntryModel column.
This commit is contained in:
parent
bf906a7867
commit
34c6b416b0
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user