• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

kgpg

  • sources
  • kde-4.14
  • kdeutils
  • kgpg
  • core
KGpgSignableNode.cpp
Go to the documentation of this file.
1 /* Copyright 2008,2009 Rolf Eike Beer <kde@opensource.sf-tec.de>
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU General Public License as
5  * published by the Free Software Foundation; either version 2 of
6  * the License or (at your option) version 3 or any later version
7  * accepted by the membership of KDE e.V. (or its successor approved
8  * by the membership of KDE e.V.), which shall act as a proxy
9  * defined in Section 14 of version 3 of the license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #include "KGpgSignableNode.h"
20 
21 #include <KLocale>
22 
23 KGpgSignableNode::KGpgSignableNode(KGpgExpandableNode *parent)
24  : KGpgExpandableNode(parent)
25 {
26 }
27 
28 KGpgSignableNode::~KGpgSignableNode()
29 {
30 }
31 
32 KGpgSignNode::List
33 KGpgSignableNode::getSignatures(void) const
34 {
35  KGpgSignNode::List ret;
36 
37  foreach (KGpgNode *kn, children) {
38  if (kn->getType() == KgpgCore::ITYPE_SIGN)
39  ret << kn->toSignNode();
40  }
41 
42  return ret;
43 }
44 
45 QString
46 KGpgSignableNode::getSignCount() const
47 {
48  return i18np("1 signature", "%1 signatures", children.count());
49 }
50 
51 bool
52 KGpgSignableNode::operator<(const KGpgSignableNode &other) const
53 {
54  return operator<(&other);
55 }
56 
57 bool
58 KGpgSignableNode::operator<(const KGpgSignableNode *other) const
59 {
60  switch (getType()) {
61  case KgpgCore::ITYPE_PUBLIC:
62  case KgpgCore::ITYPE_PAIR: {
63  const QString myid(getId());
64 
65  switch (other->getType()) {
66  case KgpgCore::ITYPE_PUBLIC:
67  case KgpgCore::ITYPE_PAIR:
68  return (myid < other->getId());
69  default: {
70  const QString otherid(other->getParentKeyNode()->getId());
71 
72  if (myid == otherid)
73  return true;
74  return (myid < otherid);
75  }
76  }
77  }
78  default: {
79  const QString myp(getParentKeyNode()->getId());
80 
81  switch (other->getType()) {
82  case KgpgCore::ITYPE_PAIR:
83  case KgpgCore::ITYPE_PUBLIC:
84  return (myp < other->getId());
85  default: {
86  const QString otherp(other->getParentKeyNode()->getId());
87 
88  if (otherp == myp)
89  return (getId().toInt() < other->getId().toInt());
90 
91  return (myp < otherp);
92  }
93  }
94  }
95  }
96 }
97 
98 #include "KGpgSignableNode.moc"
KGpgNode::getParentKeyNode
KGpgExpandableNode * getParentKeyNode() const
Returns the parent node in the key hierarchy.
Definition: KGpgNode.cpp:330
QObject::children
const QObjectList & children() const
KGpgSignableNode::KGpgSignableNode
KGpgSignableNode(KGpgExpandableNode *parent=NULL)
Definition: KGpgSignableNode.cpp:23
KGpgNode::getType
virtual KgpgCore::KgpgItemType getType() const =0
Returns the item type of this object.
QString::toInt
int toInt(bool *ok, int base) const
KgpgCore::ITYPE_PUBLIC
public key
Definition: kgpgkey.h:93
QString
QList
KGpgNode
The abstract base class for all classes representing keyring data.
Definition: KGpgNode.h:42
KgpgCore::ITYPE_PAIR
key pair
Definition: kgpgkey.h:94
KgpgCore::ITYPE_SIGN
signature (to a key, uid or uat)
Definition: kgpgkey.h:102
KGpgExpandableNode
The abstract base class for all classes that may have child objects.
Definition: KGpgExpandableNode.h:34
KGpgNode::getId
virtual QString getId() const
Definition: KGpgNode.cpp:318
KGpgSignableNode::~KGpgSignableNode
virtual ~KGpgSignableNode()
Definition: KGpgSignableNode.cpp:28
KGpgSignableNode::getSignatures
KGpgSignNode::List getSignatures(void) const
Definition: KGpgSignableNode.cpp:33
KGpgNode::toSignNode
KGpgSignNode * toSignNode()
Definition: KGpgNode.cpp:224
KGpgSignableNode.h
KGpgSignableNode::getSignCount
virtual QString getSignCount() const
count signatures
Definition: KGpgSignableNode.cpp:46
KGpgSignableNode::operator<
bool operator<(const KGpgSignableNode &other) const
Definition: KGpgSignableNode.cpp:52
KGpgSignableNode
An object that may have KGpgSignNode children.
Definition: KGpgSignableNode.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgpg

Skip menu "kgpg"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal