KTimeTracker: Difference between revisions

From KDE Community Wiki
No edit summary
Line 55: Line 55:
* widgets/taskswidget.cpp - saves which tasks will be shown expanded and which ones collapsed
* widgets/taskswidget.cpp - saves which tasks will be shown expanded and which ones collapsed


= dbus ==
= dbus =


To test the dbus functionality of your KTimeTracker, have KTimeTracker running and proceed like in this example:
To test the dbus functionality of your KTimeTracker, have KTimeTracker running and proceed like in this example:

Revision as of 07:41, 20 November 2019

Ktimetracker
ktimetracker running on the N810
noframe
noframe

KTimeTracker is a standalone desktop application. This page is for people who want to participate in the ktimetracker community. So, for (future) ktimetracker developers.

How to build

Linux

mkdir build && cd build
cmake .. && make && make install

Windows

Install Craft, then:

craft ktimetracker

Developing KTimeTracker

Architecture

ktimetracker is a standalone application. MainWindow displays a TimeTrackerWidget, that is a widget containing one TasksWidget (through a TaskView object). A TaskView is associated with a TimeTrackerStorage object that handle file load/save operations and monitor file changes on disk. A TasksWidget is a QTreeView that displays tasks from a model (TasksModel).

A task has a name, description, priority and times: the time, total time, session time and total session time. A task can have subtasks. The total time is defined as the task's and all its subtasks' times.

Roadmap to the classes

timetrackerwidget displays one or more taskviews in tabs, plus the searchWidget. timetrackerpart can be integrated into a mainwindow or a kontact plugin. mainwindow adds the menu.

MainWindow is the outermost layer and initializes the menus and actions, sets up the status bar, and handles many of the signal-to-slot connections. It holds a pointer to the timetrackerwidget and Preferences objects and implements the ktimetracker DBUS interface.

TaskView does most of the work in the application. This QListWidget subclass sets up the columns in the list, the idle detection timer, the auto save timer, and the desktop tracker. It starts and stops timers, handles importing and exporting and displays the edit task dialog in response to user action. TaskView holds a private pointer to Preferences and a timetrackerstorage object.

A Task is a QListViewItem subclass stores state such as the timer totals, if a timer is currently running for the task. It also defines the list view sort order and can return a pointer to a KCal::Todo object that holds the same information.

Preferences is a singleton that stores configuration options. It raises signals when options change (for example, the location where the ktimetracker data is stored) so the application can react and adjust.

how configuration is programmed

Configuration is also called preferences. The following files are involved:

  • settings/cfg*.ui - tabs of the Settings dialog
  • settings/ktimetrackerconfigdialog.cpp
  • settings/ktimetrackerconfigdialog.h
  • settings/ktimetracker.kcfgc
  • settings/ktimetracker.kcfg
  • ktimetracker.{h,cpp} - declaring/implementing the class KTimeTrackerSettings. These files are automatically generated from ktimetracker.kcfg.
  • widgets/taskswidget.cpp - saves which tasks will be shown expanded and which ones collapsed

dbus

To test the dbus functionality of your KTimeTracker, have KTimeTracker running and proceed like in this example:

qdbus
qdbus org.kde.ktimetracker
qdbus org.kde.ktimetracker /KTimeTracker
qdbus org.kde.ktimetracker /KTimeTracker org.kde.ktimetracker.ktimetracker.quit

How to reproduce a stale lock

Here is an example to give you an idea:

touch .kde/share/apps/kabc/lock/_home_tom_.kde_share_apps_karm_karm.ics.lock

Where is what?

Development Direction

The following similar programs can give you inspiration how to move forward developing:

  • hourglass
  • gnotime
  • titrax
  • taskCoach
  • Hamster

About storage

The storage of your KTimeTracker data takes place in an iCal file. That format needs a bit of explanation. A simple one looks like the following:

BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 3.5//EN
VERSION:2.0
BEGIN:VTODO
DTSTAMP:20060915T181010Z
ORGANIZER;CN=root:MAILTO:
X-KDE-karm-totalSessionTime:0
X-KDE-karm-totalTaskTime:19
CREATED:20060609T230212Z
UID:libkcal-652058592.803
SEQUENCE:0
LAST-MODIFIED:20060915T181010Z
SUMMARY:fg
CLASS:PUBLIC
PRIORITY:5
PERCENT-COMPLETE:0
END:VTODO

BEGIN:VEVENT
DTSTAMP:20060915T181010Z
ORGANIZER:MAILTO:
X-KDE-karm-duration:300
CREATED:20060915T174305Z
UID:libkcal-6397995.845
SEQUENCE:0
LAST-MODIFIED:20060910T174305Z
SUMMARY:fg
CLASS:PUBLIC
PRIORITY:5
CATEGORIES:KArm
RELATED-TO:libkcal-652058592.803
DTSTART:20060910T172346Z
DTEND:20060910T174305Z
TRANSP:OPAQUE
END:VEVENT

END:VCALENDAR

bugs

  • Find ktimetracker's open bugs (without NEEDINFO bugs) with this query
  • find all ktimetracker's bugs with this query

coding style

It is more important that you contribute than that you contribute with the right coding style. That having said, I prefer if you use code that is consistent with QtCreator's defaults. Opening and closing brackets and parentheses should be on the same row or column.

development direction

There should not be any "New" and "Close". ktimetracker should contain exactly one taskview. See https://bugs.kde.org/show_bug.cgi?id=182317 and https://bugs.kde.org/show_bug.cgi?id=265085

Polls

recent activity

Related Projects

http://websvn.kde.org/trunk/playground/base/plasma/applets/timetracker/

Readings

  • RFC 2445