Bug 275598 - kteatime won't support intervals larger than 1 hour
Summary: kteatime won't support intervals larger than 1 hour
Status: RESOLVED FIXED
Alias: None
Product: kteatime
Classification: Applications
Component: general (show other bugs)
Version: 1.2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Stefan Böhmann
URL:
Keywords:
: 217201 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-13 23:34 UTC by Oleg Kostyuk
Modified: 2013-10-29 23:57 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Kostyuk 2011-06-13 23:34:24 UTC
Version:           1.2.1 (using KDE 4.6.2) 
OS:                Linux

KTeatime won't support intervals larger than 1 hour. If you'll try to set "Time" in "Tea Properties" for some value, larger than 59 (in minutes field), then configuration will be accepted, but when you'll open "Configure" dialog next time - amount of minutes will be set to (%prev_amount% mod 60). For example, if you'll set it to 62 minutes, then it will be reseted to 2 minutes.

Reproducible: Always

Steps to Reproduce:
1. Open "Configure" dialog, add new tea entry, set amount of minutes to any value, larger than 60, press "Ok"
2. Open "Configure" dialog again, scroll list to just entered entry, and you'll see proper amount of time. But when you'll try to click on this item in list (select it), then amount of minutes will be reseted.

Actual Results:  
Amount of minutes reseted to %prev_value% mod 60

Expected Results:  
Amount of minutes shouldn't change
Comment 1 Burkhard Lück 2011-06-14 09:58:10 UTC
Confirmed.
But I don't think kteatime should allow to enter >59 minutes here, it should have the same behavior as for the seconds, where the entry filed has this upper limit.

This is the patch to limit minutes to 59:

Index: kdetoys/kteatime/src/timeedit.ui
===================================================================
--- kdetoys/kteatime/src/timeedit.ui    (Revision 1228128)
+++ kdetoys/kteatime/src/timeedit.ui    (Arbeitskopie)
@@ -39,7 +39,7 @@
       <enum>Qt::WheelFocus</enum>
      </property>
      <property name="maximum" >
-      <number>1440</number>
+      <number>59</number>
      </property>
      <property name="value" >
       <number>3</number>
Index: kdetoys/kteatime/src/settings.ui
===================================================================
--- kdetoys/kteatime/src/settings.ui    (Revision 1228128)
+++ kdetoys/kteatime/src/settings.ui    (Arbeitskopie)
@@ -149,7 +149,7 @@
          <bool>false</bool>
         </property>
         <property name="maximum">
-         <number>1440</number>
+         <number>59</number>
         </property>
        </widget>
       </item>

Objections to fix it this way?
Comment 2 Oleg Kostyuk 2011-06-14 10:34:11 UTC
Well, then how I can set timer to 2 hours, for example? This worked fine in KDE3 - I just set minutes to 120 - and this was very useful.

Also, don't see why it's better to close eyes and make some non-useful workaround, instead of find and fix the bug. And this is definitely bug, because when you enter 59 minutes, and then click several times on up arrow (to increase amount of minutes), then you'll see that in list time amount will be displayed _with_ hours ("1 hour 1 minute", "1 hour 2 minutes", and so on). So, KTeaTime _can_ handle hours - why you propose to cut away this functionality? As for me, your patch is not acceptable at all.

And side note: is there any reason to have any restrictions for amount of minutes? And why currently it's set to 1440? Why not 2880? As for me, this looks like Windows-way: "we always know better what users want" - but this is not so really.
Comment 3 Burkhard Lück 2011-06-14 16:02:54 UTC
KTeatime lost the functionality to accept minutes > 59 with this commit http://websvn.kde.org/?view=revision&revision=710357, where 
minuteBox->setValue(val / 60); was changed to m_ui->minutes->setValue((time%(60*60))/60);

Patch to revert that:

Index: kdetoys/kteatime/src/settings.cpp
===================================================================
--- kdetoys/kteatime/src/settings.cpp   (Revision 1236689)
+++ kdetoys/kteatime/src/settings.cpp   (Arbeitskopie)
@@ -263,7 +263,7 @@
     }
 
     ui->teaNameEdit->setText( name );
-    ui->minutesSpin->setValue( (time % ( 60 * 60 ) ) / 60 );
+    ui->minutesSpin->setValue( time  / 60 );
     ui->secondsSpin->setValue( time % 60 );
 }
 
Index: kdetoys/kteatime/src/timeedit.cpp
===================================================================
--- kdetoys/kteatime/src/timeedit.cpp   (Revision 1236689)
+++ kdetoys/kteatime/src/timeedit.cpp   (Arbeitskopie)
@@ -55,7 +55,7 @@
 
     int time=group.readEntry( "AnonymousTeaTime", 180 );
 
-    ui->minutes->setValue( ( time % ( 60 * 60 ) ) / 60 );
+    ui->minutes->setValue( time / 60 );
     ui->seconds->setValue( time % 60 );
 
     ui->minutes->setFocus( Qt::ShortcutFocusReason );
Comment 4 Stefan Böhmann 2011-06-15 12:33:22 UTC
SVN commit 1236875 by sboehmann:

Fix bug that KTeaTime won't support intervals larger than 1 hour.
Thanks to Oleg Kostyuk for reporting and thanks to Burkhard Lueck for the patch.

BUG: 275598


 M  +1 -1      settings.cpp  
 M  +1 -1      timeedit.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1236875
Comment 5 Christoph Feck 2013-10-29 23:57:38 UTC
*** Bug 217201 has been marked as a duplicate of this bug. ***