This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Ktimetracker saving files - need a file per week

Tags: None
(comma "," separated)
michaelf
Registered Member
Posts
2
Karma
0
Hi Folks,
New to Ktimetracker, liking it so far.
I need to save a weekly file so that in a month or 2 months time I can go back to it and open up to see what tasks and the time I spent on the tasks that week, what is the best way to do this?
(Basically I want a way to save a file per week - weekly timesheet, in a set location with file name for the Mon of each each week)

I am on Redhat 6.2 (64bit) using Ktimetracker 4.3.3.
When I start KtimeTracker it just seems to open the file ~.kde/share/apps/ktimetracker/ktimetracker.ics and I create my tasks in there.
I would like to have file dated Mon of every week and it should open the most recent one that I had open when I last closed Ktimetracker.
I could do File, New and it creates a new tab, as far as I can see and then I would need to do File, Save and specify the full path of the name
---- IS this the only way to do it?
--- Could the the File, Save be set to default to ~.kde/share/apps/ktimetracker/ folder so that all the weekly worksheets are saved in the same location?
--- When I do File, New could it create a new one with the same tasks as I had last week, with just the timers reset to zero as most weeks the
tasks carry over from one week to the next?

Is there a better way to achieve this?

Thanks
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Moved to the PIM forum.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
michaelf
Registered Member
Posts
2
Karma
0
Hi Folks,

Not heard from anyone, so here is my own solution/workaround.
- replace ktimetracker executable with the script below
- every Monday the script will copy the current ktimetracker.ics file to a file with last monday date on it (7 days ago)
- the script will then call the originla ktimetracker executable
You still need to remember to do the Reset All Timers from the menu every Monday and do the the Start New Session every day

Perhaps someday someone more knowledgeable than me will incorporate this feature as either a -w (week file) on the command line or as a configuration option.

Script provided as is... test and use at your own risk. --- Works for me.

#!/bin/sh
#
# Purpose:
# Create a weekly timesheet for ktimetracker for each week, starting a
# new timesheet each Mon carrying over the tasks from the previous week
# for ktimetracker
#
# Methodology:
# Get Today's date
# Determine if it is Mon
# If it is Mon save a copy of the current file to last Monday's date
# and start the new week using the current file (ie. carrying over the
# tasks from last week). Remember to reset all timers for the new week.
# If it is not Monday continue with current file. Remember to reset
# the session timers
# Remember to only copy the file once on a Monday, do not
# want to recopy the file if ktimetracker is restarted on the same Monday
#
# Installation:
# Rename standard/supplied ktimetracker (/usr/bin/ktimetracker)
# to ktimetracker.orig
# Put this script in place of original ktimetracker excutable
# ie. /usr/bin/ktimetracker with the following permissions
# ls -la /usr/bin/ktimetracker
# -rwxr-xr-x. 1 root root 925176 Mar 30 2010 /usr/bin/ktimetracker
#
# Modifications:
# Date: Tue Sep 25 23:42:52 IST 2012 By: michaelf
# Reason: Created
# On Redhat 6.2 using bash shell (/bin/sh was linked to bash)
#

# Get the name of the day of the week
eval `date "+wk_day_name=%a"`

# If it is Monday save copy of current file with last Monday date
if [ "$wk_day_name" = "Mon" ]
then
# Get last Monday date in the format YYYY-MM-DD
eval `date "+year=%Y; month=%m; day=%d;" --date='-7 days'`
filename="${year}_${month}_${day}_ktimetracker.ics"

# Copy current file to last week's file
pathname=~/.kde/share/apps/ktimetracker/
if [ ! -f ${pathname}${filename} ]
then
# Only create a copy of the file if it doesn't already exist
# So that if ktimetracker is restarted on Monday that we do
# not overwrite the file from the first time it was started
cp ${pathname}ktimetracker.ics ${pathname}${filename}
fi
# Start ktimetracker with current file, remember to reset all timers
# when in ktimetracker using File menu, Reset All Times

fi

# If not Monday start ktimetracker with current file, remember to reset session timers
# when in ktimetracker using File menu, Start New Session
ktimetracker.orig

exit 0


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot]