emailservices/nmailbase/src/nmfolder.cpp
changeset 18 578830873419
child 30 759dc5235cdb
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "nmfolder.h"
       
    19 
       
    20 
       
    21 
       
    22 NmFolderPrivate::NmFolderPrivate()
       
    23 :mFolderId(0),
       
    24 mParentFolderId(0),
       
    25 mMailboxId(0),
       
    26 mName(""),
       
    27 mFolderType(NmFolderOther),
       
    28 mMessageCount(0),
       
    29 mUnreadMessageCount(0),
       
    30 mUnseenCount(0),
       
    31 mSubFolderCount(0),
       
    32 mUpdated(QDateTime())
       
    33 {
       
    34 }
       
    35 
       
    36 NmFolderPrivate::~NmFolderPrivate()
       
    37 {
       
    38 }
       
    39 
       
    40 
       
    41 /*!
       
    42     \class NmFolder
       
    43     \brief The NmFolder class represents data model for folder.
       
    44 */
       
    45 
       
    46 
       
    47 /*!
       
    48     Constructor for folder identified by \a folderId.
       
    49 */
       
    50 NmFolder::NmFolder(NmId folderId)
       
    51 {
       
    52     d = new NmFolderPrivate();
       
    53     d->mFolderId = folderId;
       
    54 }
       
    55 
       
    56 /*!
       
    57     Copy constructor
       
    58 */
       
    59 NmFolder::NmFolder(const NmFolder &folder)
       
    60 {
       
    61     d = folder.d;
       
    62 }
       
    63 
       
    64 /*!
       
    65  * Creating NmFolder from privateData
       
    66  */
       
    67 NmFolder::NmFolder(QExplicitlySharedDataPointer<NmFolderPrivate> folderPrivate)
       
    68 {
       
    69   d = folderPrivate;
       
    70 }
       
    71 
       
    72 /*!
       
    73     operator =
       
    74 */
       
    75 NmFolder &NmFolder::operator=(const NmFolder &folder)
       
    76 {
       
    77   if (this != &folder) {
       
    78     d = folder.d;
       
    79   }
       
    80   return *this;
       
    81 }
       
    82 
       
    83 /*!
       
    84     Destructor
       
    85 */
       
    86 NmFolder::~NmFolder()
       
    87 {
       
    88 }
       
    89 
       
    90 /*!
       
    91     Folder id accessor
       
    92 */
       
    93 NmId NmFolder::folderId() const
       
    94 {
       
    95     return d->mFolderId;
       
    96 }
       
    97 
       
    98 /*!
       
    99     Set folder id
       
   100 */
       
   101 void NmFolder::setFolderId(NmId folderId)
       
   102 {
       
   103   d->mFolderId = folderId;
       
   104 }
       
   105 
       
   106 /*!
       
   107     Parent id accessor
       
   108 */
       
   109 NmId NmFolder::parentId() const
       
   110 {
       
   111     return d->mParentFolderId;
       
   112 }
       
   113 
       
   114 /*!
       
   115     Set parent id
       
   116 */
       
   117 void NmFolder::setParentId(NmId parentFolderId)
       
   118 {
       
   119     d->mParentFolderId = parentFolderId;
       
   120 }
       
   121 
       
   122 /*!
       
   123     Mailbox id accessor
       
   124 */
       
   125 NmId NmFolder::mailboxId() const
       
   126 {
       
   127     return d->mMailboxId;
       
   128 }
       
   129 
       
   130 /*!
       
   131     Set mailbox id
       
   132 */
       
   133 void NmFolder::setMailboxId(NmId mailboxId)
       
   134 {
       
   135     d->mMailboxId = mailboxId;
       
   136 }
       
   137 
       
   138 /*!
       
   139     Folder name accessor
       
   140 */
       
   141 QString NmFolder::name() const
       
   142 {
       
   143     return d->mName;
       
   144 }
       
   145 
       
   146 /*!
       
   147     Set folder name
       
   148 */
       
   149 void NmFolder::setName(QString name)
       
   150 {
       
   151     d->mName = name;
       
   152 }
       
   153 
       
   154 /*!
       
   155     Folder type accessor
       
   156 */
       
   157 NmFolderType NmFolder::folderType() const
       
   158 {
       
   159     return d->mFolderType;
       
   160 }
       
   161 
       
   162 /*!
       
   163     Set folder type
       
   164 */
       
   165 void NmFolder::setFolderType(NmFolderType folderType)
       
   166 {
       
   167     d->mFolderType = folderType;
       
   168 }
       
   169 
       
   170 /*!
       
   171     Last update time accessor
       
   172 */
       
   173 QDateTime NmFolder::lastUpdated() const
       
   174 {
       
   175     return d->mUpdated;
       
   176 }
       
   177 
       
   178 /*!
       
   179     Set last update time
       
   180 */
       
   181 void NmFolder::setLastUpdated(QDateTime time)
       
   182 {
       
   183     d->mUpdated = time;
       
   184 }
       
   185 
       
   186 /*!
       
   187     Get count of messages
       
   188  */
       
   189 quint32 NmFolder::messageCount() const
       
   190 {
       
   191   return d->mMessageCount;
       
   192 }
       
   193 
       
   194 /*!
       
   195     Set count of messages
       
   196  */
       
   197 void NmFolder::setMessageCount(quint32 messageCount)
       
   198 {
       
   199   d->mMessageCount = messageCount;
       
   200 }
       
   201 
       
   202 /*!
       
   203     Count of unread messages
       
   204  */
       
   205 quint32 NmFolder::unreadMessageCount() const
       
   206 {
       
   207   return d->mUnreadMessageCount;
       
   208 }
       
   209 
       
   210 /*!
       
   211     Set count of unread messages
       
   212  */
       
   213 void NmFolder::setUnreadMessageCount(quint32 unreadMessageCount)
       
   214 {
       
   215   d->mUnreadMessageCount = unreadMessageCount;
       
   216 }
       
   217 
       
   218 /*!
       
   219     Count of unseen messages
       
   220  */
       
   221 quint32 NmFolder::unseenCount() const
       
   222 {
       
   223   return d->mUnseenCount;
       
   224 }
       
   225 
       
   226 /*!
       
   227     Set count of unseen messages
       
   228  */
       
   229 void NmFolder::setUnseenCount(quint32 unseenCount)
       
   230 {
       
   231   d->mUnseenCount =  unseenCount;
       
   232 }
       
   233 
       
   234 /*!
       
   235     Count of subfolders of current folder
       
   236  */
       
   237 quint32 NmFolder::subFolderCount() const
       
   238 {
       
   239   return d->mSubFolderCount;
       
   240 }
       
   241 
       
   242 /*!
       
   243     Set count of subfolders of current folder
       
   244  */
       
   245 void NmFolder::setSubFolderCount(quint32 subFolderCount)
       
   246 {
       
   247   d->mSubFolderCount = subFolderCount;
       
   248 }
       
   249