|
1 /* |
|
2 * Copyright (c) 2006 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 |
|
19 #ifndef CALENINSTANCEID_H |
|
20 #define CALENINSTANCEID_H |
|
21 |
|
22 #include <qdatetime.h> |
|
23 #include <agendaentry.h> |
|
24 |
|
25 /** |
|
26 * TCalenInstanceId references to a possible instance of (repeating) entry. |
|
27 * Reference is very weak: |
|
28 * There might not be such instance, and case by case has to be decided |
|
29 * what should be done, if such instance doesn't exists. |
|
30 * |
|
31 * This class is meant to be used, when we want to store what instance was |
|
32 * used/focused/modified/displayed, but we don't want to store actual instance. |
|
33 * Actual instance might become unusable, if underlying entry is modified |
|
34 * or removed. |
|
35 * |
|
36 * Thus it's safer to store weak reference to it and fetch instance when |
|
37 * needed. |
|
38 * |
|
39 * Entry type is cached to this class only for optimization. |
|
40 * Entry type is needed e.g. when opening Options-menus to decide |
|
41 * what items should be there and fetching real instances to get entry |
|
42 * type would be too heavy operation. |
|
43 * |
|
44 * @since S60 v3.1 |
|
45 */ |
|
46 class TCalenInstanceId |
|
47 { |
|
48 public: |
|
49 // Factory method, use this normally |
|
50 static TCalenInstanceId create( const AgendaEntry& entry ); |
|
51 |
|
52 // Factory method, use this normally |
|
53 static TCalenInstanceId create( const AgendaEntry& entry, |
|
54 const QDateTime& instanceTime ); |
|
55 |
|
56 static TCalenInstanceId nullInstanceId(); |
|
57 |
|
58 /** |
|
59 * For handling missed alarms through multiple contexts |
|
60 */ |
|
61 static TCalenInstanceId create(const ulong& luid, |
|
62 const QDateTime& instanceTime, |
|
63 bool instanceViewed); |
|
64 |
|
65 // C++ constructors, do not use these normally |
|
66 /* inline TCalenInstanceId TCalenInstanceIdWithType( const ulong& luid, |
|
67 const QDateTime& instanceTime, |
|
68 AgendaEntry::Type type );*/ |
|
69 inline TCalenInstanceId(); |
|
70 |
|
71 /** |
|
72 * For handling missed alarms through multiple contexts |
|
73 * C++ constructors |
|
74 */ |
|
75 inline TCalenInstanceId( const ulong& luid, |
|
76 const QDateTime& instanceTime, |
|
77 bool instanceViewed ); |
|
78 |
|
79 bool operator==( const TCalenInstanceId& aX) const; |
|
80 |
|
81 public: // data members |
|
82 ulong mEntryLocalUid; |
|
83 QDateTime mInstanceTime; |
|
84 AgendaEntry::Type mType; |
|
85 bool mInstanceViewed; |
|
86 }; |
|
87 |
|
88 #include "CalenInstanceId.inl" |
|
89 |
|
90 |
|
91 #endif // CALENINSTANCEID_H |
|
92 |