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

akonadi

  • sources
  • kde-4.14
  • kdepimlibs
  • akonadi
collectionmodel_p.h
1 /*
2  Copyright (c) 2006 - 2008 Volker Krause <vkrause@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef AKONADI_COLLECTIONMODEL_P_H
21 #define AKONADI_COLLECTIONMODEL_P_H
22 
23 #include "collection.h"
24 
25 #include <klocalizedstring.h>
26 
27 #include <QtCore/QHash>
28 #include <QtCore/QList>
29 #include <QtCore/QModelIndex>
30 #include <QtCore/QStringList>
31 
32 class KJob;
33 
34 namespace Akonadi {
35 
36 class CollectionModel;
37 class CollectionStatistics;
38 class Monitor;
39 class Session;
40 
44 class CollectionModelPrivate
45 {
46 public:
47  Q_DECLARE_PUBLIC(CollectionModel)
48  explicit CollectionModelPrivate(CollectionModel *parent)
49  : q_ptr(parent)
50  , monitor(0)
51  , session(0)
52  , fetchStatistics(false)
53  , unsubscribed(false)
54  , headerContent(i18nc("@title:column, name of a thing", "Name"))
55  {
56  }
57 
58  virtual ~CollectionModelPrivate() {}
59 
60  CollectionModel *q_ptr;
61  QHash<Collection::Id, Collection> collections;
62  QHash<Collection::Id, QVector<Collection::Id> > childCollections;
63 
64  QHash<Collection::Id, Collection> m_newCollections;
65  QHash< Collection::Id, QVector<Collection::Id> > m_newChildCollections;
66 
67  Monitor *monitor;
68  Session *session;
69  QStringList mimeTypes;
70  bool fetchStatistics;
71  bool unsubscribed;
72  QString headerContent;
73 
74  void init();
75  void startFirstListJob();
76  void collectionRemoved(const Akonadi::Collection &);
77  void collectionChanged(const Akonadi::Collection &);
78  void updateDone(KJob *);
79  void collectionStatisticsChanged(Collection::Id, const Akonadi::CollectionStatistics &);
80  void listDone(KJob *);
81  void editDone(KJob *);
82  void dropResult(KJob *);
83  void collectionsChanged(const Akonadi::Collection::List &cols);
84 
85  QModelIndex indexForId(Collection::Id id, int column = 0) const;
86  bool removeRowFromModel(int row, const QModelIndex &parent = QModelIndex());
87  bool supportsContentType(const QModelIndex &index, const QStringList &contentTypes);
88 
89 private:
90  void updateSupportedMimeTypes(Collection col)
91  {
92  const QStringList l = col.contentMimeTypes();
93  QStringList::ConstIterator constEnd(l.constEnd());
94  for (QStringList::ConstIterator it = l.constBegin(); it != constEnd; ++it) {
95  if ((*it) == Collection::mimeType()) {
96  continue;
97  }
98  if (!mimeTypes.contains(*it)) {
99  mimeTypes << *it;
100  }
101  }
102  }
103 };
104 
105 }
106 
107 #endif
QModelIndex
Akonadi::CollectionModelPrivate
Definition: collectionmodel_p.h:44
Akonadi::CollectionStatistics
Provides statistics information of a Collection.
Definition: collectionstatistics.h:69
Akonadi::Collection
Represents a collection of PIM items.
Definition: collection.h:75
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
Akonadi::Entity::Id
qint64 Id
Describes the unique id type.
Definition: entity.h:65
Akonadi::Collection::mimeType
static QString mimeType()
Returns the mimetype used for collections.
Definition: collection.cpp:197
QHash
Akonadi::Session
A communication session with the Akonadi storage.
Definition: session.h:59
QString
QList
QStringList
Akonadi::Monitor
Monitors an item or collection for changes.
Definition: monitor.h:74
QList::ConstIterator
typedef ConstIterator
Akonadi::Collection::contentMimeTypes
QStringList contentMimeTypes() const
Returns a list of possible content mimetypes, e.g.
Definition: collection.cpp:115
QList::constEnd
const_iterator constEnd() const
QList::constBegin
const_iterator constBegin() const
Akonadi::CollectionModel
A model for collections.
Definition: collectionmodel.h:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

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