Complete refactor of TOTP integration

* Eliminate TOTP logic from GUI elements
* Consolidate TOTP functionality under the Totp namespace
* Eliminate guessing about state and encoders
* Increased test cases
* Add entry view column for TOTP [#2132]
* General code cleanup, reduction of unnecessary steps, separation of concerns
* Rename SetupTotpDialog to TotpSetupDialog for consistency
This commit is contained in:
Jonathan White committed 2018-09-15 12:10:26 -04:00
1 parent b74fb3e208
commit 1dc9f10c7f
21 files changed
+584 -715

No files matched your search

+15 -9
View File
@@ -127,7 +127,7 @@ int EntryModel::columnCount(const QModelIndex& parent) const
return 0;
}
return 12;
return 13;
}
QVariant EntryModel::data(const QModelIndex& index, int role) const
@@ -201,16 +201,20 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
case Accessed:
result = entry->timeInfo().lastAccessTime().toLocalTime().toString(EntryModel::DateFormat);
return result;
case Attachments:
// Display comma-separated list of attachments
QList<QString> attachments = entry->attachments()->keys();
for (int i = 0; i < attachments.size(); ++i) {
if (result.isEmpty()) {
result.append(attachments.at(i));
continue;
case Attachments: {
// Display comma-separated list of attachments
QList<QString> attachments = entry->attachments()->keys();
for (int i = 0; i < attachments.size(); ++i) {
if (result.isEmpty()) {
result.append(attachments.at(i));
continue;
}
result.append(QString(", ") + attachments.at(i));
}
result.append(QString(", ") + attachments.at(i));
return result;
}
case Totp:
result = entry->hasTotp() ? tr("Yes") : "";
return result;
}
} else if (role == Qt::UserRole) { // Qt::UserRole is used as sort role, see EntryView::EntryView()
@@ -309,6 +313,8 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro
return tr("Accessed");
case Attachments:
return tr("Attachments");
case Totp:
return tr("TOTP");
}
} else if (role == Qt::DecorationRole) {
if (section == Paperclip) {