item_p.h

00001 /*
00002     Copyright (c) 2008 Tobias Koenig <tokoe@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_ITEM_P_H
00021 #define AKONADI_ITEM_P_H
00022 
00023 #include <QtCore/QDateTime>
00024 #include <QtCore/QMap>
00025 
00026 #include "entity_p.h"
00027 #include "itempayloadinternals_p.h"
00028 
00029 namespace Akonadi {
00030 
00034 class ItemPrivate : public EntityPrivate
00035 {
00036   public:
00037     ItemPrivate( Item::Id id = -1 )
00038       : EntityPrivate( id ),
00039         mPayload( 0 ),
00040         mRevision( -1 ),
00041         mCollectionId( -1 ),
00042         mSize( 0 ),
00043         mModificationTime(),
00044         mFlagsOverwritten( false ),
00045         mSizeChanged( false )
00046     {
00047     }
00048 
00049     ItemPrivate( const ItemPrivate &other )
00050       : EntityPrivate( other )
00051     {
00052       mFlags = other.mFlags;
00053       mRevision = other.mRevision;
00054       mSize = other.mSize;
00055       mModificationTime = other.mModificationTime;
00056       mMimeType = other.mMimeType;
00057       if ( other.mPayload )
00058         mPayload = other.mPayload->clone();
00059       else
00060         mPayload = 0;
00061       mAddedFlags = other.mAddedFlags;
00062       mDeletedFlags = other.mDeletedFlags;
00063       mFlagsOverwritten = other.mFlagsOverwritten;
00064       mSizeChanged = other.mSizeChanged;
00065       mCollectionId = other.mCollectionId;
00066     }
00067 
00068     ~ItemPrivate()
00069     {
00070       delete mPayload;
00071     }
00072 
00073     void resetChangeLog()
00074     {
00075       mFlagsOverwritten = false;
00076       mAddedFlags.clear();
00077       mDeletedFlags.clear();
00078       mSizeChanged = false;
00079     }
00080 
00081     EntityPrivate *clone() const
00082     {
00083       return new ItemPrivate( *this );
00084     }
00085 
00086     PayloadBase*  mPayload;
00087     Item::Flags mFlags;
00088     int mRevision;
00089     Entity::Id mCollectionId;
00090     qint64 mSize;
00091     QDateTime mModificationTime;
00092     QString mMimeType;
00093     Item::Flags mAddedFlags;
00094     Item::Flags mDeletedFlags;
00095     bool mFlagsOverwritten;
00096     bool mSizeChanged;
00097 };
00098 
00099 }
00100 
00101 #endif
00102 
KDE Home | KDE Accessibility Home | Description of Access Keys