diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-07-30 21:32:09 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-07-30 21:32:09 +0200 |
commit | 30105daf5e5236f49fe67522631e7a9a9adcfc54 (patch) | |
tree | 9b0c0cfd42bd1769f39377e2a1b20189a3719897 /usersdialog.cpp | |
parent | d4e0e23e2a32691c8f6d4aec859e3c5d24f30b9c (diff) |
show created and exiry date in users view, also filter out expired keys, fixes https://github.com/IJHack/qtpass/issues/70
Diffstat (limited to 'usersdialog.cpp')
-rw-r--r-- | usersdialog.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usersdialog.cpp b/usersdialog.cpp index 59d21b50..ed826fa0 100644 --- a/usersdialog.cpp +++ b/usersdialog.cpp @@ -1,6 +1,7 @@ #include "usersdialog.h" #include "ui_usersdialog.h" #include <QRegExp> +#include <QDebug> UsersDialog::UsersDialog(QWidget *parent) : QDialog(parent), @@ -47,7 +48,18 @@ void UsersDialog::populateList(const QString &filter) if (user.validity == '-' && !ui->checkBox->isChecked()) { continue; } - QListWidgetItem *item = new QListWidgetItem(user.name + "\n" + user.key_id, ui->listWidget); + if (user.expiry.toTime_t() > 0 && user.expiry.daysTo(QDateTime::currentDateTime()) > 0 && !ui->checkBox->isChecked()) { + continue; + } + QString userText = user.name + "\n" + user.key_id; + if (user.created.toTime_t() > 0) { + userText += " " + tr("created") + " " + user.created.toString(Qt::SystemLocaleShortDate); + + } + if (user.expiry.toTime_t() > 0) { + userText += " " + tr("expires") + " " + user.expiry.toString(Qt::SystemLocaleShortDate); + } + QListWidgetItem *item = new QListWidgetItem(userText, ui->listWidget); item->setCheckState(user.enabled ? Qt::Checked : Qt::Unchecked); item->setData(Qt::UserRole, QVariant::fromValue(&user)); if (user.have_secret) { |