Bug 146679 - Can't set negative absolute hours
Summary: Can't set negative absolute hours
Status: RESOLVED FIXED
Alias: None
Product: ktimetracker
Classification: Applications
Component: general (show other bugs)
Version: Git (master)
Platform: unspecified Linux
: NOR minor
Target Milestone: ---
Assignee: Thorsten Staerk
URL:
Keywords:
: 90407 164785 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-11 20:51 UTC by Ronald
Modified: 2008-06-24 14:30 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for inconsistencies with -0:59 <=t<=-0:01 (2.84 KB, patch)
2008-03-12 14:53 UTC, Modestas Vainius
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ronald 2007-06-11 20:51:19 UTC
Version:           1.6.0 (using KDE 3.5.4, compiled sources)
Compiler:          Target: i586-mandriva-linux-gnu
OS:                Linux (i686) release 2.6.17-5mdv

Just a very minor bug in my opinion. (1) I like the functionality of KArm working with negative times, but besides setting the time using a negative relative value to something on the other end of the 0, it should also be possible to set it directly using a negative absolute hour value, but the hour-fields do not accept the dash.

(2) Strongly related but even of less importance maybe: when you edit a task with a negative time, the dash is present (inconsistent with the behavior of above) but the hour field is not editable.

Expected behaviors:
(1) The application should accepts my dash in the absolute hour fields.
(2) The application should let me edit the absolute hour fields when a negative value is in it.
Comment 1 Thorsten Staerk 2007-06-12 12:38:45 UTC
I confirm this bug. I would be glad if you could tell me what you need negative times for - I enabled them somehow, but I still cannot think about a usecase. And I am always happy to hear how people use karm (which is renamed to ktimetracker for KDE 4).
Comment 2 Thorsten Staerk 2007-06-12 12:58:33 UTC
SVN commit 674402 by tstaerk:

allow negative times
BUGS:146679


 M  +1 -1      edittaskdialog.cpp  
 M  +1 -1      edittaskdialog.h  
 M  +0 -4      ktimewidget.cpp  


--- trunk/KDE/kdepim/ktimetracker/edittaskdialog.cpp #674401:674402
@@ -1,5 +1,5 @@
 /*
- *   karm
+ *   ktimetracker
  *   This file only: Copyright (C) 1999  Espen Sand, espensa@online.no
  *   Modifications (see CVS log) Copyright (C) 2000 Klarälvdalens
  *   Datakonsult AB <kalle@dalheimer.de>, Jesper Pedersen <blackie@kde.org>
--- trunk/KDE/kdepim/ktimetracker/edittaskdialog.h #674401:674402
@@ -1,5 +1,5 @@
 /*
- *   karm
+ *   ktimetracker
  *   This file only: Copyright (C) 1999  Espen Sand, espensa@online.no
  *
  *   This program is free software; you can redistribute it and/or modify
--- trunk/KDE/kdepim/ktimetracker/ktimewidget.cpp #674401:674402
@@ -27,7 +27,6 @@
 #include <QString>
 #include <QValidator>
 #include <QWidget>
-//Added by qt3to4:
 #include <QHBoxLayout>
 #include <QKeyEvent>
 
@@ -55,9 +54,6 @@
       if ( ! ok )
         return Invalid;
 
-      if ( str.contains('-') != 0 )
-        return Invalid;
-
       if ( _tp==MINUTE && val >= 60  )
         return Invalid;
       else
Comment 3 Ronald 2007-06-12 13:58:10 UTC
Thanks for your fast reply and fix!

So what's the use of negative times? I use them to mimic the behavior of a count-down timer so I can easily see how many time is left when I'm completing a task with a time budget. Of course, it misses functionality like warnings or an alarm bell and if this functionality would have made it in a normal way to the application, there would be a seperate field for time budget or something, but it works this way.
Comment 4 Thorsten Staerk 2007-06-12 15:22:57 UTC
See https://bugs.kde.org/show_bug.cgi?id=90407 for the request for a time budget - I will not implement it.
Comment 5 Thorsten Staerk 2007-06-12 22:17:11 UTC
SVN commit 674691 by tstaerk:

Backport SVN commit 674402 to KDE 3.5 series: Allow negative times for 
budgeting time for a task.
CCBUGS:146679


 M  +0 -3      ktimewidget.cpp  


--- branches/KDE/3.5/kdepim/karm/ktimewidget.cpp #674690:674691
@@ -30,9 +30,6 @@
       if ( ! ok )
         return Invalid;
 
-      if ( str.contains('-') != 0 )
-        return Invalid;
-
       if ( _tp==MINUTE && val >= 60  )
         return Invalid;
       else
Comment 6 Thorsten Staerk 2007-06-12 22:18:53 UTC
*** Bug 90407 has been marked as a duplicate of this bug. ***
Comment 7 Modestas Vainius 2008-03-12 14:53:05 UTC
Created attachment 23877 [details]
Patch for inconsistencies with -0:59 <=t<=-0:01

The bug was not fully fixed. There is still a problem with display and input of
"negative" time if it's in -0:59 to -0:01 range. Then it's displayed without
minus. This patch fixes this issue. Applied against karm 3.5.9
Comment 8 Thorsten Staerk 2008-03-13 01:26:33 UTC
At the moment it is 1:30 am and I do not have the concentration to look at it, but the patch seems beautiful - less code partly. And I never understood the printf parameters, thanks for helping me here.
Comment 9 Thorsten Staerk 2008-03-13 01:40:08 UTC
Modestas is right:

- start karm
- add a task a
- edit task a, subtract 59 minutes
-> actual: task a shows 0:59 minutes; expected: task a shows -0:59
- edit task a, subtrack 2 hours
-> actual and expected: task a shows -2:59

this is a bug
Comment 10 Thorsten Staerk 2008-03-13 02:11:40 UTC
SVN commit 785005 by tstaerk:

Patch by Modestas Vainius to show negative times with an abs value below
1 hour correctly. Thanks!
CCBUGS:146679


 M  +2 -2      edittaskdialog.cpp  
 M  +3 -1      karmutility.cpp  
 M  +13 -8     ktimewidget.cpp  
 M  +1 -1      ktimewidget.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=785005
Comment 11 Thorsten Staerk 2008-03-13 02:17:43 UTC
For ktimetracker 4: 
- add a task a, with a negative time of 59 minutes
- task a shows 0:-59

=> this is a bug in ktimetracker 4 as well
Comment 12 Thorsten Staerk 2008-03-13 02:27:42 UTC
WebSVN link: http://websvn.kde.org/?view=rev&revision=785006
Comment 13 Thorsten Staerk 2008-06-24 14:30:55 UTC
*** Bug 164785 has been marked as a duplicate of this bug. ***