src/hbwidgets/widgets/hbdatetimepicker.cpp
changeset 7 923ff622b8b9
parent 3 11d3954df52a
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbwidgets/widgets/hbdatetimepicker.cpp	Wed Jun 23 18:33:25 2010 +0300
+++ b/src/hbwidgets/widgets/hbdatetimepicker.cpp	Tue Jul 06 14:36:53 2010 +0300
@@ -23,8 +23,8 @@
 **
 ****************************************************************************/
 
+#include "hbdatetimepicker.h"
 #include "hbdatetimepicker_p.h"
-#include "hbdatetimepicker.h"
 #include "hbstyleoption_p.h"
 
 /*!
@@ -215,7 +215,7 @@
             a minus sign is prepended in addition.</i></TD></TR>
     </TABLE>
 
-    NOTE:setDisplayFormat works only when the seperators are mentioned in the format like 'dd.mm.yy' or 'dd mm yy', this
+    NOTE:setDisplayFormat works only when the separators are mentioned in the format like 'dd.mm.yy' or 'dd mm yy', this
          will be fixed in the future versions.
 
     \param format is the display format, for datetime picker widget, in QString format.
@@ -678,23 +678,27 @@
 
     d->mIntervals[section] = interval;
 
-    if((section == QDateTimeEdit::MinuteSection) && (d->mMinuteModel)){
-
-        d->mMinuteModel->removeRows(0, d->mMinuteModel->rowCount());
-
-        int newStart = d->mMinimumDate.time().minute();
-        if(interval <= newStart && !d->isMinimumHour()){
-            int i = 0;
-            for(i = newStart; i > 0; i -= interval){
-
+    //trigger minute range change
+    int start=0,end=0;
+    if(d->mMinutePicker) {
+        start=d->mMinuteOffset;
+        end=start+d->mMinuteModel->rowCount()-1;
+        if(d->isMinimumHour() )  {
+            start = d->mMinimumDate.time().minute();
+        } else {               
+            if((d->mIntervals[QDateTimeEdit::MinuteSection]!=1) && (d->mIntervals[section]>0)) {
+                start = d->mMinimumDate.time().minute()%d->mIntervals[section];
+            } else {
+                start = 0;
             }
-
-            newStart = i;
-
+        }
+        if(d->isMaximumHour()) {
+            end = d->mMaximumDate.time().minute();
+        } else {
+            end = 59;
         }
 
-        d->resizeModel(d->mMinuteModel, newStart, d->isMaximumHour()?d->mMaximumDate.time().minute():59,
-            newStart, d->isMaximumHour()?d->mMaximumDate.time().minute():59,&HbDateTimePickerPrivate::localeMinute, d->mIntervals[section]);
+        d->setMinuteRange(start,end);
     }
 }