45
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __CALENDATEUTILS_H__
|
|
19 |
#define __CALENDATEUTILS_H__
|
|
20 |
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <qglobal.h> // Q_DECL_EXPORT macro
|
|
23 |
#ifdef CALENDATEUTILS_DLL
|
|
24 |
#define CALENDATEUTIL_EXPORT Q_DECL_EXPORT
|
|
25 |
#else
|
|
26 |
#define CALENDATEUTIL_EXPORT Q_DECL_IMPORT
|
|
27 |
#endif
|
|
28 |
|
|
29 |
// forward declarations
|
|
30 |
class QDateTime;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* CalenDateUtils contains static utility functions useful
|
|
34 |
* when comparing and calculating with dates and times.
|
|
35 |
*
|
|
36 |
* @lib Calendar.app
|
|
37 |
* @since 2.1
|
|
38 |
*/
|
|
39 |
|
|
40 |
class CalenDateUtils
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
static bool onSameDay(const QDateTime& x, const QDateTime& y)
|
|
44 |
{
|
|
45 |
Q_UNUSED(x);Q_UNUSED(y);
|
|
46 |
return false;
|
|
47 |
}
|
|
48 |
static bool onSameMonth(const QDateTime& x, const QDateTime& y)
|
|
49 |
{
|
|
50 |
Q_UNUSED(x);Q_UNUSED(y);
|
|
51 |
return false;
|
|
52 |
}
|
|
53 |
static QDateTime beginningOfDay(const QDateTime& startTime)
|
|
54 |
{
|
|
55 |
Q_UNUSED(startTime);
|
|
56 |
return QDateTime();
|
|
57 |
}
|
|
58 |
static QDateTime displayTimeOnDay(const QDateTime& startTime,
|
|
59 |
const QDateTime& day)
|
|
60 |
{
|
|
61 |
Q_UNUSED(startTime);Q_UNUSED(day);
|
|
62 |
return QDateTime();
|
|
63 |
}
|
|
64 |
|
|
65 |
static bool timeRangesIntersect(const QDateTime& xStart,
|
|
66 |
const QDateTime& xEnd, const QDateTime& yStart,
|
|
67 |
const QDateTime& yEnd)
|
|
68 |
{
|
|
69 |
Q_UNUSED(xStart);Q_UNUSED(xEnd);Q_UNUSED(yStart);Q_UNUSED(yEnd);
|
|
70 |
return false;
|
|
71 |
}
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Is aTime between KCalenMaxYear/KCalenMaxMonth/KCalenMaxDay
|
|
75 |
* and KCalenMinYear/KCalenMinMonth/KCalenMinDay.
|
|
76 |
* Min/Max day is defined agenda server.
|
|
77 |
* @param aTime aTime to be checked
|
|
78 |
* @return EFalse : Out of range
|
|
79 |
*/
|
|
80 |
static bool isValidDay(const QDateTime& time)
|
|
81 |
{
|
|
82 |
Q_UNUSED(time);
|
|
83 |
return false;
|
|
84 |
}
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Return Min or Max time if aTime goes out of bounds.
|
|
88 |
* Valid range is [CalenDateUtils::MinTime(), CalenDateUtils::MaxTime]
|
|
89 |
* @param aTime time to be checked
|
|
90 |
* @return aTime, if aTime in [CalenDateUtils::MinTime(), CalenDateUtils::MaxTime]
|
|
91 |
* CalenDateUtils::MinTime(), if aTime < CalenDateUtils::MinTime()
|
|
92 |
* CalenDateUtils::MaxTime(), if aTime > CalenDateUtils::MaxTime()
|
|
93 |
*/
|
|
94 |
static QDateTime limitToValidTime(const QDateTime& time)
|
|
95 |
{
|
|
96 |
Q_UNUSED(time);
|
|
97 |
return QDateTime();
|
|
98 |
}
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Return maximum allowed time. (31.
|
|
102 |
*/
|
|
103 |
static QDateTime maxTime()
|
|
104 |
{
|
|
105 |
return QDateTime();
|
|
106 |
}
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Return minimum allowed time.
|
|
110 |
*/
|
|
111 |
static QDateTime minTime()
|
|
112 |
{
|
|
113 |
return QDateTime();
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Return time of day as a minutes from midnight. Useful to get hours::minutes component of datetime,
|
|
118 |
* regardless of date
|
|
119 |
*/
|
|
120 |
static int timeOfDay(const QDateTime& dateTime)
|
|
121 |
{
|
|
122 |
Q_UNUSED(dateTime);
|
|
123 |
return 0;
|
|
124 |
}
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Round QDateTime to previous full hour, e.g. RoundToPreviousHour( 23.11.2006 9:31 ) = 23.11.2006 9:00
|
|
128 |
*/
|
|
129 |
static QDateTime roundToPreviousHour(const QDateTime& dateTime)
|
|
130 |
{
|
|
131 |
Q_UNUSED(dateTime);
|
|
132 |
return QDateTime();
|
|
133 |
}
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Round QDateTimeIntervalMinutes to previous full hour, e.g. RoundToPreviousHour( 130 min ) = 120 min
|
|
137 |
*/
|
|
138 |
static int roundToPreviousHour(const int& minutes)
|
|
139 |
{
|
|
140 |
Q_UNUSED(minutes);
|
|
141 |
return 0;
|
|
142 |
}
|
|
143 |
|
|
144 |
/**
|
|
145 |
* @return current time.
|
|
146 |
*/
|
|
147 |
static QDateTime now()
|
|
148 |
{
|
|
149 |
return QDateTime();
|
|
150 |
}
|
|
151 |
|
|
152 |
/**
|
|
153 |
* @return today with time component set to 00:00.
|
|
154 |
*/
|
|
155 |
static QDateTime today()
|
|
156 |
{
|
|
157 |
return QDateTime();
|
|
158 |
}
|
|
159 |
|
|
160 |
/**
|
|
161 |
* @return ETrue if given aTime is on today, EFalse otherwise
|
|
162 |
*/
|
|
163 |
static bool isOnToday(const QDateTime& time)
|
|
164 |
{
|
|
165 |
Q_UNUSED(time);
|
|
166 |
return false;
|
|
167 |
}
|
|
168 |
|
|
169 |
/*
|
|
170 |
* Given aDate = DD::MM::YY @ hh:mm:ss, it returns a QDateTime obj DD::MM::YY @ 08:00 am
|
|
171 |
* @param: aDate, which has the DD::MM::YY
|
|
172 |
*/
|
|
173 |
static QDateTime defaultTime(const QDateTime& date)
|
|
174 |
{
|
|
175 |
Q_UNUSED(date);
|
|
176 |
return QDateTime();
|
|
177 |
}
|
|
178 |
|
|
179 |
static QDateTime futureOf(const QDateTime& dateTime, int numOfDays)
|
|
180 |
{
|
|
181 |
Q_UNUSED(dateTime);Q_UNUSED(numOfDays);
|
|
182 |
return QDateTime();
|
|
183 |
}
|
|
184 |
};
|
|
185 |
|
|
186 |
#endif // __CALENDATEUTILS_H__
|
|
187 |
|
|
188 |
// End of File
|