akonadi
collectionmodel_p.h
00001 /* 00002 Copyright (c) 2006 - 2008 Volker Krause <vkrause@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #ifndef AKONADI_COLLECTIONMODEL_P_H 00021 #define AKONADI_COLLECTIONMODEL_P_H 00022 00023 #include "collection.h" 00024 00025 #include <klocale.h> 00026 00027 #include <QtCore/QHash> 00028 #include <QtCore/QList> 00029 #include <QtCore/QModelIndex> 00030 #include <QtCore/QStringList> 00031 00032 class KJob; 00033 00034 namespace Akonadi { 00035 00036 00037 class CollectionModel; 00038 class CollectionStatistics; 00039 class Monitor; 00040 class Session; 00041 00045 class CollectionModelPrivate 00046 { 00047 public: 00048 Q_DECLARE_PUBLIC( CollectionModel ) 00049 CollectionModelPrivate( CollectionModel *parent ) 00050 : q_ptr( parent ), fetchStatistics( false ), unsubscribed( false ), 00051 headerContent( i18nc( "@title:column, name of a thing", "Name" ) ) 00052 { 00053 } 00054 00055 virtual ~CollectionModelPrivate() {} 00056 00057 CollectionModel *q_ptr; 00058 QHash<Collection::Id, Collection> collections; 00059 QHash<Collection::Id, QVector<Collection::Id> > childCollections; 00060 00061 QHash<Collection::Id, Collection> m_newCollections; 00062 QHash< Collection::Id, QVector<Collection::Id> > m_newChildCollections; 00063 00064 Monitor *monitor; 00065 Session *session; 00066 QStringList mimeTypes; 00067 bool fetchStatistics; 00068 bool unsubscribed; 00069 QString headerContent; 00070 00071 void init(); 00072 void startFirstListJob(); 00073 void collectionRemoved( const Akonadi::Collection& ); 00074 void collectionChanged( const Akonadi::Collection& ); 00075 void updateDone( KJob* ); 00076 void collectionStatisticsChanged( Collection::Id, const Akonadi::CollectionStatistics& ); 00077 void listDone( KJob* ); 00078 void editDone( KJob* ); 00079 void dropResult( KJob* ); 00080 void collectionsChanged( const Akonadi::Collection::List &cols ); 00081 00082 QModelIndex indexForId( Collection::Id id, int column = 0 ) const; 00083 bool removeRowFromModel( int row, const QModelIndex & parent = QModelIndex() ); 00084 bool supportsContentType( const QModelIndex &index, const QStringList &contentTypes ); 00085 00086 private: 00087 void updateSupportedMimeTypes( Collection col ) 00088 { 00089 QStringList l = col.contentMimeTypes(); 00090 for ( QStringList::ConstIterator it = l.constBegin(); it != l.constEnd(); ++it ) { 00091 if ( (*it) == Collection::mimeType() ) 00092 continue; 00093 if ( !mimeTypes.contains( *it ) ) 00094 mimeTypes << *it; 00095 } 00096 } 00097 }; 00098 00099 } 00100 00101 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu Aug 2 2012 15:25:17 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu Aug 2 2012 15:25:17 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.