mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-04 07:42:35 -08:00
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:
21 files changed
+584
-715
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user