javaextensions/pim/framework/inc.s60/cpimtodoitem.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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:  PIM ToDo item specialization.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPIMTODOITEM_H
       
    20 #define CPIMTODOITEM_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "cpimitem.h"
       
    24 #include "mpimtodoitem.h"
       
    25 
       
    26 #include "mpimtodoadaptermanager.h"
       
    27 #include "mpimtodolistadapter.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CPIMToDoValidator;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  *  PIM item to-do specialization.
       
    36  */
       
    37 NONSHARABLE_CLASS(CPIMToDoItem): public CPIMItem,
       
    38         public MPIMToDoItem
       
    39 {
       
    40 
       
    41 public: // Constructors and destructor
       
    42 
       
    43     /**
       
    44      * Two-phased constructor.
       
    45      */
       
    46     static CPIMToDoItem* NewL(
       
    47         const CPIMToDoValidator& aValidator);
       
    48 
       
    49     static CPIMToDoItem* NewLC(
       
    50         const CPIMToDoValidator& aValidator);
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     virtual ~CPIMToDoItem();
       
    56 
       
    57 public: // New functions
       
    58 
       
    59     /**
       
    60      * Sets the associated to-do adapter manager and to-do list
       
    61      * adapter.
       
    62      *
       
    63      * @param aToDoAdapterManager Adapter manager. Must not be NULL.
       
    64      * @param aToDoListAdapter List adapter. May be NULL.
       
    65      */
       
    66     void SetToDoAdapterAssociation(
       
    67         MPIMToDoAdapterManager* aToDoAdapterManager,
       
    68         MPIMToDoListAdapter* aToDoListAdapter);
       
    69 
       
    70     /**
       
    71      * Removes the to-do adapter associations.
       
    72      * Performs any housekeeping related to removing the adapter
       
    73      * associations, if necessary.
       
    74      */
       
    75     void RemoveAdapterAssociation();
       
    76 
       
    77 public: // Functions from CPIMItem
       
    78 
       
    79     TPIMListType ItemType() const;
       
    80     void commit();
       
    81     void ListClosed();
       
    82     TBool IsReadOnly(const TPIMField& aField);
       
    83 
       
    84     void AddIntL(
       
    85         TPIMField aField,
       
    86         TPIMAttribute aAttributes,
       
    87         TInt aValue);
       
    88 
       
    89     void SetIntL(
       
    90         TPIMField aField,
       
    91         TInt aIndex,
       
    92         TPIMAttribute aAttributes,
       
    93         TInt aValue);
       
    94 
       
    95 public: // Functions from MPIMToDoItem
       
    96 
       
    97     /**
       
    98      * Returns item data representation of this class
       
    99      * There are non-const and const version of this
       
   100      * method available
       
   101      */
       
   102     MPIMItemData& ItemData();
       
   103     const MPIMItemData& ItemData() const;
       
   104 
       
   105     /**
       
   106      * Sets todo item id. This functions was introduces because
       
   107      * todo item ids are handled as strings
       
   108      *
       
   109      * @param aToDoItemId New event item id. If one exists, it will
       
   110      *        be overwriten
       
   111      */
       
   112     void SetToDoItemIdL(const TPIMItemID& aToDoItemId);
       
   113 
       
   114     /**
       
   115      * Returns the item id of this event item. This function was
       
   116      * introduced because event todo ids are handled as strings
       
   117      *
       
   118      * @return Event item id
       
   119      */
       
   120     const TPIMItemID ToDoItemId() const;
       
   121 
       
   122     /**
       
   123      * Sets the last modified date/time of the item
       
   124      * @param aLastModified Last modification date of this item
       
   125      */
       
   126     void SetLastModifiedL(TPIMDate aLastModified);
       
   127 
       
   128     /**
       
   129      * Resets the item's internal state and remove all data
       
   130      * associated with this item. The item is ready for use
       
   131      * after reset
       
   132      */
       
   133     void PrepareForLoadL();
       
   134 
       
   135 public: // functions from pimbaseitem
       
   136 
       
   137     int getPreferredIndex(TPIMField aField) const;
       
   138 
       
   139     int getRepeatHandle()
       
   140     {
       
   141         return 0;
       
   142     }
       
   143 
       
   144     bool isItemRepeating() const
       
   145     {
       
   146         return false;
       
   147     }
       
   148 
       
   149     void setItemRepeating(jboolean /*aSetRepeating*/) {}
       
   150 
       
   151 protected: // New functions
       
   152 
       
   153     /**
       
   154      * Simplifies given priority between 0 and 9 (inclusive)
       
   155      * to 1 (High), 4 (Medium) or 7 (Low).
       
   156      *
       
   157      * @return Simplified priority. If the given value is out
       
   158      *         of the [0,9] range, the value is returned as such.
       
   159      */
       
   160     TInt SimplifyPriority(TInt aPriority);
       
   161 
       
   162 protected: // Constructors
       
   163 
       
   164     /**
       
   165      * C++ constructor.
       
   166      */
       
   167     CPIMToDoItem(const CPIMToDoValidator& aValidator);
       
   168 
       
   169 private: // Data
       
   170 
       
   171     /** Associated to-do adapter manager. Not owned. May be NULL. */
       
   172     MPIMToDoAdapterManager* iToDoAdapterManager;
       
   173 
       
   174     /** Associated to-do list adapter. Not owned. May be NULL. */
       
   175     MPIMToDoListAdapter* iToDoListAdapter;
       
   176 };
       
   177 
       
   178 #endif // CPIMTODOITEM_H
       
   179 // End of File