Warning, file /utilities/kgpg/core/KGpgSignNode.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2008, 2009, 2010, 2013 Rolf Eike Beer <kde@opensource.sf-tec.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 #include "KGpgSignNode.h" 0007 0008 #include "KGpgSignableNode.h" 0009 0010 #include <KLocalizedString> 0011 0012 class KGpgSignNodePrivate { 0013 public: 0014 KGpgSignNodePrivate(const QStringList &sl); 0015 0016 QDateTime m_creation; 0017 QDateTime m_expiration; 0018 bool m_local; 0019 bool m_revocation; 0020 }; 0021 0022 KGpgSignNodePrivate::KGpgSignNodePrivate(const QStringList &sl) 0023 : m_local(false) 0024 { 0025 Q_ASSERT(!sl.isEmpty()); 0026 m_revocation = (sl.at(0) == QLatin1String("rev")); 0027 if (sl.count() < 6) 0028 return; 0029 m_creation = QDateTime::fromSecsSinceEpoch(sl.at(5).toUInt()); 0030 if (sl.count() < 7) 0031 return; 0032 if (!sl.at(6).isEmpty()) 0033 m_expiration = QDateTime::fromSecsSinceEpoch(sl.at(6).toUInt()); 0034 if (sl.count() < 11) 0035 return; 0036 m_local = sl.at(10).endsWith(QLatin1Char( 'l' )); 0037 } 0038 0039 KGpgSignNode::KGpgSignNode(KGpgSignableNode *parent, const QStringList &s) 0040 : KGpgRefNode(parent, s.at(4)), 0041 d_ptr(new KGpgSignNodePrivate(s)) 0042 { 0043 } 0044 0045 KGpgSignNode::~KGpgSignNode() 0046 { 0047 delete d_ptr; 0048 } 0049 0050 QDateTime 0051 KGpgSignNode::getExpiration() const 0052 { 0053 const Q_D(KGpgSignNode); 0054 0055 return d->m_expiration; 0056 } 0057 0058 QDateTime 0059 KGpgSignNode::getCreation() const 0060 { 0061 const Q_D(KGpgSignNode); 0062 0063 return d->m_creation; 0064 } 0065 0066 QString 0067 KGpgSignNode::getName() const 0068 { 0069 const Q_D(KGpgSignNode); 0070 const QString name = KGpgRefNode::getName(); 0071 0072 if (!d->m_local) 0073 return name; 0074 0075 return i18n("%1 [local signature]", name); 0076 } 0077 0078 KgpgCore::KgpgItemType 0079 KGpgSignNode::getType() const 0080 { 0081 return KgpgCore::ITYPE_SIGN; 0082 }