Bug 64879

Summary: add comment to each recorded time slot
Product: [Applications] ktimetracker Reporter: Ferdinand Gassauer <gassauer>
Component: generalAssignee: Thorsten Staerk <dev>
Status: RESOLVED FIXED    
Severity: wishlist CC: opensource
Priority: HI    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: enable adding comments to each task, prerelease
commenting works "a bit"

Description Ferdinand Gassauer 2003-09-24 21:04:05 UTC
Version:           1.3 (using KDE 3.1.92 (alpha2, CVS >= 20030921), compiled sources)
Compiler:          gcc version 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux (i686) release 2.4.20-4GB

To know what has been done it is mandatory to record not only the time spent but also what has been done at each time slot.
IMHO a comment field would do it, where the user can/must add a comment for each recorded time slot.
may be that this goes beyond this project, but would make it really useful.
cu
ferdinand
Comment 1 Ferdinand Gassauer 2003-09-24 21:07:35 UTC
*** Bug 64880 has been marked as a duplicate of this bug. ***
Comment 2 Mathieu Jobin 2004-05-09 19:26:10 UTC
I think this is a mandatory features. time tracking can be fun, but seriously useless without details.

without this, you can tell how much time you spent playing unreal tournament...
but who cares ;)

so, I think, we not only need the total spent, but also every single entry available in a spreadsheet somewhat. with comments one every one of 'em.

Comment 3 Mark Bucciarelli 2004-05-14 03:08:10 UTC
I can implement this now, as libical now saves ical comments.   The ics spec allows multiple comments for each event.  There are two possible implementations I can see:

(1) store comments at the task level (an iCal todo)

(2) store comment with the "closest" time entry (an iCal event)

I think I like (1), mainly because (2) becomes tricky if you want to add a comment to a task that is not currrently being timed.  It will take some work to figure out which start/stop event (an iCal event) to associate the comment with.  It seems more flexible just to stamp the comment with a datetime string and store it at the event level.

How important is it to be able to edit comments, once saved?  The simplest implementation is to provide a hot key for "Add Comment" which lets you type in as much text as you like, then save it.  No editing, no deleting.

I like simple ... especially since there will be collateral work here--we need to report on any data entered.

And speaking of reporting, it is possible with 3.2 to print time cards that break down time logged by task and day.  From you comment, it sounds like you haven't discovered this (undocumented) feature.  Turn on logging in the preferences and after logging time for a while, you can press Ctrl-Alt-C to copy the timecard text to the clipboard.
Comment 4 M G Berberich 2004-06-08 17:17:23 UTC
I would like to have comments on a time entry (an iCal event). So that something like

12:00--12:20 project A: added interrupthandling
12:20--12:40 project A: fixed taskbar
12:40--12:45 project B: helping User X
12:45--12:50 project A: fixed typo

would be possible.

At the moment we could generate subtasks, but this would give a lot of subtasks over time.

A possible way to archive this "nearly" would be to add the comment to the description of the running tasks ical-entry, adding comments multiple times would accumulate these comments in this entry, giving:

12:00--12:20 project A: added interrupthandling
fixed taskbar
12:40--12:45 project B: helping User X
12:45--12:50 project A: fixed typo
Comment 5 Thorsten Staerk 2004-06-10 11:27:41 UTC
let's keep things simple, I want to

store comments at the task level (an iCal todo)

If we have this, we do it the same way as planner and korganizer, and that is really enough, as task attributes are not the core competency of a time tracker, rather of an organizer.
As soon as you have to record your activities per time, you can establish a subtask.

If we do 

store comment with the "closest" time entry (an iCal event)

how will you represent it in the edittaskview ?
I do not have a simple idea.
Comment 6 Mark Bucciarelli 2004-06-14 15:43:18 UTC
This functionality is now on the karm feature plan (target release is 3.4).

Comment 7 Marc Haber 2004-07-05 15:47:59 UTC
I'd like to have the comment with the event, probably only with the stop event to make sure it is logged what was done.

Greetings
Marc
Comment 8 Ingo Oeser 2005-01-21 13:46:33 UTC
The comment from Marc is important esp. if you use it for 2nd level support
on a not so busy hotline, where the customer calls in. 

You could also simply use a knotes note internally, but I don't know how
complicated this is. I just usally open a note with knote
and start a task or subtask in karm. While talking and doing stuff I note
everything in knote. When doing recalls and being recalled, I switch to the
desktop which karm monitors and change my note continously.

Often I mail the whole note later to our support list, to have them informed.
This is esp. useful for special cases and if the task is not yet complete (since I could be away later and my co-workers need to continue).

This is quite effective already, but I would like to have it combined.

So the options: "force entering note on complete", "mail comment" (already in knote!), "show only incomplete" would be very useful for support usage.
Comment 9 Thorsten Staerk 2005-07-10 21:30:33 UTC
Created attachment 11749 [details]
enable adding comments to each task, prerelease
Comment 10 Thorsten Staerk 2006-05-07 19:48:26 UTC
This has also been asked @ LinuxTag.
Comment 11 Thorsten Staerk 2007-01-20 21:39:25 UTC
Created attachment 19355 [details]
commenting works "a bit"

This gives a direction how we can enable commenting.
Comment 12 Thorsten Staerk 2007-01-20 22:14:50 UTC
SVN commit 625704 by tstaerk:

Allow adding comments.
BUGS:64879


 M  +46 -12    taskview.cpp  
 M  +5 -0      taskview.h  


--- trunk/KDE/kdepim/ktimetracker/taskview.cpp #625703:625704
@@ -408,28 +408,62 @@
 QStringList TaskView::listallevents() 
 {
   kDebug(5970) << "Entering TaskView::listallevents" << endl;
-  QTableWidget* tw=new QTableWidget();
+  historywidget=new QTableWidget();
+  connect (historywidget, SIGNAL(cellChanged(int, int)), this, SLOT (historywidgetchanged(int, int)));
   QStringList labels;
-  labels << "Task" << "StartTime" << "EndTime";
-  tw->setColumnCount(3);
-  tw->setEditTriggers(QAbstractItemView::NoEditTriggers);
-  tw->setHorizontalHeaderLabels(labels);
-  tw->horizontalHeader()->setStretchLastSection(true);
+  labels << "Task" << "StartTime" << "EndTime" << "Comment" << "uid";
+  historywidget->setColumnCount(5);
+  historywidget->setEditTriggers(QAbstractItemView::AllEditTriggers);
+  historywidget->setHorizontalHeaderLabels(labels);
+  historywidget->horizontalHeader()->setStretchLastSection(true);
   KCal::Event::List eventList = _storage->rawevents();
   for(KCal::Event::List::iterator i = eventList.begin(); i != eventList.end(); ++i)
   {
-    int row=tw->rowCount();
-    tw->insertRow(row);
+    int row=historywidget->rowCount();
+    historywidget->insertRow(row);
     QTableWidgetItem* item=new QTableWidgetItem((*i)->relatedTo()->summary());
     item->setFlags(Qt::ItemIsEnabled);
-    tw->setItem(row,0,item);
-    tw->setItem(row,1,new QTableWidgetItem((*i)->dtStart().toString()));
-    tw->setItem(row,2,new QTableWidgetItem((*i)->dtEnd().toString()));
+    historywidget->setItem(row,0,item);
+    historywidget->setItem(row,1,new QTableWidgetItem((*i)->dtStart().toString()));
+    historywidget->setItem(row,2,new QTableWidgetItem((*i)->dtEnd().toString()));
+    historywidget->setItem(row,4,new QTableWidgetItem((*i)->uid()));
+    kDebug() << "(*i)->comments.count() ="  << (*i)->comments().count() << endl;
+    if ((*i)->comments().count() > 0)
+    {
+      historywidget->setItem(row,3,new QTableWidgetItem((*i)->comments().last()));
+    }
   }
-  tw->show();
+  historywidget->show();
+  historywidgetchanged(-1,-1); // signal that we are ready
+  kDebug() << "Exiting listallevents" << endl;
   return labels;
 }
 
+void TaskView::historywidgetchanged(int row, int col)
+{
+  kDebug(5970) << "Entering historywidgetchanged" << endl;
+  kDebug(5970) << "row =" << row << " col =" << col << endl;
+  static bool ready=false;
+  if (row==-1) ready=true;
+  else if (ready && (col==3))
+  {
+    kDebug(5970) << historywidget->item(row,col)->text() << endl;
+    QString uid=historywidget->item(row,4)->text();
+    kDebug() << "uid = " << uid << endl;
+    KCal::Event::List eventList = _storage->rawevents();
+    for(KCal::Event::List::iterator i = eventList.begin(); i != eventList.end(); ++i)
+    {
+      kDebug() << "row=" << row << " col=" << col << endl;
+      if ((*i)->uid() == uid)
+      {
+        (*i)->addComment(historywidget->item(row,col)->text()); 
+        kDebug() << "added " << historywidget->item(row,col)->text() << endl;
+      }
+    }
+    ready=false;
+  }
+}
+
 QString TaskView::save()
 {
     // DF: this code created a new event for the running task(s),
--- trunk/KDE/kdepim/ktimetracker/taskview.h #625703:625704
@@ -36,6 +36,7 @@
 #include "karmstorage.h"
 #include "reportcriteria.h"
 #include <QTimer>
+#include <QTableWidget>
 
 class Q3ListBox;
 class QString;
@@ -111,6 +112,9 @@
                      Task* parent = 0 );
 
   public slots:
+    /** Something in the history widget changed */
+    void historywidgetchanged(int row, int col);
+
     /** Save to persistent storage. */
     QString save();
 
@@ -230,6 +234,7 @@
     DesktopTracker* _desktopTracker;
     bool _isloading;
     Task* dragTask;
+    QTableWidget* historywidget;
 
     //KCal::CalendarLocal _calendar;
     KarmStorage * _storage;