akonadi
specialcollectionshelperjobs_p.h
00001 /* 00002 Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com> 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_SPECIALCOLLECTIONSHELPERJOBS_P_H 00021 #define AKONADI_SPECIALCOLLECTIONSHELPERJOBS_P_H 00022 00023 #include "akonadiprivate_export.h" 00024 00025 #include <akonadi/collection.h> 00026 #include <akonadi/specialcollections.h> 00027 #include <akonadi/transactionsequence.h> 00028 00029 #include <QtCore/QVariant> 00030 00031 namespace Akonadi { 00032 00033 // ===================== ResourceScanJob ============================ 00034 00045 class AKONADI_TESTS_EXPORT ResourceScanJob : public Job 00046 { 00047 Q_OBJECT 00048 00049 public: 00053 explicit ResourceScanJob( const QString &resourceId, KCoreConfigSkeleton *settings, QObject *parent = 0 ); 00054 00058 ~ResourceScanJob(); 00059 00063 QString resourceId() const; 00064 00068 void setResourceId( const QString &resourceId ); 00069 00075 Akonadi::Collection rootResourceCollection() const; 00076 00081 Akonadi::Collection::List specialCollections() const; 00082 00083 protected: 00084 /* reimpl */ 00085 virtual void doStart(); 00086 00087 private: 00088 class Private; 00089 friend class Private; 00090 Private *const d; 00091 00092 Q_PRIVATE_SLOT( d, void fetchResult( KJob* ) ) 00093 }; 00094 00095 00096 // ===================== DefaultResourceJob ============================ 00097 00098 class DefaultResourceJobPrivate; 00099 00117 class AKONADI_TESTS_EXPORT DefaultResourceJob : public ResourceScanJob 00118 { 00119 Q_OBJECT 00120 00121 public: 00125 explicit DefaultResourceJob( KCoreConfigSkeleton *settings, QObject *parent = 0 ); 00126 00130 ~DefaultResourceJob(); 00131 00136 void setDefaultResourceType( const QString &type ); 00137 00142 void setDefaultResourceOptions( const QVariantMap &options ); 00143 00147 void setTypes( const QList<QByteArray> &types ); 00148 00152 void setNameForTypeMap( const QMap<QByteArray, QString> &map ); 00153 00157 void setIconForTypeMap( const QMap<QByteArray, QString> &map ); 00158 00159 protected: 00160 /* reimpl */ 00161 virtual void doStart(); 00162 /* reimpl */ 00163 virtual void slotResult( KJob *job ); 00164 00165 private: 00166 friend class DefaultResourceJobPrivate; 00167 DefaultResourceJobPrivate *const d; 00168 00169 Q_PRIVATE_SLOT( d, void resourceCreateResult( KJob* ) ) 00170 Q_PRIVATE_SLOT( d, void resourceSyncResult( KJob* ) ) 00171 Q_PRIVATE_SLOT( d, void collectionFetchResult( KJob* ) ) 00172 Q_PRIVATE_SLOT( d, void collectionModifyResult( KJob* ) ) 00173 }; 00174 00175 00176 // ===================== GetLockJob ============================ 00177 00196 class AKONADI_TESTS_EXPORT GetLockJob : public KJob 00197 { 00198 Q_OBJECT 00199 00200 public: 00204 explicit GetLockJob( QObject *parent = 0 ); 00205 00209 ~GetLockJob(); 00210 00211 /* reimpl */ 00212 virtual void start(); 00213 00214 private: 00215 class Private; 00216 friend class Private; 00217 Private *const d; 00218 00219 Q_PRIVATE_SLOT( d, void doStart() ) 00220 Q_PRIVATE_SLOT( d, void serviceOwnerChanged( QString, QString, QString ) ) 00221 Q_PRIVATE_SLOT( d, void timeout() ) 00222 }; 00223 00224 00225 // ===================== helper functions ============================ 00226 00231 void setCollectionAttributes( Akonadi::Collection &col, const QByteArray &type, 00232 const QMap<QByteArray, QString> &nameForType, 00233 const QMap<QByteArray, QString> &iconForType ); 00234 00240 bool AKONADI_TESTS_EXPORT releaseLock(); 00241 00242 } // namespace Akonadi 00243 00244 #endif // AKONADI_SPECIALCOLLECTIONSHELPERJOBS_P_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:09:24 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:09:24 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.