File: ldapmodel_p.h

package info (click to toggle)
kdepimlibs 4%3A4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 22,300 kB
  • ctags: 16,353
  • sloc: cpp: 118,725; ansic: 17,101; xml: 2,722; perl: 1,791; yacc: 954; sh: 168; ruby: 60; makefile: 44
file content (93 lines) | stat: -rw-r--r-- 2,767 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
  This file is part of libkldap.
  Copyright (c) 2006 Sean Harmer <sh@theharmers.co.uk>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General  Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public License
  along with this library; see the file COPYING.LIB.  If not, write to
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  Boston, MA 02110-1301, USA.
*/

#ifndef KLDAP_LDAPMODELPRIVATE_H
#define KLDAP_LDAPMODELPRIVATE_H

#include "ldapconnection.h"
#include "ldapdn.h"
#include "ldapmodel.h"
#include "ldapobject.h"

namespace KLDAP {

class LdapModelDNNode;
class LdapSearch;

/**
 * @internal
 */
class LdapModel::LdapModelPrivate
{
  public:
    enum SearchType {
      NotSearching = 0,
      NamingContexts,
      BaseDN,
      ChildObjects
    };

    explicit LdapModelPrivate( LdapModel *parent );
    explicit LdapModelPrivate( LdapModel *parent, LdapConnection &connection );

    ~LdapModelPrivate();

    void setConnection( LdapConnection &connection );

    bool search( const LdapDN &searchBase,
                 LdapUrl::Scope scope = LdapUrl::Sub,
                 const QString &filter = QString(),
                 const QStringList &attributes = QStringList(),
                 int pagesize = 0 );

    LdapModelDNNode *rootNode() { return m_root; }
    LdapSearch *search() { return m_search; }

    LdapObjects &searchResults() { return m_searchResultObjects; }
    const LdapObjects &searchResults() const { return m_searchResultObjects; }

    void recreateRootItem();

    void setBaseDN( const LdapDN &baseDN ) { m_baseDN = baseDN; }
    LdapDN &baseDN() { return m_baseDN; }
    const LdapDN &baseDN() const { return m_baseDN; }

    void setSearchType( SearchType t, LdapModelDNNode *item = 0 );

    SearchType searchType() { return m_searchType; }
    LdapModelDNNode *searchItem() { return m_searchItem; }

    void createConnections();
    void populateRootToBaseDN();
    void gotSearchResult( KLDAP::LdapSearch *search );
    void gotSearchData( KLDAP::LdapSearch *search, const KLDAP::LdapObject &obj );

  private:
    LdapModel *m_parent;
    LdapModelDNNode *m_root;
    LdapSearch *m_search;
    LdapObjects m_searchResultObjects;
    LdapDN m_baseDN;
    SearchType m_searchType;
    LdapModelDNNode *m_searchItem;
};

}
#endif