Skip to content

Commit

Permalink
show created and exiry date in users view, also filter out expired ke…
Browse files Browse the repository at this point in the history
…ys, fixes #70
  • Loading branch information
annejan committed Jul 30, 2015
1 parent 333cc67 commit 0c604f9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
9 changes: 3 additions & 6 deletions mainwindow.cpp
Expand Up @@ -740,12 +740,7 @@ void MainWindow::setGitExecutable(QString path) {
}

/**
* @briefUsersDialog d(this);
d.setUsers(&users);
if (!d.exec()) {
d.setUsers(NULL);
return;
} MainWindow::setGpgExecutable
* @brief MainWindow::setGpgExecutable
* @param path
*/
void MainWindow::setGpgExecutable(QString path) {
Expand Down Expand Up @@ -1079,6 +1074,8 @@ QList<UserInfo> MainWindow::listKeys(QString keystring, bool secret)
current_user.key_id = props[4];
current_user.name = props[9];
current_user.validity = props[8][0].toLatin1();
current_user.created.setTime_t(props[5].toInt());
current_user.expiry.setTime_t(props[6].toInt());
} else if (current_user.name.isEmpty() && props[0] == "uid") {
current_user.name = props[9];
}
Expand Down
2 changes: 1 addition & 1 deletion qtpass.iss
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "QtPass"
#define MyAppVersion "0.9.1"
#define MyAppVersion "0.9.2"
#define MyAppPublisher "IJhack"
#define MyAppURL "http://qtpass.org/"
#define MyAppExeName "qtpass.exe"
Expand Down
2 changes: 1 addition & 1 deletion qtpass.pro
Expand Up @@ -18,7 +18,7 @@ macx {
}

TEMPLATE = app
VERSION = 0.9.1
VERSION = 0.9.2

SOURCES += main.cpp\
mainwindow.cpp \
Expand Down
14 changes: 13 additions & 1 deletion usersdialog.cpp
@@ -1,6 +1,7 @@
#include "usersdialog.h"
#include "ui_usersdialog.h"
#include <QRegExp>
#include <QDebug>

UsersDialog::UsersDialog(QWidget *parent) :
QDialog(parent),
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions usersdialog.h
Expand Up @@ -5,6 +5,7 @@
#include <QList>
#include <QStandardItemModel>
#include <QCloseEvent>
#include <QDateTime>

namespace Ui {
class UsersDialog;
Expand All @@ -19,6 +20,8 @@ struct UserInfo {
char validity;
bool have_secret;
bool enabled;
QDateTime expiry;
QDateTime created;
};

class UsersDialog : public QDialog
Expand Down

0 comments on commit 0c604f9

Please sign in to comment.