src/hbwidgets/widgets/hbdatetimepicker.cpp
author hgs
Mon, 18 Oct 2010 18:23:13 +0300
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/****************************************************************************
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
**
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
** All rights reserved.
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
** Contact: Nokia Corporation (developer.feedback@nokia.com)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
**
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
** This file is part of the HbWidgets module of the UI Extensions for Mobile.
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
**
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
** GNU Lesser General Public License Usage
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
** This file may be used under the terms of the GNU Lesser General Public
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
** License version 2.1 as published by the Free Software Foundation and
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
** appearing in the file LICENSE.LGPL included in the packaging of this file.
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
** Please review the following information to ensure the GNU Lesser General
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
** Public License version 2.1 requirements will be met:
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
**
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
** In addition, as a special exception, Nokia gives you certain additional
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
** rights.  These rights are described in the Nokia Qt LGPL Exception
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
**
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
** If you have questions regarding the use of this file, please contact
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
** Nokia at developer.feedback@nokia.com.
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
**
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
****************************************************************************/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
    26
#include "hbdatetimepicker.h"
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include "hbdatetimepicker_p.h"
2
06ff229162e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    28
#include "hbstyleoption_p.h"
34
hgs
parents: 7
diff changeset
    29
#include "hbframeitem.h"
hgs
parents: 7
diff changeset
    30
#include "hbstyleprimitivedata.h"
hgs
parents: 7
diff changeset
    31
#include <hbstyleframeprimitivedata.h>
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
/*!
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    34
    @beta
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
    \class HbDateTimePicker
34
hgs
parents: 7
diff changeset
    36
    \brief The HbDateTimePicker class provides a widget that has multiple vertical tumblers 
hgs
parents: 7
diff changeset
    37
    for selecting a date, time, or date and time by flick, drag and tap gestures.
hgs
parents: 7
diff changeset
    38
    
hgs
parents: 7
diff changeset
    39
    The number of tumblers depends on the display format. The default constructor creates
hgs
parents: 7
diff changeset
    40
    a widget for selecting a date by internally setting the display format to the default 
hgs
parents: 7
diff changeset
    41
    locale's short date format. Other constructors enable you to create a widget
hgs
parents: 7
diff changeset
    42
    for selecting a time or date and time by passing a QTime or QDateTime variable as an 
hgs
parents: 7
diff changeset
    43
    argument. Internally these constructors set the display format to the default locale's
hgs
parents: 7
diff changeset
    44
    short time or date and time format, respectively.
hgs
parents: 7
diff changeset
    45
    
hgs
parents: 7
diff changeset
    46
    Use setDisplayFormat() to set the display format. Be aware that changing the display format 
hgs
parents: 7
diff changeset
    47
    can change the widget from one for selecting the date to one for selecting the time, for 
hgs
parents: 7
diff changeset
    48
    example.
hgs
parents: 7
diff changeset
    49
    
hgs
parents: 7
diff changeset
    50
    Looping is enabled in the tumblers. The general appearance of the widget depends on the 
hgs
parents: 7
diff changeset
    51
    theme that is in use.
hgs
parents: 7
diff changeset
    52
    
hgs
parents: 7
diff changeset
    53
    <TABLE border="0">
hgs
parents: 7
diff changeset
    54
    <TR><TD>\image html hbdatetimepicker_date.png "Display format: d.MMMM"</TD>
hgs
parents: 7
diff changeset
    55
    <TD></TD>
hgs
parents: 7
diff changeset
    56
    <TD>\image html hbdatetimepicker_time.png "Display format: h.m.AP"</TD></TR>
hgs
parents: 7
diff changeset
    57
    </TABLE>
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
    58
    
34
hgs
parents: 7
diff changeset
    59
    You can set the range of values available in the tumblers by defining minimum and maximum 
hgs
parents: 7
diff changeset
    60
    values or using convenience range functions. If you change the range, if necessary 
hgs
parents: 7
diff changeset
    61
    the widget changes the displayed values so that they are within the new range. Users 
hgs
parents: 7
diff changeset
    62
    cannot select a value outside the range. One effect of this is that if you set, 
hgs
parents: 7
diff changeset
    63
    for example, an afternoon time range, users cannot scroll to the AM value when the 
hgs
parents: 7
diff changeset
    64
    display format includes an AM/PM tumbler. The date range is currently independent of the 
hgs
parents: 7
diff changeset
    65
    time range.
hgs
parents: 7
diff changeset
    66
    
hgs
parents: 7
diff changeset
    67
    You can use setInterval() to define the increments for the minute tumbler. This is 
hgs
parents: 7
diff changeset
    68
    useful when you want users to be able to set the time in 15 minute increments, for example.
hgs
parents: 7
diff changeset
    69
    
hgs
parents: 7
diff changeset
    70
    The number of rows displayed depends on how much space is available. To change the number 
hgs
parents: 7
diff changeset
    71
    of rows shown when the widget is is in a layout, for example, use 
hgs
parents: 7
diff changeset
    72
    QGraphicsLayoutItem::setPreferredHeight() to increase the space available. The widget then
hgs
parents: 7
diff changeset
    73
    increases the number of rows to occupy the available space. 
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    
34
hgs
parents: 7
diff changeset
    75
    %HbDateTimePicker emits a dateChanged(), timeChanged() or dateTimeChanged() signal when 
hgs
parents: 7
diff changeset
    76
    the user selects a new value. The selected date, time, or date and time value is passed
hgs
parents: 7
diff changeset
    77
    in a QDate, QTime, or QDateTime argument. 
hgs
parents: 7
diff changeset
    78
    
hgs
parents: 7
diff changeset
    79
    \section _usecases_hbdatetimepicker Using HbDateTimePicker
hgs
parents: 7
diff changeset
    80
    
hgs
parents: 7
diff changeset
    81
    The following example demonstrates creating a widget for selecting a date:
hgs
parents: 7
diff changeset
    82
    
hgs
parents: 7
diff changeset
    83
    \code
hgs
parents: 7
diff changeset
    84
    // Use the default constructor to create a widget for selecting a date.
hgs
parents: 7
diff changeset
    85
    HbDateTimePicker *datePicker = new HbDateTimePicker();
hgs
parents: 7
diff changeset
    86
hgs
parents: 7
diff changeset
    87
    // Set the minumum and maximum dates to display.
hgs
parents: 7
diff changeset
    88
    datePicker->setMinimumDate(QDate::currentDate());
hgs
parents: 7
diff changeset
    89
    datePicker->setMaximumDate(QDate::currentDate().addDays(365));
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
34
hgs
parents: 7
diff changeset
    91
    // Specify the display format.
hgs
parents: 7
diff changeset
    92
    datePicker->setDisplayFormat("dd.MMMM.yyyy");
hgs
parents: 7
diff changeset
    93
    \endcode
hgs
parents: 7
diff changeset
    94
    
hgs
parents: 7
diff changeset
    95
    The following example demonstrates connecting the dateChanged() signal to a slot
hgs
parents: 7
diff changeset
    96
    on an object, \a d, of a class (not shown). This has a \c setMeetingDate() function 
hgs
parents: 7
diff changeset
    97
    that takes a QDate argument.
hgs
parents: 7
diff changeset
    98
    
hgs
parents: 7
diff changeset
    99
    \code
hgs
parents: 7
diff changeset
   100
    QObject::connect(datePicker, SIGNAL(dateChanged(const QDate&)),
hgs
parents: 7
diff changeset
   101
                     d, SLOT(setMeetingDate(const QDate&)));
hgs
parents: 7
diff changeset
   102
    \endcode
hgs
parents: 7
diff changeset
   103
hgs
parents: 7
diff changeset
   104
    The following example demonstrates creating a widget for selecting a time:
hgs
parents: 7
diff changeset
   105
    
hgs
parents: 7
diff changeset
   106
    \code
hgs
parents: 7
diff changeset
   107
    // Create a widget for selecting a time.
hgs
parents: 7
diff changeset
   108
    HbDateTimePicker *timePicker = new HbDateTimePicker(QTime());
hgs
parents: 7
diff changeset
   109
hgs
parents: 7
diff changeset
   110
    // Set the minimum and maximum times using the convenience range method.
hgs
parents: 7
diff changeset
   111
    timePicker->setTimeRange(QTime::currentTime(),
hgs
parents: 7
diff changeset
   112
                             QTime::currentTime().addSecs(10*60*60));
hgs
parents: 7
diff changeset
   113
    
hgs
parents: 7
diff changeset
   114
    // Set the time interval to be 15 minutes.
hgs
parents: 7
diff changeset
   115
    timePicker->setInterval(QDateTimeEdit::MinuteSection, 15);
hgs
parents: 7
diff changeset
   116
    
hgs
parents: 7
diff changeset
   117
    // Specify the display format.
hgs
parents: 7
diff changeset
   118
    timePicker->setDisplayFormat("hh:mm.ap");
hgs
parents: 7
diff changeset
   119
    \endcode
hgs
parents: 7
diff changeset
   120
    
hgs
parents: 7
diff changeset
   121
    The following example demonstrates creating a widget for selecting a date and time:
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
    
34
hgs
parents: 7
diff changeset
   123
    \code
hgs
parents: 7
diff changeset
   124
    // Create a widget for selecting a date and time.
hgs
parents: 7
diff changeset
   125
    HbDateTimePicker *dateTimePicker =
hgs
parents: 7
diff changeset
   126
            new HbDateTimePicker(QDateTime::currentDateTime());
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   127
34
hgs
parents: 7
diff changeset
   128
    // Specify the display format.
hgs
parents: 7
diff changeset
   129
    dateTimePicker->setDisplayFormat("dd.MM.yyyy.hh.mm.ap");
hgs
parents: 7
diff changeset
   130
    \endcode
hgs
parents: 7
diff changeset
   131
    
hgs
parents: 7
diff changeset
   132
    The properties that hold the minimum and maximum values take a QDate, QTime 
hgs
parents: 7
diff changeset
   133
    or QDateTime object as an argument. DocML does not directly support properties that
hgs
parents: 7
diff changeset
   134
    use QDate, QTime or QDateTime as a parameter. This means that when you add an \b %HbDateTimePicker 
hgs
parents: 7
diff changeset
   135
    widget in Application Designer, you must pass the date, time and date and time to these
hgs
parents: 7
diff changeset
   136
    properties as a string in a valid ISO 8601 extended format. For example, YYYY-MM-DD for dates, 
hgs
parents: 7
diff changeset
   137
    hh:mm:ss for times, and YYYY-MM-DDTHH:MM:SS for combined dates and times. 
hgs
parents: 7
diff changeset
   138
    
hgs
parents: 7
diff changeset
   139
    Here is an example of the \c maximumTime property defined in DocML:
hgs
parents: 7
diff changeset
   140
    
hgs
parents: 7
diff changeset
   141
    \code
hgs
parents: 7
diff changeset
   142
    <widget name="t:dtp" type="HbDateTimePicker">
hgs
parents: 7
diff changeset
   143
        <!-- 'maximumTime' is a QTime property of HbDateTimePicker. -->
hgs
parents: 7
diff changeset
   144
        <string name ="displayFormat" value="hh:mm:ss" />
hgs
parents: 7
diff changeset
   145
        <string name="maximumTime" value="08:30:00" />
hgs
parents: 7
diff changeset
   146
    </widget>
hgs
parents: 7
diff changeset
   147
    \endcode
hgs
parents: 7
diff changeset
   148
    
hgs
parents: 7
diff changeset
   149
    \section _methodgroups_HbDateTimePicker Function groups
hgs
parents: 7
diff changeset
   150
    
hgs
parents: 7
diff changeset
   151
    \li \b Range: setDateRange(), setTimeRange(), setDateTimeRange()
hgs
parents: 7
diff changeset
   152
    \li \b Minimum \b value: setMinimumDate(), setMinimumTime(), setMinimumDateTime()
hgs
parents: 7
diff changeset
   153
    \li \b Maximum \b value: setMaximumDate(), setMaximumTime(), setMaximumDateTime()
hgs
parents: 7
diff changeset
   154
    \li \b Time \b interval: setInterval()
hgs
parents: 7
diff changeset
   155
    
hgs
parents: 7
diff changeset
   156
    \sa HbTumbleView, HbExtendedLocale
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
/*!
34
hgs
parents: 7
diff changeset
   160
    \fn void HbDateTimePicker::dateChanged(const QDate &date);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
34
hgs
parents: 7
diff changeset
   162
    This signal is emitted when there is a change in the day, month or year selected.
hgs
parents: 7
diff changeset
   163
    The new date is passed in \a date.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
/*!
34
hgs
parents: 7
diff changeset
   168
    \fn void HbDateTimePicker::timeChanged(const QTime &time);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
34
hgs
parents: 7
diff changeset
   170
    This signal is emitted when there is a change in the hour, minute, second, or AM/PM
hgs
parents: 7
diff changeset
   171
    selected. The new time is passed in \a time.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
/*!
34
hgs
parents: 7
diff changeset
   176
    \fn void HbDateTimePicker::dateTimeChanged(const QDateTime &datetime);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
34
hgs
parents: 7
diff changeset
   178
    This signal is emitted when there is a change in the value selected in any of the
hgs
parents: 7
diff changeset
   179
    tumblers in a date and time picker. The new date and time are passed in \a dateTime.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
/*!
34
hgs
parents: 7
diff changeset
   184
    Constructs an %HbDateTimePicker object with the locale's default short date display format 
hgs
parents: 7
diff changeset
   185
    and with parent \a parent.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   186
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
HbDateTimePicker::HbDateTimePicker( QGraphicsItem *parent ):
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
HbWidget(*new HbDateTimePickerPrivate, parent)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
{
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   191
    Q_D(HbDateTimePicker);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   193
    //no mode passed so it should take date as mode by default
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   194
    d->init(QVariant::Date);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   196
    setDateTime(QDateTime::currentDateTime());
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
/*!
34
hgs
parents: 7
diff changeset
   200
    Constructs an %HbDateTimePicker object with the locale's default short date and time 
hgs
parents: 7
diff changeset
   201
    display format and with parent \a parent.
hgs
parents: 7
diff changeset
   202
     
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
HbDateTimePicker::HbDateTimePicker(const QDateTime &datetime, QGraphicsItem *parent ):
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
HbWidget(*new HbDateTimePickerPrivate, parent)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   209
    d->init(QVariant::DateTime);
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   210
    setDateTime(datetime);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
/*!
34
hgs
parents: 7
diff changeset
   214
    Constructs an %HbDateTimePicker object with the locale's default short date 
hgs
parents: 7
diff changeset
   215
    display format and with parent \a parent.
hgs
parents: 7
diff changeset
   216
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
HbDateTimePicker::HbDateTimePicker(const QDate &date, QGraphicsItem *parent ):
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
HbWidget(*new HbDateTimePickerPrivate, parent)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   223
    d->init(QVariant::Date);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
    setDate(date);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
/*!
34
hgs
parents: 7
diff changeset
   228
    Constructs an %HbDateTimePicker object with the locale's default time 
hgs
parents: 7
diff changeset
   229
    display format and with parent \a parent.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   230
    
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
HbDateTimePicker::HbDateTimePicker(const QTime &time, QGraphicsItem *pParent ):
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
HbWidget(*new HbDateTimePickerPrivate, pParent)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   237
    d->init(QVariant::Time);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
    setTime(time);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
/*!
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   242
    Protected constructor for derivations.
34
hgs
parents: 7
diff changeset
   243
    
hgs
parents: 7
diff changeset
   244
    The default mode is date and time. If another mode is required, set the mDateTimeMode 
hgs
parents: 7
diff changeset
   245
    variable explicitly in the constructor of the class derived from HbDateTimePicker. This 
hgs
parents: 7
diff changeset
   246
    does not set the default date and time value. 
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
34
hgs
parents: 7
diff changeset
   248
    \sa setDateTime(), setTime(), setDate()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
HbDateTimePicker::HbDateTimePicker(HbDateTimePickerPrivate &dd, QGraphicsItem *parent):
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
HbWidget(dd, parent)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   255
    d->init(QVariant::DateTime);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
34
hgs
parents: 7
diff changeset
   258
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
bool HbDateTimePicker::event(QEvent *e)
34
hgs
parents: 7
diff changeset
   260
{   
hgs
parents: 7
diff changeset
   261
    Q_D(HbDateTimePicker);
hgs
parents: 7
diff changeset
   262
    
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
    bool result = HbWidget::event(e);
34
hgs
parents: 7
diff changeset
   264
    if(e->type() == d->mFormatEventType){
hgs
parents: 7
diff changeset
   265
        d->processFormatEvent();
hgs
parents: 7
diff changeset
   266
    }
hgs
parents: 7
diff changeset
   267
    else if (e->type()==QEvent::LayoutRequest) {
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
        updatePrimitives();
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
    }
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
    return result;
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
34
hgs
parents: 7
diff changeset
   273
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
/*!
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    Destructor.
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
HbDateTimePicker::~HbDateTimePicker()
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
/*!
34
hgs
parents: 7
diff changeset
   282
    Returns the current display format as a QString value.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   283
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
    \sa setDisplayFormat()
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
 */
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
QString HbDateTimePicker::displayFormat() const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
    return d->mFormat;
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
/*!
34
hgs
parents: 7
diff changeset
   293
    Sets the display format using a suitable combination of the following expressions 
hgs
parents: 7
diff changeset
   294
    in QString format.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
    
34
hgs
parents: 7
diff changeset
   296
    These expressions may be used for the date:
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
    <TABLE>
34
hgs
parents: 7
diff changeset
   299
    <TR><TD><b><b>Expression </b></TD><TD><b>Output</b> </TD></b></TR>
hgs
parents: 7
diff changeset
   300
    <TR><TD> d </TD><TD> The day as a number without a leading zero (1 to 31).</TD></TR>
hgs
parents: 7
diff changeset
   301
    <TR><TD> dd </TD><TD> The day as a number with a leading zero (01 to 31). </TD></TR>
hgs
parents: 7
diff changeset
   302
    <TR><TD> ddd </TD><TD>The abbreviated localized day name (such as <i>Mon</i> to <i>Sun</i>).
hgs
parents: 7
diff changeset
   303
            Uses QDate::shortDayName().</TD></TR>
hgs
parents: 7
diff changeset
   304
    <TR><TD> dddd </TD><TD>The long localized day name (such as <i>Monday</i> to <i>Sunday</i>).
hgs
parents: 7
diff changeset
   305
            Uses QDate::longDayName().</TD></TR>
hgs
parents: 7
diff changeset
   306
    <TR><TD> M </TD><TD> The month as a number without a leading zero (1 to 12).</TD></TR>
hgs
parents: 7
diff changeset
   307
    <TR><TD> MM </TD><TD> The month as a number with a leading zero (01 to 12).</TD></TR>
hgs
parents: 7
diff changeset
   308
    <TR><TD> MMM </TD><TD>The abbreviated localized month name (such as <i>Jan</i> to <i>Dec</i>).
hgs
parents: 7
diff changeset
   309
            Uses QDate::shortMonthName().</TD></TR>
hgs
parents: 7
diff changeset
   310
    <TR><TD> MMMM </TD><TD>The long localized month name (such as <i>January</i> to <i>December</i>).
hgs
parents: 7
diff changeset
   311
            Uses QDate::longMonthName().</TD></TR>
hgs
parents: 7
diff changeset
   312
    <TR><TD> yy </TD><TD>The year as a two digit number (00 to 99).</TD></TR>
hgs
parents: 7
diff changeset
   313
    <TR><TD> yyyy </TD><TD>The year as a four digit number. If the year is negative,
hgs
parents: 7
diff changeset
   314
            a minus sign is prepended.</TD></TR>
hgs
parents: 7
diff changeset
   315
    </TABLE>
hgs
parents: 7
diff changeset
   316
    
hgs
parents: 7
diff changeset
   317
    These expressions may be used for the time:
hgs
parents: 7
diff changeset
   318
hgs
parents: 7
diff changeset
   319
    <TABLE>
hgs
parents: 7
diff changeset
   320
    <TR><TD><b><b>Expression </b></TD><TD><b>Output</b> </TD></b></TR>
hgs
parents: 7
diff changeset
   321
    <TR><TD> h </TD><TD>The hour without a leading zero (0 to 23 or 1 to 12).</TD></TR>
hgs
parents: 7
diff changeset
   322
    <TR><TD> hh </TD><TD>The hour with a leading zero (00 to 23 or 01 to 12). </TD></TR>
hgs
parents: 7
diff changeset
   323
    <TR><TD>H   </TD><TD>The hour without a leading zero (0 to 23, even with AM/PM display).</TD></TR>
hgs
parents: 7
diff changeset
   324
    <TR><TD>HH  </TD><TD>The hour with a leading zero (00 to 23, even with AM/PM display).</TD></TR>
hgs
parents: 7
diff changeset
   325
    <TR><TD> m </TD><TD>The minute without a leading zero (0 to 59).</TD></TR>
hgs
parents: 7
diff changeset
   326
    <TR><TD> mm </TD><TD>The minute with a leading zero (00 to 59).</TD></TR>
hgs
parents: 7
diff changeset
   327
    <TR><TD> s </TD><TD>The second without a leading zero (0 to 59).</TD></TR>
hgs
parents: 7
diff changeset
   328
    <TR><TD> ss </TD><TD>The second with a leading zero (00 to 59).</TD></TR>
hgs
parents: 7
diff changeset
   329
    <TR><TD>AP or A </TD><TD>Displays AM and PM.</i></TD></TR>
hgs
parents: 7
diff changeset
   330
    <TR><TD>ap or a </TD><TD>Displays am and pm.</TD></TR>
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
    </TABLE>
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
34
hgs
parents: 7
diff changeset
   333
    \note Currently you must include separators in the format; for example, 'dd.mm.yy'. 
hgs
parents: 7
diff changeset
   334
    \note Use max upto 4 fields like hh:mm:ss:ap in the format. More than 4 fields will not be usable on typical mobile display.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   335
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
    \sa displayFormat()
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
void HbDateTimePicker::setDisplayFormat(const QString &format)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
{
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   340
    Q_D(HbDateTimePicker);
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
34
hgs
parents: 7
diff changeset
   342
    if(d->isFormatValid(format)){
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   343
        d->mFormat = format;
34
hgs
parents: 7
diff changeset
   344
            d->postFormatEvent();
hgs
parents: 7
diff changeset
   345
    }
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
/*!
34
hgs
parents: 7
diff changeset
   349
    Returns the currently selected date in QDate format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   350
    
34
hgs
parents: 7
diff changeset
   351
    \note DocML does not directly support properties that use QDate as a parameter. For these 
hgs
parents: 7
diff changeset
   352
    properties, pass the date as a string in a valid ISO 8601 extended format,
hgs
parents: 7
diff changeset
   353
    such as YYYY-MM-DD.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   354
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   355
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   356
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   357
        <!-- 'date' is a QDate property of HbDateTimePicker. -->
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   358
        <string name="date" value="02-02-15" />
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   359
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   360
    \endcode
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   361
34
hgs
parents: 7
diff changeset
   362
    \sa setDate()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
QDate HbDateTimePicker::date() const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
    return d->mDateTime.date();
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
/*!
34
hgs
parents: 7
diff changeset
   372
    Sets the current date to \a date.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
34
hgs
parents: 7
diff changeset
   374
    \param date The date in QDate format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   375
34
hgs
parents: 7
diff changeset
   376
    \sa date()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
void HbDateTimePicker::setDate(const QDate& date)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
    setDateTime(QDateTime(date,d->mDateTime.time()));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   384
/*!
34
hgs
parents: 7
diff changeset
   385
    Returns the minimum date in QDate format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   386
    
34
hgs
parents: 7
diff changeset
   387
    \note DocML does not directly support properties that use QDate as a parameter. For these 
hgs
parents: 7
diff changeset
   388
    properties, pass the date as a string in a valid ISO 8601 extended format, such as YYYY-MM-DD.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   389
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   390
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   391
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   392
        <!-- 'minimumDate' is a QDate property of HbDateTimePicker. -->
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   393
        <string name="minimumDate" value="02-02-15" />
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   394
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   395
    \endcode
34
hgs
parents: 7
diff changeset
   396
    
hgs
parents: 7
diff changeset
   397
    \sa setMinimumDate()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
QDate HbDateTimePicker::minimumDate()const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
    return d->mMinimumDate.date();
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
/*!
34
hgs
parents: 7
diff changeset
   406
    Sets the minimum date to \a date. 
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   407
34
hgs
parents: 7
diff changeset
   408
    \param date The minimum date in QDate format.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
    
34
hgs
parents: 7
diff changeset
   410
    \sa minimumDate(), setDateRange()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
void HbDateTimePicker::setMinimumDate(const QDate& date)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
    setMinimumDateTime(QDateTime(date, d->mMinimumDate.time()));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
/*!
34
hgs
parents: 7
diff changeset
   419
    Returns the maximum date in QDate format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   420
    
34
hgs
parents: 7
diff changeset
   421
    \note DocML does not directly support properties that use QDate as a parameter. For these 
hgs
parents: 7
diff changeset
   422
    properties, pass the date as a string in a valid ISO 8601 extended format, such as YYYY-MM-DD.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   423
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   424
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   425
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   426
        <!-- 'maximumDate' is a QDate property of HbDateTimePicker. -->
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   427
        <string name="maximumDate" value="02-02-15" />
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   428
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   429
    \endcode
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   430
34
hgs
parents: 7
diff changeset
   431
    \sa setMaximumDate()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
QDate HbDateTimePicker::maximumDate()const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
    return d->mMaximumDate.date();
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   437
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   438
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
/*!
34
hgs
parents: 7
diff changeset
   440
    Sets the maximum date to \a date. 
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
34
hgs
parents: 7
diff changeset
   442
    \param date The maximum date in QDate format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   443
34
hgs
parents: 7
diff changeset
   444
    \sa maximumDate(), setDateRange()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
void HbDateTimePicker::setMaximumDate(const QDate& date)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
    setMaximumDateTime(QDateTime(date, d->mMaximumDate.time()));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
/*!
34
hgs
parents: 7
diff changeset
   453
    Sets the minimum and maximum dates.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
34
hgs
parents: 7
diff changeset
   455
    \param minDate The minimum date in QDate format.
hgs
parents: 7
diff changeset
   456
    \param maxDate The maximum date in QDate format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   457
34
hgs
parents: 7
diff changeset
   458
    \sa setMinimumDate(), setMaximumDate()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
void HbDateTimePicker::setDateRange(const QDate &minDate, const QDate &maxDate)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
    setDateTimeRange(QDateTime(minDate, d->mMinimumDate.time()),
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
                         QDateTime(maxDate, d->mMaximumDate.time()));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
/*!
34
hgs
parents: 7
diff changeset
   468
    Returns the currently selected date and time in QDateTime format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   469
    
34
hgs
parents: 7
diff changeset
   470
    \note DocML does not directly support properties that use QDate, QTime or QDateTime as a 
hgs
parents: 7
diff changeset
   471
    parameter. For these properties, pass the date, time or date and time as a string in a 
hgs
parents: 7
diff changeset
   472
    valid ISO 8601 extended format. For example, YYYY-MM-DD for dates and YYYY-MM-DDTHH:MM:SS
hgs
parents: 7
diff changeset
   473
    for combined dates and times.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   474
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   475
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   476
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   477
        <!-- 'dateTime' is a QDateTime property of HbDateTimePicker. -->
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   478
        <string name="dateTime" value="02-02-15T02-15-30" />
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   479
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   480
    \endcode
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   481
34
hgs
parents: 7
diff changeset
   482
    \sa setDateTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
QDateTime HbDateTimePicker::dateTime()const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
    return d->mDateTime;
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
/*!
34
hgs
parents: 7
diff changeset
   491
    Sets the current date and time.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
34
hgs
parents: 7
diff changeset
   493
    \param datetime The date and time in QDateTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   494
34
hgs
parents: 7
diff changeset
   495
    \sa dateTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
void HbDateTimePicker::setDateTime(const QDateTime &datetime)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
    d->setDateTime(datetime);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
/*!
34
hgs
parents: 7
diff changeset
   504
    Returns the minimum date and time in QDateTime format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   505
    
34
hgs
parents: 7
diff changeset
   506
    \note DocML does not directly support properties that use QDate, QTime or QDateTime as a 
hgs
parents: 7
diff changeset
   507
    parameter. For these properties, pass the date, time or date and time as a string in a 
hgs
parents: 7
diff changeset
   508
    valid ISO 8601 extended format. For example, YYYY-MM-DD for dates and YYYY-MM-DDTHH:MM:SS
hgs
parents: 7
diff changeset
   509
    for combined dates and times.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   510
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   511
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   512
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   513
        <!-- 'minimumDateTime' is a QDateTime property of HbDateTimePicker. -->
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   514
        <string name="minimumDateTime" value="02-02-15T02-15-30" />
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   515
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   516
    \endcode
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   517
34
hgs
parents: 7
diff changeset
   518
    \sa setMinimumDateTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
QDateTime HbDateTimePicker::minimumDateTime()const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
    return d->mMinimumDate;
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   524
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
/*!
34
hgs
parents: 7
diff changeset
   527
    Sets the minimum date and time.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   528
34
hgs
parents: 7
diff changeset
   529
    \note The date and time are not linked in this API. This means that 
hgs
parents: 7
diff changeset
   530
    calling this function is similar to calling setMinimumDate() and setMinimumTime().
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
34
hgs
parents: 7
diff changeset
   532
    \param datetime The minimum date and time in QDateTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   533
34
hgs
parents: 7
diff changeset
   534
    \sa minimumDateTime(), setDateTimeRange()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
void HbDateTimePicker::setMinimumDateTime(const QDateTime& datetime)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   537
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
    d->setMinimumDateTime(datetime);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   542
/*!
34
hgs
parents: 7
diff changeset
   543
    Returns the maximum date and time in QDateTime format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   544
    
34
hgs
parents: 7
diff changeset
   545
    \note DocML does not directly support properties that use QDate, QTime or
hgs
parents: 7
diff changeset
   546
    QDateTime as parameters. For these properties, pass the date, time, or date and time
hgs
parents: 7
diff changeset
   547
    as a string in a valid ISO 8601 extended format. For example, YYYY-MM-DD for dates
hgs
parents: 7
diff changeset
   548
    or YYYY-MM-DDTHH:MM:SS for combined dates and times.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   549
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   550
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   551
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   552
        <!-- 'maximumDateTime' is a QDateTime property of HbDateTimePicker. -->
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   553
        <string name="maximumDateTime" value="02-02-15T02-15-30" />
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   554
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   555
    \endcode
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   556
34
hgs
parents: 7
diff changeset
   557
    \sa setMaximumDateTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
QDateTime HbDateTimePicker::maximumDateTime()const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
    return d->mMaximumDate;
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
/*!
34
hgs
parents: 7
diff changeset
   566
    Sets the maximum date and time.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   567
    
34
hgs
parents: 7
diff changeset
   568
    \note The date and time are not linked in this API. This means that 
hgs
parents: 7
diff changeset
   569
    calling this function is similar to calling setMaximumDate() and setMaximumTime().
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
34
hgs
parents: 7
diff changeset
   571
    \param date The maximum date and time in QDateTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   572
34
hgs
parents: 7
diff changeset
   573
    \sa maximumDateTime(), setDateTimeRange()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   574
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   575
void HbDateTimePicker::setMaximumDateTime(const QDateTime& date)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   576
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
    d->setMaximumDateTime(date);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   579
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   580
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
/*!
34
hgs
parents: 7
diff changeset
   582
    Sets the minimum and maximum date and time.
hgs
parents: 7
diff changeset
   583
    
hgs
parents: 7
diff changeset
   584
    \note The date and time are not linked in this API. This means that calling 
hgs
parents: 7
diff changeset
   585
    this function is equivalent to calling setMinimumDate(), setMaximumDate(), 
hgs
parents: 7
diff changeset
   586
    setMinimumTime(), and setMaximumTime().
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
34
hgs
parents: 7
diff changeset
   588
    \param minDateTime The minimum date and time in QDateTime format.
hgs
parents: 7
diff changeset
   589
    \param maxDateTime The maximum date and time in QDateTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   590
34
hgs
parents: 7
diff changeset
   591
    \sa setMinimumDateTime(), setMaximumDateTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   592
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
void HbDateTimePicker::setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   595
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
    d->setDateTimeRange(minDateTime, maxDateTime);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   598
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   599
/*!
34
hgs
parents: 7
diff changeset
   600
    Returns the currently selected time in QTime format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   601
    
34
hgs
parents: 7
diff changeset
   602
    \note DocML does not directly support properties that use QTime as a parameter.
hgs
parents: 7
diff changeset
   603
    For these properties, pass the time as a string in a valid ISO 8601 extended format; 
hgs
parents: 7
diff changeset
   604
    for example, HH:MM:SS.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   605
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   606
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   607
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   608
        <!-- 'time' is a QTime property of HbDateTimePicker. -->
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   609
        <string name="time" value="02-15-30" />
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   610
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   611
    \endcode
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   612
34
hgs
parents: 7
diff changeset
   613
    \sa setTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
QTime HbDateTimePicker::time() const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   618
    return d->mDateTime.time();
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   620
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   621
/*!
34
hgs
parents: 7
diff changeset
   622
    Sets the current time to \a time.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
34
hgs
parents: 7
diff changeset
   624
    \param time The time in QTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   625
34
hgs
parents: 7
diff changeset
   626
    \sa time()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   628
void HbDateTimePicker::setTime(const QTime &time)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
    setDateTime(QDateTime(d->mDateTime.date(), time));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
/*!
34
hgs
parents: 7
diff changeset
   635
    Returns the minimum time in QTime format.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   636
    
34
hgs
parents: 7
diff changeset
   637
    \note DocML does not directly support properties that use QTime as a parameter.
hgs
parents: 7
diff changeset
   638
    For these properties, pass the time as a string in a valid ISO 8601 extended format; 
hgs
parents: 7
diff changeset
   639
    for example, HH:MM:SS.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   640
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   641
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   642
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   643
        <!-- 'minimumTime' is a QTime property of HbDateTimePicker. -->
34
hgs
parents: 7
diff changeset
   644
        <string name="minimumTime" value="08-00-00" />
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   645
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   646
    \endcode
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   647
34
hgs
parents: 7
diff changeset
   648
    \sa setMinimumTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
QTime HbDateTimePicker::minimumTime()const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
    return d->mMinimumDate.time();
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
/*!
34
hgs
parents: 7
diff changeset
   657
    Sets the minimum time to \a time.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
34
hgs
parents: 7
diff changeset
   659
    \param time The minimum time in QTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   660
34
hgs
parents: 7
diff changeset
   661
    \sa minimumTime(), setTimeRange()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   662
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
void HbDateTimePicker::setMinimumTime(const QTime& time)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
    setMinimumDateTime(QDateTime(d->mDateTime.date(),time));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
/*!
34
hgs
parents: 7
diff changeset
   670
    Returns the maximum time in QTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   671
34
hgs
parents: 7
diff changeset
   672
    \note DocML does not directly support properties that use QTime as a parameter.
hgs
parents: 7
diff changeset
   673
    For these properties, pass the time as a string in a valid ISO 8601 extended format; 
hgs
parents: 7
diff changeset
   674
    for example, HH:MM:SS.
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   675
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   676
    \code
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   677
    <widget name="t:dtp" type="HbDateTimePicker">
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   678
        <!-- 'maximumTime' is a QTime property of HbDateTimePicker. -->
34
hgs
parents: 7
diff changeset
   679
        <string name="maximumTime" value="18-30-00" />
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   680
    </widget>
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   681
    \endcode
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   682
34
hgs
parents: 7
diff changeset
   683
    \sa setMaximumTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   684
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
QTime HbDateTimePicker::maximumTime()const
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   687
    Q_D(const HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   688
    return d->mMaximumDate.time();
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   689
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
/*!
34
hgs
parents: 7
diff changeset
   692
    Sets the maximum time to \a time.
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   693
34
hgs
parents: 7
diff changeset
   694
    \param time The maximum time in QTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   695
34
hgs
parents: 7
diff changeset
   696
    \sa maximumTime(), setTimeRange()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   697
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   698
void HbDateTimePicker::setMaximumTime(const QTime& time)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   699
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   701
    setMaximumDateTime(QDateTime(d->mMaximumDate.date(), time));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   702
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   703
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   704
/*!
34
hgs
parents: 7
diff changeset
   705
    Sets the minimum and maximum time. 
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   706
34
hgs
parents: 7
diff changeset
   707
    \param minTime The minimum time in QTime format.
hgs
parents: 7
diff changeset
   708
    \param maxTime The maximum time in QTime format.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   709
34
hgs
parents: 7
diff changeset
   710
    \sa setMinimumTime(), setMaximumTime()
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   711
*/
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
void HbDateTimePicker::setTimeRange(const QTime &minTime, const QTime &maxTime)
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   714
    Q_D(HbDateTimePicker);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   715
    setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime),
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
                     QDateTime(d->mMinimumDate.date(), maxTime));
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   718
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   719
/*!
34
hgs
parents: 7
diff changeset
   720
    Sets the interval or periodic gap for a tumbler. Currently this is
hgs
parents: 7
diff changeset
   721
    supported for minute tumblers only. 
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   722
34
hgs
parents: 7
diff changeset
   723
    \param section This identifies the tumbler. This must be QDateTimeEdit::MinuteSection.
hgs
parents: 7
diff changeset
   724
    \param interval The interval to set on the tumbler. This must be a divisor of 60; that
hgs
parents: 7
diff changeset
   725
                    is, 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, or 30.
hgs
parents: 7
diff changeset
   726
    
hgs
parents: 7
diff changeset
   727
    \sa interval()
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   728
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   729
void HbDateTimePicker::setInterval(QDateTimeEdit::Section section,int interval)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   730
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   731
    Q_D(HbDateTimePicker);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   732
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   733
    //Currently supporting interval for minute section. If other sections should be enabled in future,remove the 
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   734
    //below validation for minute section.
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   735
    if(section != QDateTimeEdit::MinuteSection){
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   736
        d->mIntervals[section] = 1;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   737
        return;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   738
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   739
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   740
    if(60 % interval)
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   741
    {
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   742
        return;
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   743
    }
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   744
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   745
    d->mIntervals[section] = interval;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   746
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   747
    //trigger minute range change
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   748
    int start=0,end=0;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   749
    if(d->mMinutePicker) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   750
        start=d->mMinuteOffset;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   751
        end=start+d->mMinuteModel->rowCount()-1;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   752
        if(d->isMinimumHour() )  {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   753
            start = d->mMinimumDate.time().minute();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   754
        } else {               
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   755
            if((d->mIntervals[QDateTimeEdit::MinuteSection]!=1) && (d->mIntervals[section]>0)) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   756
                start = d->mMinimumDate.time().minute()%d->mIntervals[section];
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   757
            } else {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   758
                start = 0;
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   759
            }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   760
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   761
        if(d->isMaximumHour()) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   762
            end = d->mMaximumDate.time().minute();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   763
        } else {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   764
            end = 59;
3
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   765
        }
11d3954df52a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   766
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 3
diff changeset
   767
        d->setMinuteRange(start,end);
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   768
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   769
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   770
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   771
/*!
34
hgs
parents: 7
diff changeset
   772
    Returns the interval set for a tumbler. Currently this is supported for 
hgs
parents: 7
diff changeset
   773
    minute tumblers only. 
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   774
34
hgs
parents: 7
diff changeset
   775
    \param section Identifies the tumbler. This must be QDateTimeEdit::MinuteSection.
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   776
34
hgs
parents: 7
diff changeset
   777
    \sa setInterval()
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   778
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   779
int HbDateTimePicker::interval(QDateTimeEdit::Section section) const
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   780
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   781
    Q_D(const HbDateTimePicker);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   782
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   783
    return d->mIntervals[section];
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   784
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   785
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   786
/*!
34
hgs
parents: 7
diff changeset
   787
    Reimplemented from QGraphicsWidget::setGeometry().
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   788
*/
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
void HbDateTimePicker::setGeometry(const QRectF &rect) 
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
    HbWidget::setGeometry(rect);
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
    updatePrimitives();
34
hgs
parents: 7
diff changeset
   793
      Q_D(HbDateTimePicker);
hgs
parents: 7
diff changeset
   794
hgs
parents: 7
diff changeset
   795
    for(int i=0;i<d->mParser.mSectionNodes.count();i++) {
hgs
parents: 7
diff changeset
   796
        switch(d->mParser.mSectionNodes[i].type) {
hgs
parents: 7
diff changeset
   797
            case HbDateTimeParser::AmPmSection:
hgs
parents: 7
diff changeset
   798
                if(!d->mAmPmPicker){
hgs
parents: 7
diff changeset
   799
                    break;
hgs
parents: 7
diff changeset
   800
                }
hgs
parents: 7
diff changeset
   801
                break;
hgs
parents: 7
diff changeset
   802
hgs
parents: 7
diff changeset
   803
            case HbDateTimeParser::DaySection:
hgs
parents: 7
diff changeset
   804
            case HbDateTimeParser::DayOfWeekSection:
hgs
parents: 7
diff changeset
   805
                if(!d->mDayPicker){
hgs
parents: 7
diff changeset
   806
                    break;
hgs
parents: 7
diff changeset
   807
                }
hgs
parents: 7
diff changeset
   808
                d->mLabelDay->setPreferredWidth(d->mDayPicker->preferredSize().width());
hgs
parents: 7
diff changeset
   809
               break;
hgs
parents: 7
diff changeset
   810
hgs
parents: 7
diff changeset
   811
            case HbDateTimeParser::MonthSection:
hgs
parents: 7
diff changeset
   812
                if(!d->mMonthPicker){
hgs
parents: 7
diff changeset
   813
                    break;
hgs
parents: 7
diff changeset
   814
                }
hgs
parents: 7
diff changeset
   815
                d->mLabelMonth->setPreferredWidth(d->mMonthPicker->preferredSize().width());
hgs
parents: 7
diff changeset
   816
               break;
hgs
parents: 7
diff changeset
   817
hgs
parents: 7
diff changeset
   818
            case HbDateTimeParser::YearSection:
hgs
parents: 7
diff changeset
   819
            case HbDateTimeParser::YearSection2Digits:
hgs
parents: 7
diff changeset
   820
                if(!d->mYearPicker){
hgs
parents: 7
diff changeset
   821
                    break;
hgs
parents: 7
diff changeset
   822
                }
hgs
parents: 7
diff changeset
   823
hgs
parents: 7
diff changeset
   824
                d->mLabelYear->setPreferredWidth(d->mYearPicker->preferredSize().width());
hgs
parents: 7
diff changeset
   825
               break;
hgs
parents: 7
diff changeset
   826
hgs
parents: 7
diff changeset
   827
            case HbDateTimeParser::SecondSection:
hgs
parents: 7
diff changeset
   828
                if(!d->mSecondPicker){
hgs
parents: 7
diff changeset
   829
                    break;
hgs
parents: 7
diff changeset
   830
                }
hgs
parents: 7
diff changeset
   831
hgs
parents: 7
diff changeset
   832
                d->mLabelSecond->setPreferredWidth(d->mSecondPicker->preferredSize().width());
hgs
parents: 7
diff changeset
   833
               break;
hgs
parents: 7
diff changeset
   834
hgs
parents: 7
diff changeset
   835
            case HbDateTimeParser::MinuteSection:
hgs
parents: 7
diff changeset
   836
                if(!d->mMinutePicker){
hgs
parents: 7
diff changeset
   837
                    break;
hgs
parents: 7
diff changeset
   838
                }
hgs
parents: 7
diff changeset
   839
               d->mLabelMinute->setPreferredWidth(d->mMinutePicker->preferredSize().width());
hgs
parents: 7
diff changeset
   840
               break;
hgs
parents: 7
diff changeset
   841
hgs
parents: 7
diff changeset
   842
            case HbDateTimeParser::Hour12Section:
hgs
parents: 7
diff changeset
   843
            case HbDateTimeParser::Hour24Section:
hgs
parents: 7
diff changeset
   844
                if(!d->mHourPicker){
hgs
parents: 7
diff changeset
   845
                    break;
hgs
parents: 7
diff changeset
   846
                }
hgs
parents: 7
diff changeset
   847
                d->mLabelHour->setPreferredWidth(d->mHourPicker->preferredSize().width());
hgs
parents: 7
diff changeset
   848
               break;
hgs
parents: 7
diff changeset
   849
hgs
parents: 7
diff changeset
   850
            default:
hgs
parents: 7
diff changeset
   851
                break;
hgs
parents: 7
diff changeset
   852
        }
hgs
parents: 7
diff changeset
   853
    }
hgs
parents: 7
diff changeset
   854
 
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
34
hgs
parents: 7
diff changeset
   857
void HbDateTimePicker::initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive)
hgs
parents: 7
diff changeset
   858
{
hgs
parents: 7
diff changeset
   859
    HbWidget::initPrimitiveData(primitiveData, primitive);
hgs
parents: 7
diff changeset
   860
    QString itemName = HbStyle::itemName(primitive);
hgs
parents: 7
diff changeset
   861
    if(itemName == QLatin1String("background")) {
hgs
parents: 7
diff changeset
   862
        HbStyleFramePrimitiveData *frameItem  = hbstyleprimitivedata_cast<HbStyleFramePrimitiveData*>(primitiveData);
hgs
parents: 7
diff changeset
   863
        frameItem->frameGraphicsName= QLatin1String("qtg_fr_tumbler_bg");
hgs
parents: 7
diff changeset
   864
        frameItem->frameType = HbFrameDrawer::NinePieces;
hgs
parents: 7
diff changeset
   865
        (const_cast<QGraphicsObject *> (primitive))->setZValue(-5);
hgs
parents: 7
diff changeset
   866
    }
hgs
parents: 7
diff changeset
   867
hgs
parents: 7
diff changeset
   868
    if(itemName == QLatin1String("frame")) {
hgs
parents: 7
diff changeset
   869
        HbStyleFramePrimitiveData *frameItem  = hbstyleprimitivedata_cast<HbStyleFramePrimitiveData*>(primitiveData);
hgs
parents: 7
diff changeset
   870
        frameItem->frameGraphicsName= QLatin1String("qtg_fr_tumbler_overlay");
hgs
parents: 7
diff changeset
   871
        frameItem->frameType = HbFrameDrawer::NinePieces;
hgs
parents: 7
diff changeset
   872
        (const_cast<QGraphicsObject *> (primitive))->setZValue(1);
hgs
parents: 7
diff changeset
   873
        
hgs
parents: 7
diff changeset
   874
    }
hgs
parents: 7
diff changeset
   875
    if(itemName == QLatin1String("highlight")) {
hgs
parents: 7
diff changeset
   876
        HbStyleFramePrimitiveData *frameItem  = hbstyleprimitivedata_cast<HbStyleFramePrimitiveData*>(primitiveData);
hgs
parents: 7
diff changeset
   877
        frameItem->frameGraphicsName= QLatin1String("qtg_fr_tumbler_highlight_pri");
hgs
parents: 7
diff changeset
   878
        frameItem->frameType = HbFrameDrawer::ThreePiecesHorizontal;
hgs
parents: 7
diff changeset
   879
        (const_cast<QGraphicsObject *> (primitive))->setZValue(-1);
hgs
parents: 7
diff changeset
   880
        
hgs
parents: 7
diff changeset
   881
    }
hgs
parents: 7
diff changeset
   882
hgs
parents: 7
diff changeset
   883
}
hgs
parents: 7
diff changeset
   884
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   885
void HbDateTimePicker::updatePrimitives()
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
{
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   887
    Q_D(HbDateTimePicker);
34
hgs
parents: 7
diff changeset
   888
    HbWidget::updatePrimitives();
hgs
parents: 7
diff changeset
   889
    
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   890
    if(d->mBackground) {
34
hgs
parents: 7
diff changeset
   891
        HbStyleFramePrimitiveData data;
hgs
parents: 7
diff changeset
   892
        initPrimitiveData(&data,d->mBackground);
hgs
parents: 7
diff changeset
   893
        style()->updatePrimitive(d->mBackground,&data,this);
hgs
parents: 7
diff changeset
   894
        if(!d->mLastAdded.isNull()){
hgs
parents: 7
diff changeset
   895
            QRectF geom = ((HbFrameItem*)d->mBackground)->geometry();
hgs
parents: 7
diff changeset
   896
            ((HbFrameItem*)d->mBackground)->setGeometry(geom.x(), d->mLastAdded->pos().y(), geom.width(), d->mLastAdded->size().height());
hgs
parents: 7
diff changeset
   897
        }
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   898
    }
34
hgs
parents: 7
diff changeset
   899
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   900
    if(d->mFrame) {
34
hgs
parents: 7
diff changeset
   901
        HbStyleFramePrimitiveData data;
hgs
parents: 7
diff changeset
   902
        initPrimitiveData(&data,d->mFrame);
hgs
parents: 7
diff changeset
   903
        style()->updatePrimitive(d->mFrame,&data,this);
hgs
parents: 7
diff changeset
   904
        if(!d->mLastAdded.isNull()){
hgs
parents: 7
diff changeset
   905
            QRectF geom = ((HbFrameItem*)d->mFrame)->geometry();
hgs
parents: 7
diff changeset
   906
            ((HbFrameItem*)d->mFrame)->setGeometry(geom.x(), d->mLastAdded->pos().y(), geom.width(), d->mLastAdded->size().height());
hgs
parents: 7
diff changeset
   907
        }
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   908
    }
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   909
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   910
    if(d->mHighlight) {
34
hgs
parents: 7
diff changeset
   911
        HbStyleFramePrimitiveData data;
hgs
parents: 7
diff changeset
   912
        initPrimitiveData (&data,d->mHighlight);
hgs
parents: 7
diff changeset
   913
        style()->updatePrimitive(d->mHighlight,&data,this);
hgs
parents: 7
diff changeset
   914
        if(!d->mLastAdded.isNull()){
hgs
parents: 7
diff changeset
   915
            qreal top = d->mLastAdded->pos().y() + d->mLastAdded->size().height()/2 - ((HbFrameItem*)d->mHighlight)->geometry().height()/2;
hgs
parents: 7
diff changeset
   916
            d->mHighlight->setPos(d->mHighlight->pos().x(), top);
hgs
parents: 7
diff changeset
   917
        }
hgs
parents: 7
diff changeset
   918
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   919
    }
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
}
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
34
hgs
parents: 7
diff changeset
   922
QGraphicsItem *HbDateTimePicker::primitive(const QString &itemName) const
hgs
parents: 7
diff changeset
   923
{
hgs
parents: 7
diff changeset
   924
    Q_D(const HbDateTimePicker);
hgs
parents: 7
diff changeset
   925
hgs
parents: 7
diff changeset
   926
    if(!itemName.compare(QString("background"))){
hgs
parents: 7
diff changeset
   927
        return d->mBackground;
hgs
parents: 7
diff changeset
   928
    }
hgs
parents: 7
diff changeset
   929
    if(!itemName.compare(QString("frame"))){
hgs
parents: 7
diff changeset
   930
        return d->mFrame;
hgs
parents: 7
diff changeset
   931
    }
hgs
parents: 7
diff changeset
   932
    if(!itemName.compare(QString("highlight"))){
hgs
parents: 7
diff changeset
   933
        return d->mHighlight;
hgs
parents: 7
diff changeset
   934
    }
hgs
parents: 7
diff changeset
   935
hgs
parents: 7
diff changeset
   936
    return HbWidget::primitive(itemName);
hgs
parents: 7
diff changeset
   937
}
hgs
parents: 7
diff changeset
   938
0
16d8024aca5e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
#include "moc_hbdatetimepicker.cpp"