mirror of
https://github.com/QRouland/UTPass.git
synced 2025-01-24 07:36:39 +00:00
Improve gpg key infos
This commit is contained in:
parent
0e5df76787
commit
200964246e
@ -58,7 +58,7 @@ bool Pass::importGPGKey(QUrl url)
|
||||
QVariant Pass::getAllGPGKeys()
|
||||
{
|
||||
qInfo() << "Getting all key form gpg ";
|
||||
return QVariant::fromValue(PassKeyModel::keysToPassKeyQObjectList(
|
||||
Gpg::instance()->getAllKeys().second));
|
||||
return QVariant::fromValue(PassKeyModel::keysToPassKey(
|
||||
Gpg::instance()->getAllKeys().second)); // TODO Error handling
|
||||
}
|
||||
|
||||
|
@ -6,69 +6,84 @@
|
||||
|
||||
using namespace GpgME;
|
||||
|
||||
class UserIdModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString uid READ uid MEMBER m_uid CONSTANT)
|
||||
Q_PROPERTY(QString name READ name MEMBER m_name CONSTANT)
|
||||
Q_PROPERTY(QString email READ email MEMBER m_email CONSTANT)
|
||||
|
||||
UserID m_user_id;
|
||||
public:
|
||||
|
||||
|
||||
UserIdModel(UserID key):
|
||||
m_user_id(key)
|
||||
{};
|
||||
|
||||
QString uid() const
|
||||
{
|
||||
return QString::fromUtf8(m_user_id.id());
|
||||
};
|
||||
QString name() const
|
||||
{
|
||||
return QString::fromUtf8(m_user_id.name());
|
||||
};
|
||||
QString email() const
|
||||
{
|
||||
return QString::fromUtf8(m_user_id.email());
|
||||
};
|
||||
};
|
||||
|
||||
class PassKeyModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString uid READ uid WRITE setUid NOTIFY uidChanged MEMBER m_uid)
|
||||
Q_PROPERTY(bool secret READ secret WRITE setSecret NOTIFY secretChanged MEMBER m_secret)
|
||||
Q_PROPERTY(bool expired READ expired WRITE setExpired NOTIFY expiredChanged MEMBER m_expired)
|
||||
|
||||
QString m_uid;
|
||||
bool m_secret;
|
||||
bool m_expired;
|
||||
Q_PROPERTY(QString uid READ uid MEMBER m_uid CONSTANT)
|
||||
Q_PROPERTY(QList<QObject *> userIds READ userIds MEMBER m_user_ids CONSTANT)
|
||||
Q_PROPERTY(bool isSecret READ isSecret MEMBER m_secret CONSTANT)
|
||||
Q_PROPERTY(bool isExpired READ isExpired MEMBER m_expired CONSTANT)
|
||||
|
||||
Key m_key;
|
||||
public:
|
||||
PassKeyModel(QString uid, bool secret, bool expired):
|
||||
m_uid(uid),
|
||||
m_secret(secret),
|
||||
m_expired(expired)
|
||||
{};
|
||||
|
||||
PassKeyModel(Key key):
|
||||
PassKeyModel(QString::fromUtf8(key.keyID()), key.hasSecret(), key.isExpired())
|
||||
m_key(key)
|
||||
{};
|
||||
|
||||
static QList<QObject *> keysToPassKeyQObjectList(std::vector<Key> keys)
|
||||
static QList<QObject *> keysToPassKey(std::vector<Key> keys)
|
||||
{
|
||||
QList<QObject *> r;
|
||||
std::for_each(keys.begin(), keys.end(), [&r](Key k) {
|
||||
r.append(new PassKeyModel(k));
|
||||
QList<QObject *> ret;
|
||||
std::for_each(keys.begin(), keys.end(), [&ret](Key k) {
|
||||
ret.append(new PassKeyModel(k));
|
||||
});
|
||||
return r;
|
||||
return ret;
|
||||
};
|
||||
|
||||
QString uid() const
|
||||
{
|
||||
return m_uid;
|
||||
};
|
||||
bool secret() const
|
||||
{
|
||||
return m_secret;
|
||||
};
|
||||
bool expired() const
|
||||
{
|
||||
return m_expired;
|
||||
return QString::fromUtf8(m_key.keyID());
|
||||
};
|
||||
|
||||
void setUid(QString uid)
|
||||
QList<QObject *> userIds() const
|
||||
{
|
||||
m_uid = uid;
|
||||
emit uidChanged(uid);
|
||||
}
|
||||
void setSecret(bool secret)
|
||||
{
|
||||
m_secret = secret;
|
||||
emit secretChanged(secret);
|
||||
}
|
||||
void setExpired(bool expired)
|
||||
{
|
||||
m_expired = expired;
|
||||
emit expiredChanged(expired);
|
||||
}
|
||||
|
||||
signals:
|
||||
void uidChanged(QString);
|
||||
void secretChanged(bool);
|
||||
void expiredChanged(bool);
|
||||
auto user_ids = m_key.userIDs();
|
||||
QList<QObject *> ret;
|
||||
std::for_each(user_ids.begin(), user_ids.end(), [&ret](UserID k) {
|
||||
ret.append(new UserIdModel(k));
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
|
||||
bool isSecret() const
|
||||
{
|
||||
return m_key.hasSecret();
|
||||
};
|
||||
|
||||
bool isExpired() const
|
||||
{
|
||||
return m_key.hasSecret();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: utpass.qrouland\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-01-14 09:52+0100\n"
|
||||
"POT-Creation-Date: 2025-01-14 12:17+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -67,19 +67,19 @@ msgstr ""
|
||||
msgid "<b>Maintainer</>"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/Info.qml:109
|
||||
#: ../qml/pages/Info.qml:108
|
||||
msgid "Suggest improvement(s) or report a bug(s)"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/Info.qml:114
|
||||
#: ../qml/pages/Info.qml:113
|
||||
msgid "Access to the source code"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/Info.qml:122
|
||||
#: ../qml/pages/Info.qml:121
|
||||
msgid "Released under the terms of the GNU GPL v3"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/Info.qml:131 ../qml/pages/headers/MainHeader.qml:33
|
||||
#: ../qml/pages/Info.qml:130 ../qml/pages/headers/MainHeader.qml:33
|
||||
msgid "Info"
|
||||
msgstr ""
|
||||
|
||||
@ -125,7 +125,8 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/ImportGitClone.qml:91
|
||||
#: ../qml/pages/settings/ImportZip.qml:62 ../qml/pages/settings/InfoKeys.qml:77
|
||||
#: ../qml/pages/settings/ImportZip.qml:62
|
||||
#: ../qml/pages/settings/InfoKeys.qml:117
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
@ -167,27 +168,31 @@ msgstr ""
|
||||
msgid "Zip Password Store Import"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/InfoKeys.qml:41
|
||||
msgid "Key id : %1"
|
||||
#: ../qml/pages/settings/InfoKeys.qml:39
|
||||
msgid "Key ID :"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/InfoKeys.qml:54
|
||||
#: ../qml/pages/settings/InfoKeys.qml:72
|
||||
msgid "Users IDs : "
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/InfoKeys.qml:96
|
||||
msgid "Delete this key"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/InfoKeys.qml:76
|
||||
#: ../qml/pages/settings/InfoKeys.qml:116
|
||||
msgid "You're are about to delete<br>%1<br>Continue ?"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/InfoKeys.qml:94
|
||||
#: ../qml/pages/settings/InfoKeys.qml:134
|
||||
msgid "Key removal failed !"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/InfoKeys.qml:103
|
||||
#: ../qml/pages/settings/InfoKeys.qml:143
|
||||
msgid "Key successfully deleted !"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/pages/settings/InfoKeys.qml:114
|
||||
#: ../qml/pages/settings/InfoKeys.qml:154
|
||||
msgid "Info Keys"
|
||||
msgstr ""
|
||||
|
||||
|
@ -95,7 +95,6 @@ Page {
|
||||
font.pixelSize: 72
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Flow {
|
||||
|
@ -33,15 +33,57 @@ Page {
|
||||
}
|
||||
|
||||
Text {
|
||||
id: uidKey
|
||||
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n.tr('Key id : %1').arg(model.modelData.uid)
|
||||
text: i18n.tr('Key ID :')
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: model.modelData.uid
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: units.gu(1)
|
||||
color: theme.palette.normal.background
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: userIdsModel
|
||||
|
||||
Component.onCompleted: {
|
||||
for(var i=0; i< model.modelData.userIds.length; ++i){
|
||||
userIdsModel.append({"model": model.modelData.userIds[i]})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n.tr('Users IDs : ')
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: userIdsModel
|
||||
Text {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: modelData.uid
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: units.gu(1)
|
||||
@ -64,9 +106,7 @@ Page {
|
||||
height: units.gu(1)
|
||||
color: theme.palette.normal.background
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component {
|
||||
|
Loading…
x
Reference in New Issue
Block a user