• 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
KGpgExpandableNode.cpp
Go to the documentation of this file.
1 /* Copyright 2008,2009,2012 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 "KGpgExpandableNode.h"
20 
21 #include "kgpgsettings.h"
22 #include "core/convert.h"
23 #include "model/kgpgitemmodel.h"
24 
25 #include <KLocale>
26 
27 KGpgExpandableNode::KGpgExpandableNode(KGpgExpandableNode *parent)
28  : KGpgNode(parent)
29 {
30  if (parent != NULL)
31  parent->children.append(this);
32 }
33 
34 KGpgExpandableNode::~KGpgExpandableNode()
35 {
36  for (int i = children.count() - 1; i >= 0; i--)
37  delete children[i];
38 }
39 
40 KGpgNode *
41 KGpgExpandableNode::getChild(const int index) const
42 {
43  if ((index < 0) || (index > children.count()))
44  return NULL;
45  return children.at(index);
46 }
47 
48 int
49 KGpgExpandableNode::getChildCount()
50 {
51  if (children.count() == 0)
52  readChildren();
53 
54  return children.count();
55 }
56 
57 bool
58 KGpgExpandableNode::hasChildren() const
59 {
60  return (children.count() != 0);
61 }
62 
63 bool
64 KGpgExpandableNode::wasExpanded() const
65 {
66  return (children.count() != 0);
67 }
68 
69 const
70 KGpgNode::List &
71 KGpgExpandableNode::getChildren() const
72 {
73  return children;
74 }
75 
76 int
77 KGpgExpandableNode::getChildIndex(KGpgNode *node) const
78 {
79  return children.indexOf(node);
80 }
81 
82 void
83 KGpgExpandableNode::deleteChild(KGpgNode *child)
84 {
85  children.removeAll(child);
86 }
87 
88 #include "KGpgExpandableNode.moc"
KGpgExpandableNode::getChildren
virtual const KGpgNode::List & getChildren() const
Definition: KGpgExpandableNode.cpp:71
KGpgExpandableNode::getChildIndex
virtual int getChildIndex(KGpgNode *node) const
Returns the index for a given child node.
Definition: KGpgExpandableNode.cpp:77
KGpgExpandableNode::~KGpgExpandableNode
virtual ~KGpgExpandableNode()
Definition: KGpgExpandableNode.cpp:34
QObject::children
const QObjectList & children() const
KGpgExpandableNode::KGpgExpandableNode
KGpgExpandableNode(KGpgExpandableNode *parent=NULL)
Definition: KGpgExpandableNode.cpp:27
KGpgExpandableNode::getChild
virtual KGpgNode * getChild(const int index) const
Returns the child node at the given index.
Definition: KGpgExpandableNode.cpp:41
KGpgExpandableNode::deleteChild
virtual void deleteChild(KGpgNode *child)
Definition: KGpgExpandableNode.cpp:83
QList::append
void append(const T &value)
kgpgitemmodel.h
KGpgExpandableNode::getChildCount
virtual int getChildCount()
Return how many child nodes exist.
Definition: KGpgExpandableNode.cpp:49
QList< KGpgNode * >
KGpgExpandableNode.h
KGpgExpandableNode::children
KGpgNode::List children
Definition: KGpgExpandableNode.h:41
KGpgNode
The abstract base class for all classes representing keyring data.
Definition: KGpgNode.h:42
KGpgExpandableNode::hasChildren
virtual bool hasChildren() const
check if there are any child nodes
Definition: KGpgExpandableNode.cpp:58
kgpgsettings.h
KGpgExpandableNode
The abstract base class for all classes that may have child objects.
Definition: KGpgExpandableNode.h:34
KGpgExpandableNode::wasExpanded
virtual bool wasExpanded() const
check if there are any child nodes present in memory
Definition: KGpgExpandableNode.cpp:64
KGpgExpandableNode::readChildren
virtual void readChildren()=0
reimplemented in every base class to read in the child data
convert.h
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