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

akonadi

  • sources
  • kde-4.12
  • 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 ), monitor( 0 ), session( 0 ), fetchStatistics( false ), unsubscribed( false ),
50  headerContent( i18nc( "@title:column, name of a thing", "Name" ) )
51  {
52  }
53 
54  virtual ~CollectionModelPrivate() {}
55 
56  CollectionModel *q_ptr;
57  QHash<Collection::Id, Collection> collections;
58  QHash<Collection::Id, QVector<Collection::Id> > childCollections;
59 
60  QHash<Collection::Id, Collection> m_newCollections;
61  QHash< Collection::Id, QVector<Collection::Id> > m_newChildCollections;
62 
63  Monitor *monitor;
64  Session *session;
65  QStringList mimeTypes;
66  bool fetchStatistics;
67  bool unsubscribed;
68  QString headerContent;
69 
70  void init();
71  void startFirstListJob();
72  void collectionRemoved( const Akonadi::Collection& );
73  void collectionChanged( const Akonadi::Collection& );
74  void updateDone( KJob* );
75  void collectionStatisticsChanged( Collection::Id, const Akonadi::CollectionStatistics& );
76  void listDone( KJob* );
77  void editDone( KJob* );
78  void dropResult( KJob* );
79  void collectionsChanged( const Akonadi::Collection::List &cols );
80 
81  QModelIndex indexForId( Collection::Id id, int column = 0 ) const;
82  bool removeRowFromModel( int row, const QModelIndex & parent = QModelIndex() );
83  bool supportsContentType( const QModelIndex &index, const QStringList &contentTypes );
84 
85  private:
86  void updateSupportedMimeTypes( Collection col )
87  {
88  const QStringList l = col.contentMimeTypes();
89  QStringList::ConstIterator constEnd(l.constEnd());
90  for ( QStringList::ConstIterator it = l.constBegin(); it != constEnd; ++it ) {
91  if ( ( *it ) == Collection::mimeType() ) {
92  continue;
93  }
94  if ( !mimeTypes.contains( *it ) ) {
95  mimeTypes << *it;
96  }
97  }
98  }
99 };
100 
101 }
102 
103 #endif
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
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
Akonadi::Session
A communication session with the Akonadi storage.
Definition: session.h:59
Akonadi::Monitor
Monitors an item or collection for changes.
Definition: monitor.h:72
Akonadi::Collection::contentMimeTypes
QStringList contentMimeTypes() const
Returns a list of possible content mimetypes, e.g.
Definition: collection.cpp:115
Akonadi::CollectionModel
A model for collections.
Definition: collectionmodel.h:54
Akonadi::Collection::List
QList< Collection > List
Describes a list of collections.
Definition: collection.h:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:26 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
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

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