src/hbwidgets/widgets/hbdatetimepicker.cpp
changeset 3 11d3954df52a
parent 2 06ff229162e9
child 7 923ff622b8b9
equal deleted inserted replaced
2:06ff229162e9 3:11d3954df52a
    28 #include "hbstyleoption_p.h"
    28 #include "hbstyleoption_p.h"
    29 
    29 
    30 /*!
    30 /*!
    31     @beta
    31     @beta
    32     \class HbDateTimePicker
    32     \class HbDateTimePicker
    33     \brief HbDateTimePicker class provides a widget for picking the date, time, date and time. 
    33     \brief HbDateTimePicker class provides a widget for picking the date, time, date and time. <br>
       
    34     
    34     By default date picker will be created, with date functionality only.
    35     By default date picker will be created, with date functionality only.
    35     For exclusive time or datetime picker creation, use QTime or QDateTime variable as parameter for the constructor.
    36     For exclusive time or datetime picker creation, use QTime or QDateTime variable as parameter for the constructor.
    36     \li Date and Time
    37     \li Date and Time
    37     \li Date
    38     \li Date
    38     \li Time
    39     \li Time
    39     
    40     
       
    41     Below is a sample code snippet for datetime picker creation:
    40     \snippet{ultimatecodesnippet/ultimatecodesnippet.cpp,51}
    42     \snippet{ultimatecodesnippet/ultimatecodesnippet.cpp,51}
    41 
    43 
    42     By default, display format is from HbExtendedLocale. User can set the format using \sa setDisplayFormat.
    44     By default, display format is from HbExtendedLocale. User can set the format using setDisplayFormat API. \sa setDisplayFormat.<br>
    43     Based on the display format the tumblers or sections will be rearranged.
    45     Based on the display format the tumblers or sections will be rearranged.<br>
    44     
    46     For each tumbler(TumbleView) in datetime picker, loopingEnabled property is always true.<br>
    45     HbDateTimePicker provides various date and time range functionalities.
    47     
    46     currently the date range is independent of the time range.
    48     HbDateTimePicker provides various date and time range functionalities.<br>
       
    49     Currently the date range is independent of the time range.
    47     \sa setDateRange \sa setTimeRange \sa setDateTimeRange
    50     \sa setDateRange \sa setTimeRange \sa setDateTimeRange
    48     \sa setMinimumTime \sa setMaximumTime \sa setMinimumDate \sa setMaximumDate
    51     \sa setMinimumTime \sa setMaximumTime \sa setMinimumDate \sa setMaximumDate
    49     \sa setMinimumDateTime \sa setMaximumDateTime
    52     \sa setMinimumDateTime \sa setMaximumDateTime
       
    53 
       
    54     \image html hbdatetimepicker_date.png  "Datetime picker with date functionalities, in d/MMMM format"
       
    55     \image html hbdatetimepicker_time.png  "Datetime picker with time functionalities, in h.m.AP format"
       
    56 
       
    57     <b>Note:</b>Graphics in the above images varies depending on theme.
    50 */
    58 */
    51 
    59 
    52 /*!
    60 /*!
    53     \fn void dateChanged(const QDate &date)
    61     \fn void dateChanged(const QDate &date)
    54 
    62 
    55     This signal is emitted when item selection changes in any of the date pickers in the datetimepicker widget.
    63     This signal is emitted when item selection changes in any of the date pickers(day, month, year) in the datetimepicker widget.
    56     
    64     
    57     \param date  selected by the user.
    65     \param date  selected by the user.
    58 
    66 
    59 */
    67 */
    60 
    68 
    61 /*!
    69 /*!
    62     \fn void timeChanged(const QTime &time)
    70     \fn void timeChanged(const QTime &time)
    63 
    71 
    64     This signal is emitted when item selection changes in any of the time pickers in the datetimepicker widget.
    72     This signal is emitted when item selection changes in any of the time pickers(hour, minute, second, am/pm) in the datetimepicker widget.
    65     \param time  selected by the user.
    73     \param time  selected by the user.
    66 
    74 
    67 */
    75 */
    68 
    76 
    69 /*!
    77 /*!
    70     \fn void dateTimeChanged(const QDateTime &datetime)
    78     \fn void dateTimeChanged(const QDateTime &datetime)
    71 
    79 
    72     This signal is emitted when item selection changes in any of the pickers in the datetimepicker widget.
    80     This signal is emitted when item selection changes in any of the date and time pickers in the datetimepicker widget.
    73     \param datetime  selected by the user.
    81     \param datetime  selected by the user.
    74 
    82 
    75 */
    83 */
    76 
    84 
    77 /*!
    85 /*!
    78     Constructs date picker widget by default.
    86     Constructs date picker widget by default.
    79 
    87 
    80     \param parent parent item.
    88     \param parent parent item for datetime picker widget.
    81 */
    89 */
    82 HbDateTimePicker::HbDateTimePicker( QGraphicsItem *parent ):
    90 HbDateTimePicker::HbDateTimePicker( QGraphicsItem *parent ):
    83 HbWidget(*new HbDateTimePickerPrivate, parent)
    91 HbWidget(*new HbDateTimePickerPrivate, parent)
    84 {
    92 {
    85 	Q_D(HbDateTimePicker);
    93     Q_D(HbDateTimePicker);
    86 
    94 
    87 	//no mode passed so it should take date as mode by default
    95     //no mode passed so it should take date as mode by default
    88 	d->init(QVariant::Date);
    96     d->init(QVariant::Date);
    89 
    97 
    90 	setDateTime(QDateTime::currentDateTime());
    98     setDateTime(QDateTime::currentDateTime());
    91 }
    99 }
    92 
   100 
    93 /*!
   101 /*!
    94     Constructs datetime picker widget.
   102     Constructs datetime picker widget with both date and time functionalities and with default locale's datetime format. 
    95 
   103     \param datetime Value to be set on datetime picker widget, which has both date and time related tumblers.
    96     \param datetime QDateTime value.
       
    97 */
   104 */
    98 HbDateTimePicker::HbDateTimePicker(const QDateTime &datetime, QGraphicsItem *parent ):
   105 HbDateTimePicker::HbDateTimePicker(const QDateTime &datetime, QGraphicsItem *parent ):
    99 HbWidget(*new HbDateTimePickerPrivate, parent)
   106 HbWidget(*new HbDateTimePickerPrivate, parent)
   100 {
   107 {
   101     Q_D(HbDateTimePicker);
   108     Q_D(HbDateTimePicker);
   102 
   109 
   103 	d->init(QVariant::DateTime);
   110     d->init(QVariant::DateTime);
   104 	setDateTime(datetime);
   111     setDateTime(datetime);
   105 }
   112 }
   106 
   113 
   107 /*!
   114 /*!
   108     Constructs date picker widget with default locale's date format.
   115     Constructs datetime picker widget with only date functionalities and with default locale's date format.
   109     
   116     
   110     \param date QDate value.
   117     \param date QDate value.
   111 */
   118 */
   112 HbDateTimePicker::HbDateTimePicker(const QDate &date, QGraphicsItem *parent ):
   119 HbDateTimePicker::HbDateTimePicker(const QDate &date, QGraphicsItem *parent ):
   113 HbWidget(*new HbDateTimePickerPrivate, parent)
   120 HbWidget(*new HbDateTimePickerPrivate, parent)
   114 {
   121 {
   115     Q_D(HbDateTimePicker);
   122     Q_D(HbDateTimePicker);
   116 
   123 
   117 	d->init(QVariant::Date);
   124     d->init(QVariant::Date);
   118     setDate(date);
   125     setDate(date);
   119 }
   126 }
   120 
   127 
   121 /*!
   128 /*!
   122     Constructs time picker widget with default locale's time format.
   129     Constructs datetime picker widget with only time functionalities and with with default locale's time format.
   123     
   130     
   124     \param time QTime value.
   131     \param time QTime value.
   125 */
   132 */
   126 HbDateTimePicker::HbDateTimePicker(const QTime &time, QGraphicsItem *pParent ):
   133 HbDateTimePicker::HbDateTimePicker(const QTime &time, QGraphicsItem *pParent ):
   127 HbWidget(*new HbDateTimePickerPrivate, pParent)
   134 HbWidget(*new HbDateTimePickerPrivate, pParent)
   128 {
   135 {
   129     Q_D(HbDateTimePicker);
   136     Q_D(HbDateTimePicker);
   130 
   137 
   131 	d->init(QVariant::Time);
   138     d->init(QVariant::Time);
   132     setTime(time);
   139     setTime(time);
   133 }
   140 }
   134 
   141 
   135 /*!
   142 /*!
   136     Internal. Protected constructor for derivations.
   143     \internal
       
   144     Protected constructor for derivations.
   137     the default mode is DateTimeMode, if other mode is required, set the mDateTimeMode variable.
   145     the default mode is DateTimeMode, if other mode is required, set the mDateTimeMode variable.
   138     this does not set any default datetime, needs to be explicitly done in the derived constructor.
   146     this does not set any default datetime, needs to be explicitly done in the derived constructor.
   139 
   147 
   140     \sa setDateTime, setTime, setDate
   148     \sa setDateTime, setTime, setDate
   141 */
   149 */
   142 HbDateTimePicker::HbDateTimePicker(HbDateTimePickerPrivate &dd, QGraphicsItem *parent):
   150 HbDateTimePicker::HbDateTimePicker(HbDateTimePickerPrivate &dd, QGraphicsItem *parent):
   143 HbWidget(dd, parent)
   151 HbWidget(dd, parent)
   144 {
   152 {
   145     Q_D(HbDateTimePicker);
   153     Q_D(HbDateTimePicker);
   146 
   154 
   147 	d->init(QVariant::DateTime);
   155     d->init(QVariant::DateTime);
   148 }
   156 }
   149 
   157 
   150 /*!
   158 /*!
   151     \reimp
   159     \reimp
   152 */
   160 */
   167 }
   175 }
   168 
   176 
   169 /*!
   177 /*!
   170     Returns current display format as QString value.
   178     Returns current display format as QString value.
   171 
   179 
   172     \return display format.
   180     \return display format of datetime picker widget.
   173 
   181 
   174     \sa setDisplayFormat()
   182     \sa setDisplayFormat()
   175  */
   183  */
   176 QString HbDateTimePicker::displayFormat() const
   184 QString HbDateTimePicker::displayFormat() const
   177 {
   185 {
   208     </TABLE>
   216     </TABLE>
   209 
   217 
   210     NOTE:setDisplayFormat works only when the seperators are mentioned in the format like 'dd.mm.yy' or 'dd mm yy', this
   218     NOTE:setDisplayFormat works only when the seperators are mentioned in the format like 'dd.mm.yy' or 'dd mm yy', this
   211          will be fixed in the future versions.
   219          will be fixed in the future versions.
   212 
   220 
   213     \param format is the display format in QString format.
   221     \param format is the display format, for datetime picker widget, in QString format.
   214 
   222 
   215     \sa displayFormat()
   223     \sa displayFormat()
   216 */
   224 */
   217 void HbDateTimePicker::setDisplayFormat(const QString &format)
   225 void HbDateTimePicker::setDisplayFormat(const QString &format)
   218 {
   226 {
   219 	Q_D(HbDateTimePicker);
   227     Q_D(HbDateTimePicker);
   220 
   228 
   221 	if(d->isFormatValid(format)){ 
   229     if(d->isFormatValid(format)){ 
   222 		d->mFormat = format;
   230         d->mFormat = format;
   223 		d->parseDisplayFormat(format);        
   231         d->parseDisplayFormat(format);        
   224 		d->rearrangeTumbleViews();
   232         d->rearrangeTumbleViews();
   225         d->emitDateTimeChange();
   233         d->emitDateTimeChange();
   226 	}//End If format is valid
   234     }//End If format is valid
   227 }
   235 }
   228 
   236 
   229 /*!
   237 /*!
   230     Returns the current date in QDate format.
   238     Returns the current date in QDate format.
   231 
   239 
   232     \return Date Picker's current date.
   240     \return current selected date in datetime picker.
       
   241 
       
   242     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   243     as a string, in a valid ISO date format. 
       
   244     
       
   245     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   246 
       
   247     \code
       
   248     ...
       
   249     <widget name="t:dtp" type="HbDateTimePicker">
       
   250         <!-- 'date' is a QDate property of HbDateTimePicker. -->
       
   251         <string name="date" value="02-02-15" />
       
   252     </widget>
       
   253     ...
       
   254     \endcode
   233 
   255 
   234     \sa setDate
   256     \sa setDate
   235 */
   257 */
   236 QDate HbDateTimePicker::date() const
   258 QDate HbDateTimePicker::date() const
   237 {
   259 {
   241 }
   263 }
   242 
   264 
   243 /*!
   265 /*!
   244     Sets the current \a date in the form of QDate.
   266     Sets the current \a date in the form of QDate.
   245 
   267 
   246     \param date date in QDate format
   268     \param date date to be set on the datetime picker in QDate format
   247 
   269 
   248     \sa date
   270     \sa date
   249 */
   271 */
   250 void HbDateTimePicker::setDate(const QDate& date)
   272 void HbDateTimePicker::setDate(const QDate& date)
   251 {
   273 {
   254 }
   276 }
   255 
   277 
   256 /*!
   278 /*!
   257     Returns minimum date in QDate format.
   279     Returns minimum date in QDate format.
   258 
   280 
   259     \return Minimum date in QDate format.
   281     \return Minimum date set on datetime picker in QDate format.
       
   282 
       
   283     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   284     as a string, in a valid ISO date format. 
       
   285     
       
   286     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   287 
       
   288     \code
       
   289     ...
       
   290     <widget name="t:dtp" type="HbDateTimePicker">
       
   291         <!-- 'minimumDate' is a QDate property of HbDateTimePicker. -->
       
   292         <string name="minimumDate" value="02-02-15" />
       
   293     </widget>
       
   294     ...
       
   295     \endcode
   260 
   296 
   261     \sa setMinimumDate
   297     \sa setMinimumDate
   262 */
   298 */
   263 QDate HbDateTimePicker::minimumDate()const
   299 QDate HbDateTimePicker::minimumDate()const
   264 {
   300 {
   267 }
   303 }
   268 
   304 
   269 /*!
   305 /*!
   270     Sets minimum \a date in QDate format.
   306     Sets minimum \a date in QDate format.
   271 
   307 
   272     \param Minimum date in QDate format.
   308     \param Minimum date to be set on datetime picker in QDate format.
   273     
   309     
   274     \sa minimumDate
   310     \sa minimumDate
   275 */
   311 */
   276 void HbDateTimePicker::setMinimumDate(const QDate& date)
   312 void HbDateTimePicker::setMinimumDate(const QDate& date)
   277 {
   313 {
   280 }
   316 }
   281 
   317 
   282 /*!
   318 /*!
   283     Returns maximum date in QDate format.
   319     Returns maximum date in QDate format.
   284 
   320 
   285     \return Maximum Date in QDate format.
   321     \return Maximum Date set on datetime picker in QDate format.
       
   322 
       
   323     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   324     as a string, in a valid ISO date format. 
       
   325     
       
   326     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   327 
       
   328     \code
       
   329     ...
       
   330     <widget name="t:dtp" type="HbDateTimePicker">
       
   331         <!-- 'maximumDate' is a QDate property of HbDateTimePicker. -->
       
   332         <string name="maximumDate" value="02-02-15" />
       
   333     </widget>
       
   334     ...
       
   335     \endcode
   286 
   336 
   287     \sa setMaximumDate
   337     \sa setMaximumDate
   288 */
   338 */
   289 QDate HbDateTimePicker::maximumDate()const
   339 QDate HbDateTimePicker::maximumDate()const
   290 {
   340 {
   293 }
   343 }
   294 
   344 
   295 /*!
   345 /*!
   296     Sets maximum \a date in QDate format.
   346     Sets maximum \a date in QDate format.
   297 
   347 
   298     \param date Maximum date in QDate format.
   348     \param date Maximum date to be set on datetime picker in QDate format.
   299 
   349 
   300     \sa maximumDate
   350     \sa maximumDate
   301 */
   351 */
   302 void HbDateTimePicker::setMaximumDate(const QDate& date)
   352 void HbDateTimePicker::setMaximumDate(const QDate& date)
   303 {
   353 {
   304     Q_D(HbDateTimePicker);
   354     Q_D(HbDateTimePicker);
   305     setMaximumDateTime(QDateTime(date, d->mMaximumDate.time()));
   355     setMaximumDateTime(QDateTime(date, d->mMaximumDate.time()));
   306 }
   356 }
   307 
   357 
   308 /*!
   358 /*!
   309     Sets minimum \a minDate and maximum \a maxDate dates in QDate format.
   359     Sets minimum \a minDate and maximum \a maxDate dates in QDate format. This will allow user to set date range on datetime picker.
   310 
   360 
   311     \param minDate Minimum date in QDate format.
   361     \param minDate Minimum date in QDate format.
   312     \param maxDate Maximum date in QDate format.
   362     \param maxDate Maximum date in QDate format.
   313 
   363 
   314     \sa setMinimumDate \sa setMaximumDate
   364     \sa setMinimumDate \sa setMaximumDate
   319     setDateTimeRange(QDateTime(minDate, d->mMinimumDate.time()),
   369     setDateTimeRange(QDateTime(minDate, d->mMinimumDate.time()),
   320                          QDateTime(maxDate, d->mMaximumDate.time()));
   370                          QDateTime(maxDate, d->mMaximumDate.time()));
   321 }
   371 }
   322 
   372 
   323 /*!
   373 /*!
   324     Returns the current datetime in QDateTime format.
   374     Returns the current date and time value, selected in datetime picker, in QDateTime format.
   325 
   375 
   326     \return date and time value in QDateTime format.
   376     \return date and time value in QDateTime format.
   327 
   377 
       
   378     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   379     as a string, in a valid ISO date format. 
       
   380     
       
   381     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   382 
       
   383     \code
       
   384     ...
       
   385     <widget name="t:dtp" type="HbDateTimePicker">
       
   386         <!-- 'dateTime' is a QDateTime property of HbDateTimePicker. -->
       
   387         <string name="dateTime" value="02-02-15T02-15-30" />
       
   388     </widget>
       
   389     ...
       
   390     \endcode
       
   391 
   328     \sa setDateTime
   392     \sa setDateTime
   329 */
   393 */
   330 QDateTime HbDateTimePicker::dateTime()const
   394 QDateTime HbDateTimePicker::dateTime()const
   331 {
   395 {
   332     Q_D(const HbDateTimePicker);
   396     Q_D(const HbDateTimePicker);
   333     return d->mDateTime;
   397     return d->mDateTime;
   334 }
   398 }
   335 
   399 
   336 /*!
   400 /*!
   337     Sets the current \a datetime in the form of QDateTime.
   401     Sets the current \a datetime value to be set on datetime picker in QDateTime format.
   338 
   402 
   339     \param datetime in QDateTime format.
   403     \param datetime in QDateTime format.
   340 
   404 
   341     \sa dateTime
   405     \sa dateTime
   342 */
   406 */
   345     Q_D(HbDateTimePicker);
   409     Q_D(HbDateTimePicker);
   346     d->setDateTime(datetime);
   410     d->setDateTime(datetime);
   347 }
   411 }
   348 
   412 
   349 /*!
   413 /*!
   350     Returns minimum date time in QDateTime format.
   414     Returns minimum date time value set on datetime picker in QDateTime format.
   351 
   415 
   352     \return Minimum date and minimum time in QDateTime format.
   416     \return Minimum date and minimum time in QDateTime format.
   353 
   417 
       
   418     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   419     as a string, in a valid ISO date format. 
       
   420     
       
   421     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   422 
       
   423     \code
       
   424     ...
       
   425     <widget name="t:dtp" type="HbDateTimePicker">
       
   426         <!-- 'minimumDateTime' is a QDateTime property of HbDateTimePicker. -->
       
   427         <string name="minimumDateTime" value="02-02-15T02-15-30" />
       
   428     </widget>
       
   429       ...
       
   430     \endcode
       
   431 
   354     \sa setMinimumDateTime
   432     \sa setMinimumDateTime
   355 */
   433 */
   356 QDateTime HbDateTimePicker::minimumDateTime()const
   434 QDateTime HbDateTimePicker::minimumDateTime()const
   357 {
   435 {
   358     Q_D(const HbDateTimePicker);
   436     Q_D(const HbDateTimePicker);
   359     return d->mMinimumDate;
   437     return d->mMinimumDate;
   360 }
   438 }
   361 
   439 
   362 /*!
   440 /*!
   363     Sets minimum \a datetime in QDateTime format.
   441     Sets minimum \a datetime for datetime picker in QDateTime format.
   364 	<b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now
   442 
   365 	would be similar to using combination of \sa setMinimumDate and \sa setMinimumTime
   443     <b>Note:</b> There's no link between Date functionality and time functionality in this API. Using this API, for now,
       
   444     would be similar to using a combination of setMinimumDate and setMinimumTime APIs.
   366 
   445 
   367     \param datetime minimum date and minimum time in QDateTime format.
   446     \param datetime minimum date and minimum time in QDateTime format.
   368 
   447 
   369     \sa minimumDateTime \sa setMinimumDate \sa setMinimumTime
   448     \sa minimumDateTime \sa setMinimumDate \sa setMinimumTime
   370 */
   449 */
   373     Q_D(HbDateTimePicker);
   452     Q_D(HbDateTimePicker);
   374     d->setMinimumDateTime(datetime);
   453     d->setMinimumDateTime(datetime);
   375 }
   454 }
   376 
   455 
   377 /*!
   456 /*!
   378     Returns maximum date time in QDateTime format.
   457     Returns maximum date time, set on datetime picker, in QDateTime format.
   379 
   458 
   380     \return Maximum date and maximum time in QDateTime format.
   459     \return Maximum date and maximum time in QDateTime format.
   381 
   460 
   382     \sa setMaximumDate
   461     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   462     as a string, in a valid ISO date format. 
       
   463     
       
   464     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   465 
       
   466     \code
       
   467     ...
       
   468     <widget name="t:dtp" type="HbDateTimePicker">
       
   469         <!-- 'maximumDateTime' is a QDateTime property of HbDateTimePicker. -->
       
   470         <string name="maximumDateTime" value="02-02-15T02-15-30" />
       
   471     </widget>
       
   472       ...
       
   473     \endcode
       
   474 
       
   475     \sa setMaximumDateTime
   383 */
   476 */
   384 QDateTime HbDateTimePicker::maximumDateTime()const
   477 QDateTime HbDateTimePicker::maximumDateTime()const
   385 {
   478 {
   386     Q_D(const HbDateTimePicker);
   479     Q_D(const HbDateTimePicker);
   387     return d->mMaximumDate;
   480     return d->mMaximumDate;
   388 }
   481 }
   389 
   482 
   390 /*!
   483 /*!
   391     Sets maximum \a datetime in QDateTime format.
   484     Sets maximum \a datetime, to be set on datetime picker, in QDateTime format.
   392 	
   485     
   393 	<b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now
   486     <b>Note:</b> There's no link between Date functionality and time functionality in this API, using this API for now
   394 	would be similar to using combination of \sa setMaximumDate and \sa setMaximumTime
   487     would be similar to using a combination of setMaximumDate and setMaximumTime APIs.
   395 
   488 
   396     \param date Maximum date and maximum time in QDateTime format.
   489     \param date Maximum date and maximum time in QDateTime format.
   397 
   490 
   398     \sa maximumDateTime \sa setMaximumDate \sa setMaximumTime
   491     \sa maximumDateTime \sa setMaximumDate \sa setMaximumTime
   399 */
   492 */
   402     Q_D(HbDateTimePicker);
   495     Q_D(HbDateTimePicker);
   403     d->setMaximumDateTime(date);
   496     d->setMaximumDateTime(date);
   404 }
   497 }
   405 
   498 
   406 /*!
   499 /*!
   407     Sets minimum \a minDatetime and maximum \a maxDatetime datetimes in QDateTime format.
   500     Sets minimum \a minDatetime and maximum \a maxDatetime date and time values, to be set on datetime picker, in QDateTime format.
   408 
   501     This will allow the user to set date and time range on datetime picker.
   409 	<b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now
   502 
   410 	would be similar to using combination of \sa setMinimumDate \sa setMaximumTime and 
   503     <b>Note:</b> There's no link between Date and time in this API, using this API for now
   411 	\sa setMinimumTime, \sa setMaximumTime.
   504     would be similar to using a combination of setMinimumDate, setMaximumTime and 
       
   505     setMinimumTime, setMaximumTime APIs.
   412 
   506 
   413     \param minDateTime minimum date and time in QDateTime format.
   507     \param minDateTime minimum date and time in QDateTime format.
   414     \param maxDateTime maximum date and time in QDateTime format.
   508     \param maxDateTime maximum date and time in QDateTime format.
   415 
   509 
   416     \sa setMinimumDateTime \sa setMaximumDateTime \sa setMinimumDate \sa setMaximumDate
   510     \sa setMinimumDateTime \sa setMaximumDateTime \sa setMinimumDate \sa setMaximumDate
   417 	\sa setMinimumTime \sa setMaximumTime
   511     \sa setMinimumTime \sa setMaximumTime
   418 */
   512 */
   419 void HbDateTimePicker::setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime)
   513 void HbDateTimePicker::setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime)
   420 {
   514 {
   421     Q_D(HbDateTimePicker);
   515     Q_D(HbDateTimePicker);
   422     d->setDateTimeRange(minDateTime, maxDateTime);
   516     d->setDateTimeRange(minDateTime, maxDateTime);
   423 }
   517 }
   424 
   518 
   425 /*!
   519 /*!
   426     Returns the current time in QTime format.
   520     Returns the current time, selected in datetime picker widget, in QTime format.
   427 
   521 
   428     \return time in QTime format.
   522     \return time in QTime format.
   429 
   523 
       
   524     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   525     as a string, in a valid ISO date format. 
       
   526     
       
   527     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   528 
       
   529     \code
       
   530     ...
       
   531     <widget name="t:dtp" type="HbDateTimePicker">
       
   532         <!-- 'time' is a QTime property of HbDateTimePicker. -->
       
   533         <string name="time" value="02-15-30" />
       
   534     </widget>
       
   535       ...
       
   536     \endcode
       
   537 
   430     \sa setTime
   538     \sa setTime
   431 */
   539 */
   432 QTime HbDateTimePicker::time() const
   540 QTime HbDateTimePicker::time() const
   433 {
   541 {
   434     Q_D(const HbDateTimePicker);
   542     Q_D(const HbDateTimePicker);
   435     return d->mDateTime.time();
   543     return d->mDateTime.time();
   436 }
   544 }
   437 
   545 
   438 /*!
   546 /*!
   439     Sets the current \a time in the form of QTime.
   547     Sets the current \a time, to be set on datetime picker widget, in QTime format.
   440 
   548 
   441     \param time in QTime format.
   549     \param time in QTime format.
   442 
   550 
   443     \sa time
   551     \sa time
   444 */
   552 */
   447     Q_D(HbDateTimePicker);
   555     Q_D(HbDateTimePicker);
   448     setDateTime(QDateTime(d->mDateTime.date(), time));
   556     setDateTime(QDateTime(d->mDateTime.date(), time));
   449 }
   557 }
   450 
   558 
   451 /*!
   559 /*!
   452     Returns minimum time in QTime format.
   560     Returns minimum time, set on datetime picker, in QTime format.
   453 
   561 
   454     \return Minimum time in QTime format.
   562     \return Minimum time in QTime format.
   455 
   563 
       
   564     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   565     as a string, in a valid ISO date format. 
       
   566     
       
   567     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   568 
       
   569     \code
       
   570     ...
       
   571     <widget name="t:dtp" type="HbDateTimePicker">
       
   572         <!-- 'minimumTime' is a QTime property of HbDateTimePicker. -->
       
   573         <string name="minimumTime" value="02-15-30" />
       
   574     </widget>
       
   575       ...
       
   576     \endcode
       
   577 
   456     \sa setMinimumTime
   578     \sa setMinimumTime
   457 */
   579 */
   458 QTime HbDateTimePicker::minimumTime()const
   580 QTime HbDateTimePicker::minimumTime()const
   459 {
   581 {
   460     Q_D(const HbDateTimePicker);
   582     Q_D(const HbDateTimePicker);
   461     return d->mMinimumDate.time();
   583     return d->mMinimumDate.time();
   462 }
   584 }
   463 
   585 
   464 /*!
   586 /*!
   465     Sets minimum \a time in QTime format.
   587     Sets minimum \a time, to be set on datetime picker, in QTime format.
   466 
   588 
   467     \param time minimum time in QTime format.
   589     \param time minimum time in QTime format.
   468 
   590 
   469     \sa minimumTime
   591     \sa minimumTime
   470 */
   592 */
   473     Q_D(HbDateTimePicker);
   595     Q_D(HbDateTimePicker);
   474     setMinimumDateTime(QDateTime(d->mDateTime.date(),time));
   596     setMinimumDateTime(QDateTime(d->mDateTime.date(),time));
   475 }
   597 }
   476 
   598 
   477 /*!
   599 /*!
   478     Returns maximum time in QTime format.
   600     Returns maximum time, set on datetime picker, in QTime format.
   479 
   601 
   480     \return maximum time in QTime format.
   602     \return maximum time in QTime format.
   481 
   603 
       
   604     <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime
       
   605     as a string, in a valid ISO date format. 
       
   606     
       
   607     ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
       
   608 
       
   609     \code
       
   610     ...
       
   611     <widget name="t:dtp" type="HbDateTimePicker">
       
   612         <!-- 'maximumTime' is a QTime property of HbDateTimePicker. -->
       
   613         <string name="maximumTime" value="02-15-30" />
       
   614     </widget>
       
   615       ...
       
   616     \endcode
       
   617 
   482     \sa setMaximumTime
   618     \sa setMaximumTime
   483 */
   619 */
   484 QTime HbDateTimePicker::maximumTime()const
   620 QTime HbDateTimePicker::maximumTime()const
   485 {
   621 {
   486     Q_D(const HbDateTimePicker);
   622     Q_D(const HbDateTimePicker);
   487     return d->mMaximumDate.time();
   623     return d->mMaximumDate.time();
   488 }
   624 }
   489 
   625 
   490 /*!
   626 /*!
   491     Sets maximum \a time in QTime format.
   627     Sets maximum \a time, to be set on datetime picker, in QTime format.
   492 
   628 
   493     \param time maximum time in QTime format
   629     \param time maximum time in QTime format
   494 
   630 
   495     \sa maximumTime
   631     \sa maximumTime
   496 */
   632 */
   499     Q_D(HbDateTimePicker);
   635     Q_D(HbDateTimePicker);
   500     setMaximumDateTime(QDateTime(d->mMaximumDate.date(), time));
   636     setMaximumDateTime(QDateTime(d->mMaximumDate.date(), time));
   501 }
   637 }
   502 
   638 
   503 /*!
   639 /*!
   504     Sets minimum \a minTime and maximum \a maxTime in QTime format.
   640     Sets minimum \a minTime and maximum \a maxTime in QTime format. This will allow the user to set a time range on datetime picker.
   505 
   641 
   506     \param minTime minimum time in QTime format.
   642     \param minTime minimum time in QTime format.
   507     \param maxTime maximum time in QTime format.
   643     \param maxTime maximum time in QTime format.
   508 
   644 
   509     \sa setMinimumTime \sa setMaximumTime
   645     \sa setMinimumTime \sa setMaximumTime
   514     setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime),
   650     setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime),
   515                      QDateTime(d->mMinimumDate.date(), maxTime));
   651                      QDateTime(d->mMinimumDate.date(), maxTime));
   516 }
   652 }
   517 
   653 
   518 /*!
   654 /*!
   519   sets the \a interval for the corresponding \a section.
   655   Sets the \a interval or periodic gap for the corresponding \a section.
   520 
   656 
   521   Note: Only MinuteSection is supported at this time.
   657   <b>Note</b>: Only MinuteSection is supported at this time.<br> 
       
   658   <b>Note</b>: Minute interval must be a divisor of 60. Divisors of 60 are 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 
   522 
   659 
   523   \param section can be a MinuteSection.
   660   \param section can be a MinuteSection.
   524   \param interval to be set on each picker.
   661   \param interval to be set on each picker.
   525 */
   662 */
   526 void HbDateTimePicker::setInterval(QDateTimeEdit::Section section,int interval)
   663 void HbDateTimePicker::setInterval(QDateTimeEdit::Section section,int interval)
   532     if(section != QDateTimeEdit::MinuteSection){
   669     if(section != QDateTimeEdit::MinuteSection){
   533         d->mIntervals[section] = 1;
   670         d->mIntervals[section] = 1;
   534         return;
   671         return;
   535     }
   672     }
   536 
   673 
       
   674     if(60 % interval)
       
   675     {
       
   676         return;
       
   677     }
       
   678 
   537     d->mIntervals[section] = interval;
   679     d->mIntervals[section] = interval;
   538 
   680 
   539     if((section == QDateTimeEdit::MinuteSection) && (d->mMinuteModel)){
   681     if((section == QDateTimeEdit::MinuteSection) && (d->mMinuteModel)){
   540 
   682 
   541         d->mMinuteModel->removeRows(0, d->mMinuteModel->rowCount());
   683         d->mMinuteModel->removeRows(0, d->mMinuteModel->rowCount());
   542 
   684 
   543         d->resizeModel(d->mMinuteModel, d->mMinimumDate.time().minute(), d->mMaximumDate.time().minute(),
   685         int newStart = d->mMinimumDate.time().minute();
   544             d->mMinimumDate.time().minute(), d->mMaximumDate.time().minute(),&HbDateTimePickerPrivate::localeMinute, interval);
   686         if(interval <= newStart && !d->isMinimumHour()){
       
   687             int i = 0;
       
   688             for(i = newStart; i > 0; i -= interval){
       
   689 
       
   690             }
       
   691 
       
   692             newStart = i;
       
   693 
       
   694         }
       
   695 
       
   696         d->resizeModel(d->mMinuteModel, newStart, d->isMaximumHour()?d->mMaximumDate.time().minute():59,
       
   697             newStart, d->isMaximumHour()?d->mMaximumDate.time().minute():59,&HbDateTimePickerPrivate::localeMinute, d->mIntervals[section]);
   545     }
   698     }
   546 }
   699 }
   547 
   700 
   548 /*!
   701 /*!
   549   returns the \a interval for the corresponding \a section.
   702   returns the \a interval for the corresponding \a section.
   558 
   711 
   559     return d->mIntervals[section];
   712     return d->mIntervals[section];
   560 }
   713 }
   561 
   714 
   562 /*!
   715 /*!
   563 
       
   564     \deprecated HbDateTimePicker::primitive(HbStyle::Primitive)
   716     \deprecated HbDateTimePicker::primitive(HbStyle::Primitive)
   565         is deprecated.
   717         is deprecated.
   566 
   718 
   567     \reimp
   719     \reimp
   568 */
   720 */